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
@Patrick: Yes, I am building for Windows. I think there is a problem with detecting qt5 when i fire up cmake:
-- Building for: Visual Studio 12 2013
-- Using Qt4 (min: 4.7)
-- Found unsuitable Qt version "5.4.0" from D:/Qt/5.4/msvc2013/bin/qmake.exe
-- Could NOT find Qt4or5 (missing: _Qt4or5_FOUND Core Gui Widgets)
-- Boost version: 1.57.0
......
CMake Error at c:/CMake/share/cmake-3.1/Modules/Qt4Macros.cmake:499 (message):
Can not use "Core" module which has not yet been found.
Having your build directory would really be great.
@ap105, Building QtGStreamer is a bit tricky. Do you have CMake installed on your system? Running CMake will help find the missing modules and if your path is setup correctly. I can upload the build directory but it will only work on Windows. Are you building for Windows or ??
@Baz, If you have a working stream without the HUD, it should work in the HUD, but you have to modify the string to leave off the last element (video sink). The last ! should be removed. You are showing this string:
udpsrc port=5000 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 !
The last element in the pipeline should be 'avdec_h264' (without extra exclamation point).
@Patrick. Thanks for releasing the source. I think I am close to a complete build setup, but I still fail to compile qtgstreamer. Do you have any guide how to compile it, or would you share your c:\qt-gstreamer-1.2.0\build\ directory? This would fix the remaining linker dependency issue I have.
@Baz, there is a suspicious message, "Error, Empty pipeline not allowed". Since you are specifying a valid pipeline string, I would guess that one of the plugins is not loading correctly. Try running gst-inspect on each element of your pipeline to see if there are any load issues. It could also be an issue of your 'PATH' variable. I have had issues with different version of GLIB being loaded because windows finds the glib dll in a different folder, and it causes gstreamer to choke.
@Baz, Did you try turning on gstreamer debugging? If it was working, and then stopped, try uninstalling everything on the windows pc (including wiping the folder), and re-install gstreamer fresh. You can also delete the plugin cache to force it to re-create the plugin database. Did you install anything after you had it working? Could be installing the Mission Planner plugin caused something to break. Also, if you had the 64 bit version of gstreamer, make sure you remove that too.
Hello Baz,
What's the pipeline you are using on the PI and Windows machine?
This is the string I use on Windows from the command prompt:
C:\gstreamer\1.0\x86\bin\gst-launch-1.0 udpsrc port=9000 buffer-size=60000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue ! avdec_h264 ! video/x-raw, format=I420 ! d3dvideosink sync=false
In the HUD it looks like this:
udpsrc port=9000 buffer-size=60000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue ! avdec_h264
Let me know your setup and I'll see if I can reproduce your problem.
@RatFeet, I suspect you have a driver issue on windows. Have you tried on different hardware?
@RatFeet, is that the last message before it freezes? One possible cause is that GLib is loading from a different location than where GStreamer is installed. If you have cygwin or minGW installed, it's possible that a different version the GLib dll is getting loaded. You may have to modify your 'path' environment variable. This is just a guess.
@RatFeet, I would turn on GStreamer debugging and see if you get any error messages when the stream starts.
Check out this link: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/...
Set GST_DEBUG to something like 6 and watch the console window.
Also, I would check that you have the latest version of the video driver for your system. Don't rely on windows update, go directly to the manufacturer's website.
-
28
-
29
-
30
-
31
-
32
of 34 Next