goodrobots / maverick

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

Network: Support svpcom wifibroadcast #761

Open fnoop opened 6 years ago

fnoop commented 6 years ago

Broken out from https://github.com/goodrobots/maverick/issues/437

fnoop commented 6 years ago

Main repo: https://github.com/svpcom/wifibroadcast

fnoop commented 6 years ago

Referring to the new wifibroadcast as wifibc, to differentiate the projects. Compile/install implemented, but wifibc works differently to wifibroadcast. wifibroadcast takes a byte stream pipe whereas wifibc is hardcoded to take a udp rtp stream on port 5600. So the gstreamer pipeline for wifibc needs to send an rtp encapsulated stream to udpsink, whereas wifibroadcast either pipes raspivid directly or uses fdsink from gstreamer.

fnoop commented 6 years ago

So create a separate systemd service manifest for wifibc which can run standalone and listen for packets on port 5600. Network interface post action for network-if-monitor.sh should remain the same.

cglusky commented 6 years ago

this is also supporting mavlink telemetry correct? so if you have maverick on robot and maverick with gcs this should support video and telemetry via wifibc?

fnoop commented 6 years ago

Ideally, yes

fnoop commented 6 years ago

Support should be complete, maverick services added: wifibc_tx and wifibc_rx. Config added in ~/config/network/wifibc, keys go in ~/data/network/wifibc.

fnoop commented 6 years ago

Need to document, but to activate, change settings in ~/data/vision/maverick-visiond.conf to:

output = udp
output_dest = 127.0.0.1
output_port = 5600

^^ This tells visiond to output rtp udp stream.

Turn on wifibc in localconf:

"maverick_network::wifibroadcast::tx_active": true,

Then create a wifibroadcast interface in localconf as per network docs (eg. wcast0), and specify the interface in ~/config/network/wifibc/tx.conf

INTERFACE=wcast0

Reboot to activate everything. At this point visiond should be streaming rtp udp to localhost 5600, and wifibc_tx service should be running which picks up the rtp udp stream and broadcasts it over the specified interface.


Todo: document receiver, but is essentially the above in reverse. Need to copy the rx key (~/data/network/wifibc/rx.key) from the sender(tx) computer to the receiver.

cglusky commented 6 years ago

Got this on an RPi2. Looks like just keygen and this is for my rx anyway.

Notice: /Stage[main]/Maverick_network::Wifibroadcast/File[/srv/maverick/data/network/wifibc]/ensure: created
Error: Could not find command '/srv/maverick/software/wifibc/bin/keygen'
Error: /Stage[main]/Maverick_network::Wifibroadcast/Exec[wifibc-genkeys]/returns: change from 'notrun' to ['0'] failed: Could not find command '/srv/maverick/software/wifibc/bin/keygen'
Notice: /Stage[main]/Maverick_network::Wifibroadcast/File[/srv/maverick/config/network/wifibc]/ensure: created
fnoop commented 6 years ago

Looks like an ordering issue, could you attach the log?

fnoop commented 6 years ago

Ordering fixed

fnoop commented 6 years ago

Need to add kernel pcap permissions for wifibc_tx/rx:

May 01 12:27:25 maverick-up wifibc.sh[6861]: /srv/maverick/software/wifibc/bin/tx -K /srv/maverick/data/network/wifibc/tx.key -k 8 -n 12 -u 5600 -p 1 wcast0
May 01 12:27:25 maverick-up wifibc.sh[6861]: Error: pcap_activate failed: socket: Operation not permitted
May 01 12:27:25 maverick-up systemd[1]: maverick-wifibc_tx.service: Main process exited, code=exited, status=1/FAILURE
May 01 12:27:25 maverick-up systemd[1]: maverick-wifibc_tx.service: Unit entered failed state.
May 01 12:27:25 maverick-up systemd[1]: maverick-wifibc_tx.service: Failed with result 'exit-code'.
May 01 12:27:39 maverick-up sudo[6968]:      mav : TTY=pts/2 ; PWD=/srv/maverick/software/maverick ; USER=root ; COMMAND=/bin/journalctl -xe
cglusky commented 6 years ago

Latest self-update on rpi0w went well so I assume ordering is fixed. Not sure how the interface errors from #770 might impact wifibc so I'll wait until you give me the all clear to proceed with testing.

cglusky commented 6 years ago

OK, so it looks like #770 is not a critical dependency. I'll give it another try today and report back.

Also want to note here that documentation of the config setting for wifibc will be important. Once I get the prototype working I'll drop an issue over in the svpcom wifibc queue which will ask nicely for a well documented conf file.

fnoop commented 6 years ago

There is no conf file for wifibc - I've created a wrapper systemctl/config file system within Maverick. Better documentation of the various settings would be nice to have though.

cglusky commented 6 years ago

Got it. My main concern would be things like how to assign channels/freq. That's pretty well documented in the ezwifibroadcst config. I am assuming since this is using UDP vs byte stream there are not as many tweaks to the other settings?

fnoop commented 6 years ago

Right so there is a config file per interface in ~/config/network/interface-.conf. The settings in there are commented out but if uncommented are supposed to be used by either normal networking or monitor/inject (wifibc) mode. In practice it's quite difficult to get right and I'm not sure how effective they are yet. See #606

fnoop commented 6 years ago

Also I did some work on netinfo recently, so maverick netinfo should return quite a bit more info about each network interface.

fnoop commented 6 years ago

Definitely want to do a complete overhaul of video including wbc for 2.0

cglusky commented 6 years ago

hmm. sorry. not sure how i modified the milestones??? i blame one of my cats.