Using APSync to Build a Long Range Digital Video Link

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.

Views: 2141

Comment by Kieran on April 18, 2017 at 11:09am

@ 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.

Comment by FernRF on April 21, 2017 at 11:22am

Very interesting. Thanks!

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

Groups

Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2017   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service