This blog is a continuation of my previous post.
How to build a High-Definition FPV UAV using a Rasperry PI with HD camera, using a high speed WiFi link
This post will discuss how to use GStreamer and Mission Planner together to display the HD video with a HUD (Head-Up-Display).
Note: I have only tested this feature on Windows so the instructions given here are for Windows only.
To give proper credit, the HUD created here was borrowed from APM Planner, a Qt-Based app similar to Mission Planner. The HUD part was created from the Qt codebase QML HUD created by Bill Bonney who is on the APM Planner development team. To make the HUD work with the background video, I used a GStreamer library called "QtGStreamer" which integrates GStreamer plugins with painting on a Qt widget. This library is available on the GStreamer website.
The end-result is dynamically added to Mission Planner using the plug-in architecture.
In the previous posts I discussed used a Raspberry PI and a High-speed WiFi link using GStreamer on the PI and the ground station PC. To get the HUD to work, you need to already have a successful link with the video on your ground station.
Here are the steps to follow to install the plugin:
1) Install Mission Planner.
2) Download and install GStreamer from this link. Use the x86 version, the x86_64 version will NOT work. (Use the default path 'C:\GStreamer' when installing). When installing GStreamer, select 'Custom' install and select ALL plugins to be installed.
3) Follow the steps in the previous blog noted above to get your video stream working.
4) Download and the MSI installer from this link. and run the installer.
If all went well, you should have the plugin installed.
Open Mission Planner and navigate to the "Flight Data" page and right-click on the map. You should see a menu item called "GStreamer HUD" as shown below:
Select this menu item and the following screen should appear:
In the upper-left corner is a context menu. Here is where you enter your GStreamer Pipeline string. If you had the video displaying without the HUD using a valid pipeline, enter it here.
Note: The GStreamer Pipeline string should be exactly the same as the string you used before, but WITHOUT the final video sink element. The video sink is the QtGStreamer element which will be added automatically by the plugin. The GStreamer pipe should therefore be the same, except remove the last element for the video sink.
Here is an example string I used on my setup:
udpsrc port=9000 buffer-size=60000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue ! avdec_h264
If all is well, you can connect to your UAV and see the HUD elements moving. To change the HUD, right click on the display and select which elements you want to display. The default is to display everything shown here.
If anybody has problems, please post back and I'll update the blog in case I missed something, and you cannot get it to work.
Happy Flying!
Comments
@Patric, @Tommy, for your information...
My LTE router ( we call it in Korea ) provides config menu to log-in Dyndns.
And also it provides public IP address but not static. that's why I use Dyndns.
The current system I use is that Pixhawk<--(ser2net)-->Rpi<-->LTE router for telemetry over TCP in my Drone.
MP connects to the domain name of Rpi configured by Dyndns
DDNS of Dyndns is working well in current system but not in gstream udpsink.
@Tommy, in my case, my LTE modem automatically log in Dyndns to map ip address of LTE modem to domain name configured by Dyndns when power on.
@Patric, I've just followed your blog saying how to connect Rpi's Gstreamer from MP
@Tommy on Rpi+Cam, raspivid -t 0 -w 1280 -h 720 -fps 30 -b 1700000 -o - | gst-launch -v fdsrc ! h264parse config-interval=1 ! rtph264pay ! udpsink host = GCS_ip port= 9000
on GCS udpsrc port=9000 buffer-size=60000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue ! avdec_h264.
The above is just followed Patric's blog.
@Kyomo Jung, can you share your Gstreamer/raspivid -command lines?
Try to configure DDND's DNS server ip's in your Rpi. that works for me. They are updated all the time
---------
In rc.local i use after LTE connection:
rm /etc/resolv.conf
echo nameserver 216.146.35.35 >> /etc/resolv.conf
echo nameserver 216.146.36.36 >> /etc/resolv.conf
@Kyomo Jung, So you are using an LTE modem on the UAV and GCS? Seems like you can do a dns lookup to get the IP address of your GCS on the PI and feed that to your gstreamer pipeline. Are you hard coding it in your Youtube demo?
@Patrick, it's fantastic and thank you so much ^^. I have one more question on DDNS. My Ground Station ( Mission Planner ) has a domain name hosted by Dyndns but the Air ( Rpi + Rpi Cam ) can't feed video to the G/S but feed by ip address. Do you have any information on Dyndns?
P.S : my test video is as followed http://youtu.be/wEzkj5OnBr0
Here is the string I use in the HUD
GStreamer Pipeline String = "udpsrc port=5001 ! application/x-rtp, payload=96 !
rtpjitterbuffer ! rtph264depay ! avdec_h264"
The same string works fine when I use command line outside of mission planner
@Amit, That means the HUD is working fine with gstreamer, do you get any error messages when you try the video pipe from the Raspberry PI? Also, try entering the string, and re-load the HUD by right-clicking on it, and turn of the 'Video' checkbox and then turn it back on. If you still do not see the video, I would double-check your pipeline string. Please post your pipeline string if you can't get it to work.