mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
sdfjashoiuo
This commit is contained in:
@@ -56,7 +56,7 @@ cd ~/MultiRoombaRover
|
|||||||
sudo ./pi/install_roverd.sh
|
sudo ./pi/install_roverd.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
Then point each rover's `/etc/roverd.yaml` at `ws://<server>:8080/rover`, set `name` to the rover’s ID, and (optionally) override `media.publishUrl` if your control server isn’t `192.168.0.86`. The new WHIP publisher service (`whip-publisher.service`) continuously captures the Pi camera with `libcamera-vid`, pipes it through FFmpeg, and publishes straight into the server’s mediaMTX instance at `http://<server>:8889/whip/<name>`. Use the “Restart Camera” button if you enable media management so roverd can bounce the publisher service remotely.
|
Then point each rover's `/etc/roverd.yaml` at `ws://<server>:8080/rover`, set `name` to the rover’s ID, and (optionally) override `media.publishUrl` if your control server isn’t `192.168.0.86`. The new WHIP publisher service (`whip-publisher.service`) uses GStreamer (`gst-launch-1.0 libcamerasrc ! ... ! whipclientsink`) to encode the Pi camera to H264 and publish straight into the server’s mediaMTX instance at `http://<server>:8889/whip/<name>`. Install `libcamera-apps` plus `gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libcamera` on each Pi so the pipeline is available. Use the “Restart Camera” button if you enable media management so roverd can bounce the publisher service remotely.
|
||||||
Heads-up: the BRC pulser now uses libgpiod; make sure the `roverd` service account is in the `gpio` group (or otherwise allowed to access `/dev/gpiochip*`) and set `brc.gpioChip` if your hardware exposes a different chip name.
|
Heads-up: the BRC pulser now uses libgpiod; make sure the `roverd` service account is in the `gpio` group (or otherwise allowed to access `/dev/gpiochip*`) and set `brc.gpioChip` if your hardware exposes a different chip name.
|
||||||
|
|
||||||
## Fedora server deployment
|
## Fedora server deployment
|
||||||
|
|||||||
+20
-2
@@ -32,6 +32,16 @@ Run the resulting `dist/roverd-dummy` on any machine; it will connect to the ser
|
|||||||
|
|
||||||
## Automated installation (recommended)
|
## Automated installation (recommended)
|
||||||
|
|
||||||
|
Make sure the Pi has GStreamer 1.22+ plus the libcamera + bad plugin sets (Bookworm ships them):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install libcamera-apps \
|
||||||
|
gstreamer1.0-tools gstreamer1.0-plugins-good \
|
||||||
|
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
|
||||||
|
gstreamer1.0-libcamera
|
||||||
|
```
|
||||||
|
|
||||||
Once the binary (and repo) are on the Pi, run the helper script from the repo root:
|
Once the binary (and repo) are on the Pi, run the helper script from the repo root:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -79,8 +89,16 @@ If you set `media.manage: true` in `/etc/roverd.yaml`, make sure the `roverd` se
|
|||||||
|
|
||||||
## WHIP publisher details
|
## WHIP publisher details
|
||||||
|
|
||||||
The `whip-publisher.service` unit runs `/usr/local/bin/whip-publisher`, a small shell wrapper that pipes `libcamera-vid` into FFmpeg and POSTs the result to `media.publishUrl`. roverd writes `/var/lib/roverd/whip.env` on startup (and whenever you restart the service) so the publisher inherits the correct `WHIP_URL`, resolution, FPS, and bitrate. Tweak those knobs under `media.videoWidth`, `media.videoHeight`, `media.videoFps`, and `media.videoBitrate` in `/etc/roverd.yaml` if you need different camera settings.
|
The `whip-publisher.service` unit runs `/usr/local/bin/whip-publisher`, a small shell wrapper that launches:
|
||||||
Use `sudo systemctl status whip-publisher` to watch the pipeline logs; the unit auto-restarts whenever the network drops or FFmpeg exits.
|
|
||||||
|
```bash
|
||||||
|
gst-launch-1.0 libcamerasrc ! video/x-raw,width=WIDTH,height=HEIGHT,framerate=FPS/1 \
|
||||||
|
! videoconvert ! x264enc tune=zerolatency bitrate=BITRATE_KB key-int-max=FPS \
|
||||||
|
! h264parse config-interval=1 ! whipclientsink signaller::whip-endpoint=$WHIP_URL
|
||||||
|
```
|
||||||
|
|
||||||
|
roverd writes `/var/lib/roverd/whip.env` on startup (and whenever you restart the service) so the publisher inherits the correct `WHIP_URL`, resolution, FPS, and bitrate. Tweak those knobs under `media.videoWidth`, `media.videoHeight`, `media.videoFps`, and `media.videoBitrate` in `/etc/roverd.yaml` if you need different camera settings.
|
||||||
|
Use `sudo systemctl status whip-publisher` to watch the pipeline logs; the unit auto-restarts whenever the network drops or GStreamer exits.
|
||||||
|
|
||||||
## Server + UI
|
## Server + UI
|
||||||
|
|
||||||
|
|||||||
+21
-39
@@ -18,49 +18,31 @@ VIDEO_HEIGHT="${VIDEO_HEIGHT:-720}"
|
|||||||
VIDEO_FPS="${VIDEO_FPS:-30}"
|
VIDEO_FPS="${VIDEO_FPS:-30}"
|
||||||
VIDEO_BITRATE="${VIDEO_BITRATE:-3000000}"
|
VIDEO_BITRATE="${VIDEO_BITRATE:-3000000}"
|
||||||
|
|
||||||
FFMPEG_BIN="${FFMPEG_BIN:-/usr/bin/ffmpeg}"
|
GST_BIN="${GST_BIN:-/usr/bin/gst-launch-1.0}"
|
||||||
|
|
||||||
if [[ -n "${LIBCAMERA_BIN:-}" ]]; then
|
if [[ ! -x "$GST_BIN" ]]; then
|
||||||
LIBCAMERA_BIN_PATH="$LIBCAMERA_BIN"
|
if command -v gst-launch-1.0 >/dev/null 2>&1; then
|
||||||
elif command -v rpicam-vid >/dev/null 2>&1; then
|
GST_BIN="$(command -v gst-launch-1.0)"
|
||||||
LIBCAMERA_BIN_PATH="$(command -v rpicam-vid)"
|
else
|
||||||
elif command -v libcamera-vid >/dev/null 2>&1; then
|
echo "gst-launch-1.0 not found; install gstreamer1.0-tools and plugins." >&2
|
||||||
LIBCAMERA_BIN_PATH="$(command -v libcamera-vid)"
|
exit 1
|
||||||
else
|
fi
|
||||||
echo "Neither rpicam-vid nor libcamera-vid found; install the libcamera apps." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -x "$LIBCAMERA_BIN_PATH" ]]; then
|
|
||||||
echo "Video capture binary not executable at ${LIBCAMERA_BIN_PATH}" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ ! -x "$FFMPEG_BIN" ]]; then
|
|
||||||
echo "ffmpeg not found at ${FFMPEG_BIN}" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run_pipeline() {
|
run_pipeline() {
|
||||||
"${LIBCAMERA_BIN_PATH}" \
|
local bitrate_kbps=$((VIDEO_BITRATE / 1000))
|
||||||
--inline \
|
if [[ "$bitrate_kbps" -le 0 ]]; then
|
||||||
--timeout 0 \
|
bitrate_kbps=3000
|
||||||
--width "${VIDEO_WIDTH}" \
|
fi
|
||||||
--height "${VIDEO_HEIGHT}" \
|
"${GST_BIN}" -e \
|
||||||
--framerate "${VIDEO_FPS}" \
|
libcamerasrc \
|
||||||
--bitrate "${VIDEO_BITRATE}" \
|
! "video/x-raw,width=${VIDEO_WIDTH},height=${VIDEO_HEIGHT},framerate=${VIDEO_FPS}/1" \
|
||||||
--codec h264 \
|
! queue \
|
||||||
--denoise cdn_off \
|
! videoconvert \
|
||||||
--nopreview \
|
! x264enc speed-preset=ultrafast tune=zerolatency bitrate="${bitrate_kbps}" key-int-max="${VIDEO_FPS}" byte-stream=true \
|
||||||
--output - |
|
! "video/x-h264,profile=baseline" \
|
||||||
"${FFMPEG_BIN}" \
|
! h264parse config-interval=1 \
|
||||||
-hide_banner \
|
! whipclientsink signaller::whip-endpoint="${WHIP_URL}"
|
||||||
-loglevel warning \
|
|
||||||
-f h264 \
|
|
||||||
-i pipe:0 \
|
|
||||||
-c:v copy \
|
|
||||||
-an \
|
|
||||||
-f whip \
|
|
||||||
"${WHIP_URL}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|||||||
+16
-5
@@ -80,11 +80,22 @@ log() {
|
|||||||
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*"
|
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! command -v rpicam-vid >/dev/null 2>&1 && ! command -v libcamera-vid >/dev/null 2>&1; then
|
if ! command -v gst-launch-1.0 >/dev/null 2>&1; then
|
||||||
log "WARNING: neither rpicam-vid nor libcamera-vid found in PATH; install the Raspberry Pi libcamera apps (sudo apt install libcamera-apps)."
|
log "WARNING: gst-launch-1.0 not found; install GStreamer (sudo apt install gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libcamera)."
|
||||||
fi
|
else
|
||||||
if ! command -v ffmpeg >/dev/null 2>&1; then
|
if command -v gst-inspect-1.0 >/dev/null 2>&1; then
|
||||||
log "WARNING: ffmpeg not found in PATH; install ffmpeg for WHIP publishing"
|
if ! gst-inspect-1.0 whipclientsink >/dev/null 2>&1; then
|
||||||
|
log "WARNING: whipclientsink element missing; install gstreamer1.0-plugins-bad (1.22+)."
|
||||||
|
fi
|
||||||
|
if ! gst-inspect-1.0 libcamerasrc >/dev/null 2>&1; then
|
||||||
|
log "WARNING: libcamerasrc plugin missing; install gstreamer1.0-libcamera."
|
||||||
|
fi
|
||||||
|
if ! gst-inspect-1.0 x264enc >/dev/null 2>&1; then
|
||||||
|
log "WARNING: x264enc element missing; install gstreamer1.0-plugins-ugly."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "WARNING: gst-inspect-1.0 not found; unable to verify GStreamer plugins."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ensure_user roverd "dialout,gpio,video"
|
ensure_user roverd "dialout,gpio,video"
|
||||||
|
|||||||
Reference in New Issue
Block a user