In this post I will detail how to configure a digital video link using APSync on a Raspberry Pi, a Micohard radio, and a Runcam camera.
APSync is a great new project that aims to standardize companion computer development. The way it works is by providing a software image for a variety of computers (Raspberry Pi, Intel Edison, and NVidia TX1). It comes with a number of features, including video manager and dataflash logger. Telemetry is also passed through the digital link, so the a lot of extra hardware like the telemetry radio, OSD, and analog video transmitters are done away with.
We need to turn off the hotspot in order use the Microhard link.
nmcli connection modify WiFiAP connection.autoconnect no
We also need to modify the apsync/start_cmavnode/cmavnode.conf file to broadcast to the new gateway address. Change it so it looks like this:
[to_14550]
type=udpbcast
sim_enable=false
bcastport=14550
bcastip=192.168.168.255
bcastlock=1
Now we need to change the gstreamer command to pipe the video from the Runcam to the network. This is located in the apsync/start_cherrypy/start_udp_stream file. Comment out the old one and replace it with this.
gst-launch-1.0 v4l2src device=/dev/video2 ! videoscale ! video/x-raw,width=640,height=480,framerate=30/1 ! queue ! videoconvert ! omxh264enc ! queue ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=$STREAM_TO_IP port=$STREAM_TO_PORT sync=false
This works with a Mobius and a Runcam, but the Runcam has a slightly lower latency.
Record the Raspberry Pi IP address by entering ifconfig.
Restart everything and open a webpage on your GCS. Navigate to the Raspberry Pi address, port 8000. Mine is 192.168.168.174:8000. You should be presented with the APSync Configuration webpage. Click 'Start Streaming to GCS' to enable the video stream. The last step is to capture that stream and to display it on the GCS.
gst-launch-1.0 udpsrc port=5600, buffer-size=0 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! queue ! decodebin ! autovideosink sync=false
If a video window does not appear within a few seconds , type in cat /tmp/streaming.stderr.
Now open Mission Planner and connect over UDP on port 14550. Congratulations, you should now have a digital link for video and telemetry!
This project demonstrates the usefulness of APSync, and I look forward to its continued development.
Comments
Very interesting. Thanks!
@ FernRF We are currently getting 260ms of delay. 100ms is from the Runcam out. We are still trying to figure out and minimize the other 160ms.
@ Johnathan. The price is $1000 USD. The Ubiquiti Radio might be a cheaper solution.
APSync might theoretically be used with a two-version version of the software for this project:
http://diydrones.com/profiles/blogs/new-fpv-option-fpv-hat-for-rasp...
We have been working on a two-way version of the software for the FPV HAT but have paused it in order to develop other features. At some point we'll get back to working on the two-way version, but until then, if anybody feels like working on a two-way version, the FPV HAT might be a affordable radio platform for ApSync...
@Kieran: What kind of latency do you get with the Runcam camera streaming via the Pi?
How much does the development kit cost for the microhard radio?
Some useful links for people related to ApSync:
wiki: http://ardupilot.org/dev/docs/apsync-intro.html
gitter chat: https://gitter.im/ArduPilot/companion
support discussion: http://discuss.ardupilot.org/c/apsync-companion-computers
If you're a developer interested in helping us develop APSync (it's all open source of course), please join us on the gitter chat above, thanks!
@Rana Yes I am using the first image. It is quite costly, and we have heard of potential quality control issues with Microhard. We are going to test out some Ubiquiti radios, although they are quite large.
would it be possible for you to share the image for Raspberry Pi 2 pr Pi 3 configured for microhard modem for Tx side and Rx side.
Thanks for this post. pDDL2450 Dev Kit might be quite costly.
Are you using this one ?
@Vladimir I have not tested it with any other networking gear, but it should work with Ubiquiti gear.
@Ryan this is using the pDDL2450 Dev Kit.