3689624585?profile=original

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:

3689624376?profile=original

Select this menu item and the following screen should appear:

3689624624?profile=original

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!

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Ok, got it work with UDP-based streaming - by accident.  I had the HUD up and connected to Mavlink, then manually turned on the video stream at the Pi - then the HUD came up!

    Is that the crucial sequence?  HUD up first, then video?

  • Thought I found it:  The Pi command should have a "-" in gst-launch-1.0.  I fixed that and the Pi output says it is playing the video, but the HUD still remains blank.  Sheesh.  Here is the HUD cli:

    3702358324?profile=original

  • Ok, excellent progress.  I went back to square one and made a direct point-to-point network between a PC and the Pi.  PC can ping Pi and vice-versa.  In this configuration I got the TCP-based video to work again.  This tells me that either my other PC or my NETGEAR wireless router is blocking ports 5000 and 9000 or some other aspect of the communication between the Pi and HUD.

    I got the TCP-based streaming to work, but now I cannot get the UDP-based stream to work - I want to compare its performance to the TCP-based stream (I think it should have less latency).  However, the HUD remains blank - it does pick up the Mavlink though from the Pi/Navio.  Here are the UDP strings, directly from your earlier posts, but with PC's (running Mission Planner and the HUD) IP address inserted:

    Pi UDP Stream Raspivid Command:

    /opt/vc/bin/raspivid -t 0 -w 1280 -h 720 -fps 30 -b 1700000 -o - | gst-launch1.0 -v fdsrc ! h264parse config-interval=1 ! rtph264pay ! udpsink host = 192.168.1.102 port= 9000

    HUD UDP pipeline command:

    udpsrc port=9000  buffer-size=60000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue ! avdec_h264

    Here is the HUD CLI:

    3702358368?profile=original

    I appreciate your patient advice.  Thanks,

    Paul

  • Got working the HD_HUD in Mission Planner from EZ_WifiBroadcast on Windows PC, thanks to Patrick Duffy.
    https://www.youtube.com/watch?v=eHCfyWhEAvI

    For more about EZ_Wifibroadcast, visit https://www.rcgroups.com/forums/showthread.php?2664393-EZ-WifiBroad...!

  • @Paul, those errors can be ignored.  They should not stop the video stream.  Make sure you can ping the GCS pc from the PI and double-check you have port 9000 open on the PC. 

  • I went back to your original UDP strings:

    On the Pi:

    raspivid -t 0 -w 1280 -h 720 -fps 30 -b 1700000 -o - | gst-launch1.0 -v fdsrc ! h264parse config-interval=1 ! rtph264pay ! udpsink host = 192.168.1.104 port= 9000

    Where the IP address is that of the PC running the HUD

    In the HUD pipeline:

    udpsrc port=9000  buffer-size=60000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue ! avdec_h264

    Now I am getting this error:

    3702357987?profile=original

     

  • I tried installing on another Windows 10 PC.  I get the test pattern, but still get the:  "Could not open the resource for reading." error.

  • @Paul,  if you can't get the test pattern, your install is hosed.  Do you get any error messages on the console window?

  • Ok, please pardon my frustration, but I cannot get it to work at all any more.  I can't even get the test pattern to play.  I tried removing and re-installing the HUD, I looked and there are no residual files from old gstreamer installs.  The HUD does connect to Mission Planner by Mavlink.  Could it be that I am using TCP for the mavlink connection and am trying UDP for the video?

    Here is the Pi's raspivid command:

    raspivid -t 0 -w 1280 -h 720 -fps 30 -b 1700000 -o - | gst-launch1.0 -v fdsrc ! h264parse config-interval=1 ! rtph264pay ! udpsink host = <Pi-IP-Address> port=5000

    Here is the HUD pipeline string:

    udpsrc port=5000  buffer-size=60000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue ! avdec_h264

    I'm starting to get depressed.  What am I missing with this?

    Thanks,

    Paul

  • Hi Patrick,

    Here is the HUD pipeline string:

    tcpclientsrc host=<Pi IP address> port=5000 ! gdpdepay ! rtph264depay ! avdec_h264

    Here is the RPi raspivid command:

    raspivid -t 0 -h 1080 -w 1920 -fps 30 -b 2000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse !  rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=<Pi IP address> port=5000

    These worked at one time, but when I changed the Pi to a different IP address I am no longer able to get video.

    Thanks for your advice.

    Paul

This reply was deleted.