Commit Graph

60 Commits

Author SHA1 Message Date
Andrew Tridgell a412795045 AP_Terrain: make TERRAIN_MARGIN a float
it turns out very large margins are needed for some locations
2021-08-31 09:25:36 +10:00
Andrew Tridgell 4e98636a53 AP_Terrain: added a TERRAIN_MARGIN parameter
this sets the acceptance margin for GCS generated terrain data. You
can raise this to allow old data generated with the less accurate
longitude scaling to be used
2021-08-22 20:32:46 +10:00
Peter Barker ddb7378bdd AP_Terrain: add setter for terrain-enabled
Currently only useful for unit test
2021-07-12 17:34:44 +10:00
Peter Barker de404b1999 AP_Terrain: allow AP_TERRAIN_AVAILABLE to be set in hwdef
Use AP_TERRAIN_AVAILABLE instead
2021-07-12 17:34:44 +10:00
Andrew Tridgell 5e820b203b Ap_Terrain: make AP::terrain return a pointer
this is needed for rover and OSD support
2021-04-07 20:56:01 +10:00
Andrew Tridgell 227609eef0 AP_Terrain: allow download of terrain data when no GPS lock
this fixes several issues:

 - allows users to download terrain data at home with no GPS lock

 - allows for a TERRAIN_CHECK without GPS lock

 - retries opening of files every 5 seconds to allow for remount of sd
   card after boot
2020-07-28 12:15:43 +10:00
Andrew Tridgell fb5a06b8da AP_Terrain: added AP namespace access to terrain 2020-07-10 13:28:38 +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
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
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
Michael du Breuil 99ff84168c AP_Terrain: Remove unneeded includes 2019-06-27 14:56:21 +10:00
Michael du Breuil fc9b102b28 AP_Terrain: Add singleton 2019-04-26 08:07:19 +10:00
Pierre Kancir 58cd9361cb AP_Terrain: move location_update to Location and rename to offset_bearing 2019-04-06 09:10:28 +11:00
Peter Barker 1b4a2c4d6b AP_Terrain: GCS_MAVLink takes care of mavlink capabilities 2019-02-19 13:14:52 +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 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
Andrew Tridgell f8542c86b6 AP_Terrain: added support for AP_Terrain for ChibiOS 2018-01-15 11:46:02 +11: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
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
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
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
Tom Pittenger 73c5234633 AP_Terrain: cache status
instead of computing the terrain status on-demand, assign it in update() and cache the result. Then external tasks that check the status won't be doing terrain intensive calculations in their thread. All the calculations needed for the status were being performed in update already so this is an optimization.
2015-11-09 08:36:41 +11:00
Andrew Tridgell 0d26252bdb AP_Terrain: don't allocate cache array when terrain not enabled
this makes it easy to save 22k of ram when running other experiments
2015-09-23 08:31:17 +10:00
Gustavo Jose de Sousa fcd1d4938a AP_Terrain: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:38:24 +10:00
Andrew Tridgell 1296da56bb AP_Terrain: fixed terrain path handling 2015-06-30 15:08:10 +10:00
Andrew Tridgell c7044c4f91 AP_Terrain: make terrain request times per channel
otherwise we can miss sending one if we send first to a channel not
being listened to
2015-05-26 17:27:51 +10:00
Andrew Tridgell eeb04ba1b8 AP_Terrain: fetch more terrain data around waypoints
this ensures we have data for a wide region (1km) around each waypoint
2014-08-25 14:55:15 +10:00
Andrew Tridgell dc72dfb70a AP_Terrain: added terrain lookahead API
this allows for predicting altitude needed to climb over upcoming
terrain
2014-08-07 09:30:35 +10:00
Andrew Tridgell a701fa2098 AP_Terrain: added automatic rally point checking 2014-08-06 17:59:19 +10:00
Andrew Tridgell 7da939047f AP_Terrain: added automatic waypoint checking
check we have terrain data for all waypoints
2014-08-06 17:59:19 +10:00
Andrew Tridgell 9ca65602c6 AP_Terrain: added dataflash logging 2014-08-06 17:59:19 +10:00
Andrew Tridgell 147a7b8b69 AP_Terrain: added extrapolation based on last available data
if we run out of terrain data then extrapolate using the last
available terrain height at the AHRS position. This can be used to
cope with GCS outages over long distances where the terrain data isn't
preloaded
2014-08-06 17:59:18 +10:00
Andrew Tridgell c4047f6f11 AP_Terrain: rename find_grid() to find_grid_cache()
thanks Randy!
2014-07-25 09:52:20 +10:00
Andrew Tridgell 679b32b76c AP_Terrain: make parameter variables private 2014-07-25 09:45:28 +10:00
Andrew Tridgell 3faafc9644 AP_Terrain: replace HAVE_AP_TERRAIN with AP_TERRAIN_AVAILABLE 2014-07-25 07:59:48 +10:00
Andrew Tridgell c32595e6ed AP_Terrain: added status() interface for reporting 2014-07-24 21:50:19 +10:00
Andrew Tridgell e2e41d5da7 AP_Terrain: added location_to_relative_home() function 2014-07-24 21:50:19 +10:00
Andrew Tridgell 18974363d5 AP_Terrain: added some helper functions
this adds easier to use helper functions for terrain handling
2014-07-24 21:50:19 +10:00
Andrew Tridgell 8ea2133c4b AP_Terrain: provide more height_*() convenience functions
these provide functions that are more convenient for the vehicle code
to use
2014-07-24 21:50:19 +10:00
Andrew Tridgell db506b76fa AP_Terrain: split up code into separate cpp files
this should make it a bit easier to review
2014-07-24 21:50:19 +10:00
Andrew Tridgell 2d9637c156 AP_Terrain: re-arrange disk IO code
add some comments explaining split between IO thread and main code
2014-07-24 21:46:07 +10:00