Nicolas Brieger's Posts (2)

Sort by

Using your own map data in Mission Planner

So tell me, what is the goal of this post?
The goal is that you, too, see a picture like this:
3689541294?profile=originalAnd... why would anyone want this when we have global satellite coverage via Google Maps?
In some parts of the world, Googles satellite imagery is not very accurate. Custom maps allow you to use a better overview of what your Ardupilot is doing.
Another advantage is that the method detailed in this post works completely offline. That means you don't have to prefetch the region in which you are flying.
A third point is that although not detailed in this post all kinds of overlays over map data can be created by your GIS server before displaying the data on MissionPlanner.
Ok so tell me: What do I have to do?
To follow the first steps of this tutorial you need two things: GeoServer, which is an open source WMS (Web Map Service) server and a GeoTIFF image of the region in which you are flying.
For the purpose of this tutorial, I will be using sample data provided by the USGS.
So, download these things:
GeoServer: http://geoserver.org/display/GEOS/Stable
GeoTIFF: ftp://ftp.remotesensing.org/geotiff/samples/usgs/ (I used c41078a1.tif and c41078a1.lgo)
Create a separate folder, for example "geotiff_examples" somewhere on your computer and put c41078a1.tif and c41078a1.lgo in there.
You said that is for the first steps! What is with the other ones?
Well... the last step currently requires that you download my fork of the MissionPlanner and compile it yourself which is clearly out of scope for this blog post.
If one of the git wizards thinks that my changes are good and helpful this wizard could tell me what to do to get the changes included into the main tree?
The problem currently is that MissionPlanner does not produce completely WMS compliant messages and does not check if the provided WMS server is capable of responding to the MissionPlanner. I fixed that.
My fork is located under https://github.com/korgan/MissionPlanner
tl;dr: That means exactly?
Currently you probably cannot display your image in MissionPlanner.
Okay, lets go; what do I have to do?
Install GeoServer. Installation instructions are located under http://docs.geoserver.org/stable/en/user/installation/index.html
Done. Whats next?
First, you should open your browser and visit the admin homepage, per default it is located at http://localhost:8080/geoserver/web/ . Login and click on "Create Workspaces".

3689541363?profile=originalName the new workspace, in this example I named it "apm_planner_wms" and type in some arbitrary URL. Make it the default workspace. Submit.
Go back to the home screen and click on "Add stores".
Choose the GeoTIFF option. In the next screen, make sure that the workspace is apm_planner_wms, type in a name and a description and browse to the folder where you saved your GeoTIFF from before. Save.
After that, you should see this page:

3689541170?profile=original

Click on the "Publish" action. On the following page only one thing is super important: Scroll until you see the "Coordinate Reference System" options. The Declared SRS must be EPSG:4326! You can just type the number in. Save again.

3689541408?profile=originalNow, we are ready to test. On the left column, click on "Layer Preview". Search for your layer, probably named "apm_planner_wms:c41078a1".
Click on Select one -> PNG and you should see this image.

3689541385?profile=originalIf you do not see it, you have done something wrong (or I failed to mention something...). Please read this part of the tutorial again.

As a last thing to do in GeoServer, you have to go to Workspaces -> apm_planner_wms and make sure, that "WMS" under Services is checked.

Wow, that was alot. I need a nonalcoholic beverage.
Me too.

I have followed every step. Now I want this litte image from the preview in my Mission Planner!
Heres the thing: As I have said, unless you compile the Mission Planner from my fork, the following steps will not work.

That makes me sad.
Me too.

I have compiled your Mission Planner! Tell me what to do now!
In the Flight Plan tab on the far right there is a litte scroll down list where you can choose between different maps. Choose "CustomWMS" and adialog should pop up.

Give it the URL of your server ( http://localhost:8080/geoserver/apm_planner_wms/wms ) and click okay. The following box will tell you to choose a layer. Our newly created WMS server has only one layer so we put 0 into the box or just click okay without typing anything.

And there you have it! Our sample tiff is displayed:

3689541452?profile=original
Liar! Nothing is displayed! I am ruined, RUINED I say!
Relax. Have a snickers, Did you check that you are at the correct coordinates? The map is quite small, so you have to be around Lat 40.77557094048379 Lng 80.0929875534263

I still do not see anything.
Well, then I forgot a step or you did not follow one.

Your screenshot does not look good at all. Why should I use that again?

Download the sample tiff and zoom in. That is what you get in the Mission Planner, too. And I can tell you that allthough it is not of the very best quality, it is not in the slightest comparable to the low-res screenshot above.

Is there anything more I can do now? This one map is pretty boring.
Yes it is (apart from the fact that maps never are boring). But: You could create your own GeoTIFF. Or you could implement a custom OpenStreetMap server on your laptop. Or you can display other WMS sources like a hydrogeography map of your area or one of the hillshaded maps (http://129.206.228.72/cached/hillshade):

3689541183?profile=original

That is Europe if you did not notice.

You convinced me!

Please make sure you say that again in the comments below :-)

Read more…

Digital FPV with X8

3689464947?profile=original

Over the course of the last two weeks, I built a fully digital FPV setup.

Previously, I used an analog camera, Eagle Tree OSD, 1.3GHz Video Link and a handmade FPV ground station + FatShark goggles. But well... the video quality arriving on the ground was pretty bad when compared to current video standards, even when I used a GoPro as the video source.

This led to my current setup: Digital IP camera (really cool, it can be removed by screwing it out of the black holder) and a WLAN bridge. As the FatSharks do not support digital video they had to be replaced... by a 40" flatscreen hanging in my car (pics after this weekend). It's awesome!

Naturally, raw video is not enough: I need an OSD. First version used my laptop's crappy camera, read out using OpenCV:

3689464999?profile=originalThe data will be read out from a ArduPilot (should they ever be available again here in Europe... still waiting for mine) connected over the same WLAN. The serial connection will be emulated over the LAN using a WIZNet RS232 gateway. I already tried out the thing, works without a flaw! When the ArduPilot arrives I will also be able to use my antenna tracking code. Currently, without tracking, I get about 2km of range over something in the range of 100° in front of the receiver antenna, outside of that angle the framerate drops.

When the IP cam finally arrived there was a huge drawback: OpenCV cannot access it! The built-in Live555 server just quits with an error (something like "461 Unsupported Transport" if I recall it correctly). I tried many solutions, but the only solution that fully supported my IP cam (which is only streaming h.264 over RTSP) was embedding VLC using libVLC. This works really good and as a convenient side-effect my analog grabber is now supported without modification, too, as are all possible devices that VLC can access out of the box. This solution however has two serious problems: First, the video image is rendered onto my widget (I am programming in C++ with Qt) using direct render which means my pretty overlays shown above did not work so well. This one I managed to bypass (please ignore all the stuff lying around... plus big black thing for privacy reasons):

3689465083?profile=originalThe second problem is the following: VLC enforces a minimum network buffer latency of approximately 215ms. I can fly that thing, but it really is not pretty. So heres the question to the programmers: Is there a better way to grab h.264 encoded frames over RTSP? If your first thought is "Just drop VLC and use ffmpeg and live555 without the VLC overhead" I kindly invite you to implement exactly that after I sent you the source code.

Conclusion:

The video quality is awesome, flying around with the X8 really is fun. No interference with my 2.4GHz radio setup. The image lag is a problem, I would currently not try to land using the video strea, but once that is solved, this is the future!

Finally, two more pics of the hardware setup:

Camera with protection cover, WLAN access point.

3689465210?profile=originalRetractable landing gear!

3689465118?profile=originalIf anyone of you knows more about or has a solution to the streaming lag problem, every answer is greatly apprectiated!

Nicolas

Read more…