goodrobots / maverick

UAV Autonomous Systems Management
https://goodrobots.github.io/maverick/
MIT License
173 stars 61 forks source link

webrtc doesn't work on boot #945

Closed fnoop closed 4 years ago

fnoop commented 4 years ago

On boot:

However, this isn't happening. Boot timing issues mean that visiond initial http query to janus api fails because janus isn't started yet, and webrtc initial start event seems to happen before visiond websocket server is active.

Need to fix this so visiond reliably picks up that webrtc is present and broadcasts zeroconf.

fnoop commented 4 years ago

Changed visiond to Type=notify service type, and added sdnotify to notify the systemd service when the visiond pipeline has been fully initialised and is ready for connections. It also notifies the systemd service status, eg:

Status of service: visiond
● maverick-visiond.service - Maverick Vision Daemon
   Loaded: loaded (/etc/systemd/system/maverick-visiond.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/maverick-visiond.service.d
           └─library-path.conf, openssl.conf, path.conf, typelib-path.conf
   Active: active (running) since Thu 2020-04-16 23:25:08 BST; 1min 35s ago
 Main PID: 2085 (python3)
   Status: "Automatic Pipeline Initialisation Complete"
fnoop commented 4 years ago

This isn't working, webrtc is still running before visiond: visiond: Active: active (running) since Thu 2020-04-16 23:34:44 BST; 6min ago webrtc: Active: active (running) since Thu 2020-04-16 23:34:40 BST; 7min ago

Apr 16 23:34:44 maverick-raspberrylite python3[697]: 2020-04-16 23:34:44,196 - visiond.modules.app - INFO - Notifying systemd of startup completion
Apr 16 23:34:44 maverick-raspberrylite systemd[1]: Started Maverick Vision Daemon.

Yet webrtc is starting before visiond has started?

fnoop commented 4 years ago

Setting webrtc service to only start after visiond seems to have done the trick - it only starts directly after visiond has fully started (and the websocket server is therefore up and running and waiting for webrtc events).

SamuelDudley commented 4 years ago

Confirming this is now working nicely on my pi3b+. Including streaming via webrtc and rtsp at the same time.

fnoop commented 4 years ago

Awesome, thanks for the feedback :)