Commit Graph

103 Commits

Author SHA1 Message Date
Andrew Tridgell 8ea433ac21 AP_Terrain: added script for creating terrain *.dat files
useful for pre-populating a microSD card
2020-05-05 11:21:33 +10:00
Andrew Tridgell 7b7bf3ef86 AP_Terrain: fixed bug in disk offset calculation
this fixes a problem where two different locations could both be
mapped to the same disk block in the terrain/*.DAT files. That meant
that pre-filled terrain on the microSD card would sometimes require a
download in flight. It also means that a RTL with loss of GCS could
sometimes fly through a region with no terrain data available

Other changes in this patch:

 - allow for a 2cm discrepancy in the lat/lon of the grid
   corners. This is needed to allow for slightly different floating
   point rounding in tools that pre-generate terrain data to load on
   the microSD

 - added TERRAIN_OPTIONS parameter to allow the user to disable
   attempts to download new terrain data. This is mostly useful for
   testing to validate a terrain generator
2020-05-05 11:21:33 +10:00
Jaaaky e8df08a4d3 AP_Terrain: Avoid update() IO operations when not enabled 2020-01-26 10:35:29 +11:00
Randy Mackay d18432adaa AP_Terrain: leave ENABLE as 1 if memory alloc fails 2019-11-19 10:16:25 +11:00
Randy Mackay 649058adb8 AP_Terrain: add init_failed
allows external caller to determine if terrain database failed to initialise
2019-11-19 10:16:25 +11:00
Randy Mackay 1d5e9ef48b AP_Terrain: constify get_statistics and bitount64 2019-11-19 10:16:25 +11:00
Randy Mackay 0af830bbb7 AP_Terrain: minor comment fix 2019-11-12 09:10:21 +08:00
Michael du Breuil dc0e4bea53 AP_Terrain: Don't include all of AP_FS 2019-11-02 22:52:06 +11:00
Michael du Breuil 04863f858d AP_Terrain: Directly include needed headers 2019-08-28 13:13:03 +10:00
Andrew Tridgell a4860afd32 AP_Terrain: convert to use AP_Filesystem 2019-08-27 15:40:43 +10:00
Pierre Kancir 82de3efc09 AP_Terrain: pass mavlink_message_t by const reference 2019-07-16 20:51:42 +10:00
Peter Barker 9f33fb6085 AP_Terrain: add missing AP_AHRS include 2019-07-09 22:32:57 +10:00
Michael du Breuil 99ff84168c AP_Terrain: Remove unneeded includes 2019-06-27 14:56:21 +10:00
Michael du Breuil cbcd959290 AP_Terrain: Fix AP_GPS.h include 2019-06-18 10:02:05 +10:00
Michael du Breuil fc9b102b28 AP_Terrain: Add singleton 2019-04-26 08:07:19 +10:00
Pierre Kancir 6fbcb21ae3 AP_Terrain: use get_distance_NE instead of location_diff 2019-04-08 08:00:52 -07:00
Pierre Kancir 58cd9361cb AP_Terrain: move location_update to Location and rename to offset_bearing 2019-04-06 09:10:28 +11:00
Tom Pittenger 966b2652fb AP_Terrain: rename dataflash to logger 2019-03-28 16:40:57 +11:00
Dr.-Ing. Amilcar do Carmo Lucas 6082b230e8 AP_Terrain: replace location_offset() and get_distance() function calls with Location object member function calls
This allows removing duplicated code
2019-02-28 11:44:09 +11:00
Peter Barker 1b4a2c4d6b AP_Terrain: GCS_MAVLink takes care of mavlink capabilities 2019-02-19 13:14:52 +11:00
Peter Barker 6fc76a32af GLOBAL: use AP::logger() and strip redundant Log_ from methods 2019-01-18 18:08:20 +11:00
Peter Barker b47733142f GLOBAL: rename DataFlash_Class to AP_Logger 2019-01-18 18:08:20 +11:00
Peter Barker 2292113a5b AP_Terrain: log_terrain_data no longer takes a DataFlash argument 2019-01-18 11:17:40 +11:00
Peter Barker 90b708f9e7 AP_Terrain: adjust for location flags being moved out of union 2019-01-16 11:45:29 +11:00
Peter Barker 2207f52c8e AP_Terrain: use Rally singleton 2019-01-09 10:14:16 +11:00
Peter Barker 1a853f6f82 AP_Terrain: use ahrs singleton 2018-11-08 20:59:45 +11:00
Michael du Breuil 4299eb9ba8 AP_Terrain: Reduce memory consumption, simplify enable checking 2018-06-29 09:00:01 +10:00
Tom Pittenger f03c73aeff AP_Terrain: compiler warning printing %u with signed value 2018-04-06 07:40:37 +09:00
Peter Barker adde7bc588 AP_Terrain: fix snprintf buffer length warning
Also includes fix from Tridge to use MIN() instead of MAX()
2018-02-02 09:59:06 +09:00
Andrew Tridgell f8542c86b6 AP_Terrain: added support for AP_Terrain for ChibiOS 2018-01-15 11:46:02 +11:00
Peter Barker ca4f25a78e AP_Terrain: use GPS singleton 2017-12-27 00:58:02 +00:00
Andrew Tridgell d175fb2f18 AP_Terrain: removed create() method for objects
See discussion here:

  https://github.com/ArduPilot/ardupilot/issues/7331

we were getting some uninitialised variables. While it only showed up in
AP_SbusOut, it means we can't be sure it won't happen on other objects,
so safest to remove the approach

Thanks to assistance from Lucas, Peter and Francisco
2017-12-14 08:12:28 +11:00
Lucas De Marchi 122f3d110b AP_Terrain: add static create method 2017-09-26 03:01:21 +01:00
Peter Barker 698f18566b AP_Terrain: cast to int32_t to avoid warning about signedness
../../libraries/AP_Terrain/TerrainIO.cpp: In member function ‘void
AP_Terrain::open_file()’:
../../libraries/AP_Terrain/TerrainIO.cpp:176:46: warning: format ‘%u’
expects argument of type ‘unsigned int’, but argument 5 has type
‘__gnu_cxx::__enable_if<true, double>::__type {aka double}’ [-Wformat=]
              abs((uint32_t)block.lon_degrees));
                                              ^
../../libraries/AP_Terrain/TerrainIO.cpp:176:46: warning: format ‘%u’
expects argument of type ‘unsigned int’, but argument 7 has type
‘__gnu_cxx::__enable_if<true, double>::__type {aka double}’ [-Wformat=]
2017-09-01 13:30:56 +01:00
Peter Barker 85756b7226 AP_Terrain: eliminate GCS_MAVLINK::send_statustext_all 2017-07-11 23:53:53 +01:00
Andrew Tridgell c9e140a946 AP_Terrain: removed unused variable 2017-06-07 19:59:14 +10:00
Michael du Breuil 3e2b5269a6 AP_Terrain: fix Coverity issue 91367
Also converts to using the get_relative_position_D_home() functions rather then attempting to derive home itself
2017-06-07 19:58:45 +10:00
Dr.-Ing. Amilcar Do Carmo Lucas 26771f5348 AP_Terrain: Use SI units conventions in parameter units
Follow the rules from:
http://physics.nist.gov/cuu/Units/units.html
http://physics.nist.gov/cuu/Units/outside.html
and
http://physics.nist.gov/cuu/Units/checklist.html
one further constrain is that only printable (7bit) ASCII characters are allowed
2017-05-17 18:07:25 +10:00
Andrew Tridgell bbccdce229 AP_Terrain: prevent use of invalid Location
loc is not initialised and can cause a fault on startup
2016-12-22 15:50:30 +11:00
Lucas De Marchi 4936fd8623 AP_Terrain: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
Peter Barker 58a03b83ca AP_Terrain: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Matthew Brener 06388b0417 Global: Fix typos 2016-09-17 00:36:36 -03:00
Tom Pittenger 28648665b9 AP_Terrain: set param "Enable" to be FLAG_ENABLE 2016-08-04 11:31:37 -07:00
Andrew Tridgell 40d1a23a13 AP_Terrain: use HAVE_PAYLOAD_SPACE() 2016-05-21 15:25:15 +10:00
Randy Mackay 83922f9b65 AP_Terrain: update comments for height_terrain_difference_home 2016-04-30 10:33:01 +09:00
Randy Mackay d84321be2e AP_Terrain: height_amsl can correct for non-zero terrain alt at home position 2016-04-30 10:33:01 +09:00
Randy Mackay 7474e827ce AP_Terrain: get_statistics made public 2016-04-30 10:33:01 +09:00
Lucas De Marchi 8fcf551505 AP_Terrain: replace header guard with pragma once 2016-03-16 18:40:44 +11:00