Maps

From PaparazziUAV
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Satellite photo map tiles

The Paparazzi GCS can automatically download satellite photo tiles from Google, MS Maps and Openstreetmap for the area defined in the flight plan. The tiles of Openstreetmap are not real photos (YET!) but rendered tiles. These tiles are fully calibrated and automatically stitched together by the GCS. To load the map tiles simply select Maps->Google Maps Fill (Ctrl-G) from the GCS pulldown menu and the tiles corresponding to the GPS coordinates defined in the flight plan will begin downloading. Pan or zoom the map and re-fill to get more tiles. Tiles are saved in var/maps/ for off-line use. Checking Maps->Google Maps Auto will automatically fill the map with tiles while paning and zooming. There is also a command line option to start the GCS with the Auto-fill feature enabled:

<path_to_paparazzi>/sw/ground_segment/cockpit/gcs -maps_fill

In v5.0 and master you can also further specify a higher maps zoom level by adding the -maps_zoom <level> option to the gcs invocation. The default <level> is 18, you can go up to 22. For example:

<path_to_paparazzi>/sw/ground_segment/cockpit/gcs -maps_zoom 20 -maps_fill -srtm 

(see Elevation Data below for the -srtm option)

If you are behind a firewall, you can use a proxy by setting the http_proxy environment variable:

export http_proxy=http://squid:3128

If you wish to create a calibrated map from the Google tiles, so that upon launching the map2d program a map of the area is shown, go ahead and put into view the area you wish to make the map. While holding left click, drag the area for the map. A red border will appear around the area. Next click on Maps->Map of Region or Maps->Map of Google Tiles. While the former will save the visible region (with waypoints, tracks, ...if any, under the current zoom), the latter will stich together the original Google tiles covering the selected region. Save the xml file to the data/maps/ directory. This program will automatically screenshot the image and take reference location points and calibrate the map using them. You will be able to load this map in your next sessions (with the Maps->Load menu or with the -m option you can add in the your section of control_panel.xml.

Example of map created from google tiles, gifhorn.xml:

<map file="gifhorn.jpg" projection="Mercator">
 <point x="0" y="0" geo="WGS84 52.527982 10.452157"/>
 <point x="1965" y="1284" geo="WGS84 52.519595 10.473248"/>
</map>

The GCS currently supports three projections (UTM, Mercator and LambertIIe). If you try to place a calibrated map for one projection (e.g. UTM) on another projection plot (e.g. Mercator) the image will be rotated and skewed and a warning will be shown during loading.

Google Restrictions

Corrupted Maptiles

Sometimes wrong Google maptiles are downloaded due to the beginning of the bandwidth restriction enforced by Google. If this happen and you do not wan to re-download all of you tiles, close the GCS type the following in a command prompt:

$  cd ~/paparazzi/var/maps/

or maybe some other directory where you installed the Paparazzi software, then type

$ rm ??????????????.jpg

That are indeed 14 questionmarks, better cut and paste the line. This leaves the good resolution images and deletes the bad ones. It would be even better if you could fix the GCS sourcecode and the remove the text of this workaround here from the Wiki.

No more Maptiles

After downloading a lot of maptiles from google you might experience problems getting more due to restrictions enforced by Google. For flight plans covering a large area OSM can be better, as OSM has no such restrictions.

Manually Defined Maps

Maps are used in the groundstation to give geographical reference to the flight area. These calibrated maps are described with two files: the image itself (.png, .jpg or .gif) and an xml file containing geographic references of some points of the bitmap.

For example, muret_UTM.xml:

<map file="muret_UTM.gif" projection="UTM" scale="2.5" approx_ground_altitude="185" utm_zone="31" opacity="100">
 <point x="0" y="0" utm_x="359000" utm_y="4815000" geo="WGS84 43.474630 1.256652"/>
 <point x="0" y="800" utm_x="359000" utm_y="4813000" geo="WGS84 43.456629 1.257169"/>
 <point x="800" y="800" utm_x="361000" utm_y="4813000"/>
</map>

These maps can be created from any image (many are available from various websites). Save the file as a jpeg and place it in the data/maps/ folder. From the Flight Plan Editor select Maps->Calibrate. After loading the image (which is displayed), you will have to choose at least two reference points, name them with their geographic coordinates (in WGS84 or UTM) and save. The created map (an XML file describing the geographical position of your original bitmap) can then be loaded (Maps->Load).

Elevation Data

Intoduction

The Shuttle Radar Topography Mission (SRTM) obtained elevation data on a near-global scale to generate the most complete high-resolution digital topographic database of Earth. SRTM consisted of a specially modified radar system that flew onboard the Space Shuttle Endeavour during an 11-day mission in February of 2000.

The Paparazzi GCS can use this elevation data. The SRTM option from the Nav menu in the GCS displays the ground altitude of the mouse in the top right hand corner.

To start the GCS with the ground altitude feature enabled, the command line option is -srtm:

<path_to_paparazzi>/sw/ground_segment/cockpit/gcs -srtm

Getting and using SRTM Data

The SRTM data files can be downloaded using the make process. The only thing that is required is to know the name of the file that is needed. If you use the GCS, it will present a dialog box with the name of the required file. However it is better to download the data before you leave to test your aircraft in the field.

To illustrate the process. If you needed the file N47E016.hgt.zip (47 deg North latitude, 16 deg East longitude) then you could run the following make command:

make N47E016.hgt.zip

Alternatively you can download the SRTM data files (.hgt.zip or .hgt.bz2) to the data/srtm/ directory.

They can be downloaded from http://dds.cr.usgs.gov/srtm/version2_1/SRTM3.

Or get some new data here http://www.viewfinderpanoramas.org/dem3.html

Better and more

Some areas, for example high latitudes, are not well covered by official NASA SRTM data. Some additional data and data with higher accuracy has been compiled in the same format: http://www.viewfinderpanoramas.org/dem3.html.

Bad SRTM data issue

You can have bad luck with SRTM data set quality. Sometimes there is a strong discontinuity in the SRTM model at a launching point location you want to use, for real and in the sim. If you load the SRTM model in the GCS (from the Nav menu), the ground altitude of the location of the pointer is displayed on the top right. You can read 131m on your HOME location, and 146m immediately to the north of this point. On takeoff, the simulator gets immediately an altitude of -15m and considers it as a crash.

The simplest way to avoid this is to disable the ground detection in the simulator:

  1. stop the Simulator agent,
  2. add the "--noground" option to the pprzsim-launch command
  3. and restart.

You will read a -15m AGL during the first seconds but it won't stop. The current threshold for crash detection is -3m (sw/simulator/flightModel.ml:178 an awful numeric constant in the middle of the code, sad but true.

Automating script

If you want to get a specific range of elevation data, for example if you test your UAS in various areas on a continent, use the script below. Change the values for the ranges you need.

$ nano grabelevationdata.sh

Then copy via selecting the script below then CTRL+C and then use CTRL+SHIFT+V to paste it into the nano editor. Then use CTRL+X to save the file.

#!/bin/bash
# Use freely, OpenUAS 2010
# Script to grab ranges of elevation data, very handy if you test your UAS in various areas in a continent ;)
# Change, add or delete values in 49 50 51 and 003 004 005 006 007 008 009 to get the ranges you need.
i=1
for lat in 49 50 51
do
  j=1
  for long in 003 004 005 006 007 008 009
  do
    let "j+=1"
     wget -N --waitretry=40 "http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Eurasia/N"$lat"E"$long".hgt.zip"
  done
  let "i+=1" 
done               
exit 0

then to be able to simply run the script

$ chmod u+x grabelevationdata.sh

Finally you can run the script, use and wait a while...

$ ./grabelevationdata.sh