Commit Graph

31 Commits

Author SHA1 Message Date
Peter Barker 84215ff662 AP_Terrain: only include GCS_MAVLink if terrain is enabled 2023-01-03 10:47:28 +11:00
Peter Barker 541cfa022b AP_Terrain: fix bad prearms-pass-when-they-shouldn't issue
The squares surrounding the current location were only checked when we went to send a terrain request.  This means it was possible that:
 - the number of pending requests could go to zero
 - prearm checks would pass
 - vehicle arm is attempted by the user (or a script, or ....)
 - the code would call AP_Terrain::send_requests which would create more pending requests
 - the arming sequence would fail

It's also possible for the arming to succeed, and then we're flying in violation of the intended prearm checks.

Doing things in the update function has the additional advantage of making things more efficient as we can push out terrain requests more often.
2022-08-09 14:31:14 +10:00
Andrew Tridgell 5d3a0a78cb AP_Terrain: removed terrain home correction 2022-03-10 07:34:20 +11:00
Peter Barker bb42ab3eb3 AP_Terrain: do not use location object if it is zero
This can happen at boot-time if the vehicle has no idea where it is
2022-02-08 10:57:03 +11:00
Peter Barker 5fe91f16af AP_Terrain: avoid direct use of Location alt field 2022-02-08 10:57:03 +11:00
Peter Barker e8e4aef998 AP_Terrain: rename AP_AHRS::get_position to get_location 2022-01-25 10:47:22 +11: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 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 1d5e9ef48b AP_Terrain: constify get_statistics and bitount64 2019-11-19 10:16:25 +11: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
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 90b708f9e7 AP_Terrain: adjust for location flags being moved out of union 2019-01-16 11:45:29 +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
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
Andrew Tridgell 40d1a23a13 AP_Terrain: use HAVE_PAYLOAD_SPACE() 2016-05-21 15:25:15 +10: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
Caio Marcelo de Oliveira Filho 0aa520a273 AP_Terrain: use millis/micros/panic functions 2015-11-20 12:34:53 +09: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 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 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 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 37b357f282 AP_Terrain: prevent valgrind error when terrain not available 2014-07-25 13:44:36 +10:00
Andrew Tridgell ab9785d3ad AP_Terrain: added current_height to TERRAIN_REPORT
and send TERRAIN_REPORT even when downloading TERRAIN_DATA
2014-07-25 11:40:56 +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 3faafc9644 AP_Terrain: replace HAVE_AP_TERRAIN with AP_TERRAIN_AVAILABLE 2014-07-25 07:59:48 +10:00
Andrew Tridgell ce60bf8d3f AP_Terrain: removed incorrect ASSERT 2014-07-25 07:56:33 +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