This assumes you have the Onboard Computer already loaded with an appropriate Debian based distribution (Raspbian on the Raspberry PI, Ubuntu for Odroid, etc.) and already configured for Ethernet communications with your ground station computer. Alternatively, you can boot the Onboard Computer with a monitor and keyboard and work directly with it. It also assumes you have a USB camera already plugged in.
Note on Odroid lubuntu
The official Odroid Ubuntu, at least the one I use (ubuntu-14.04.2lts-lubuntu-odroid-c1-20150320.img), came with a hodgepodge of preinstalled GStreamer packages that were not correctly installed. I had to first remove it (and some other packages that depended on it) before reinstalling properly.
To see what you have use this command:
<code> dpkg -l | grep gstreamer </code>
The idea is to purge it all before installing properly again:
<code> sudo apt-get remove –purge snappy sudo apt-get remove –purge gir1.2-gstreamer-1.0 sudo apt-get remove –purge “^gstreamer*” sudo apt-get remove –purge “^libgstreamer*” sudo apt-get autoremove </code>
Installing GStreamer for Video Streaming
Use apt-get to install the GStreamer packages:
<code> sudo apt-get update sudo apt-get install “^gstreamer1.0*” </code>
Assuming you have a camera capable of hardware encoding h.264 video (such as the Logitech C920), you can test the video streaming using these commands:
On Raspberry PI (Raspbian):
<code> gst-launch-1.0 uvch264src initial-bitrate=1000000 average-bitrate=1000000 iframe-period=1000 device=/dev/video0 name=src auto-start=true src.vidsrc ! video/x-h264,width=1920,height=1080,framerate=24/1 ! h264parse ! rtph264pay ! udpsink host=xxx.xxx.xxx.xxx port=5000 </code>
On Odroid (Ubuntu):
<code> gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-h264,width=1920,height=1080,framerate=24/1 ! h264parse ! rtph264pay ! udpsink host=xxx.xxx.xxx.xxx port=5000 </code>
Where xxx.xxx.xxx.xxx is the IP address of your the computer running QGroundControl. You may tweak the bitrate and the FPS based on your needs and/or available bandwidth when using uvch264src, or the resolution for either one. Also note that we assume you only have one video camera and it is /dev/video0. If you have more than one (or have ever installed another one), it may be that it is assigned to /dev/video1, etc.
You can now launch QGroundControl and select Video Background in the Main Flight Display. It will show the video stream from your Onboard Computer as shown above.
Alternatively, assuming the ground computer has the GStreamer command line tools installed, use this command from the command line:
<code> gst-launch-1.0 udpsrc port=5000 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' ! rtph264depay ! avdec_h264 ! autovideosink fps-update-interval=1000 sync=false </code>
Supported Camera Resolutions and Frame Rate
To see what resolutions your camera can use, use this command:
<code> v4l2-ctl –list-formats-ext </code>
Look at the various supported resolutions under H264 Pixel Format. It will show a long list showing the resolution and the various frame rates supported for each. As an example, here are the frame rates for 960×720:
Index : 1 Type : Video Capture Pixel Format: 'H264' (compressed) Name : H.264
Size: Discrete 960×720 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.042s (24.000 fps) Interval: Discrete 0.050s (20.000 fps) Interval: Discrete 0.067s (15.000 fps) Interval: Discrete 0.100s (10.000 fps) Interval: Discrete 0.133s (7.500 fps) Interval: Discrete 0.200s (5.000 fps)
So if you want to use 920×720 at 15fps, you would change the video definition above to:
<code> video/x-h264,width=920,height=720,framerate=15/1 </code>
Ground Station Link
For connecting the Onboard Computer to the ground station, you can use WiFi as explained in access_point.