Commit Graph

137 Commits

Author SHA1 Message Date
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
Luis Vale Gonçalves f02e13b107 AP_Terrain: libraries_Text_revision
text revision of messages
2015-11-26 08:10:15 +11:00
Caio Marcelo de Oliveira Filho 0aa520a273 AP_Terrain: use millis/micros/panic functions 2015-11-20 12:34:53 +09: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
Lucas De Marchi 831d8acca5 Remove use of PROGMEM
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:

    git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
    git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'

The 2 commands were done so we don't leave behind spurious spaces.

AVR-specific places were not changed.
2015-10-30 14:35:16 +09:00
Lucas De Marchi 2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +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
Randy Mackay 7d2c0079ff Terrain: set HAL capabilities bit 2015-07-31 14:50:26 +09:00
Andrew Tridgell 1296da56bb AP_Terrain: fixed terrain path handling 2015-06-30 15:08:10 +10:00
Víctor Mayoral Vilches f592981a60 TerrainIO: Support custom_terrain_directory 2015-06-30 14:36:43 +10:00
Tim Ryan d7fe6bfe0d Terrain: cast grid_spacing to fix OSX clang error 2015-06-04 21:01:34 +09:00
Peter Barker 9e0b5910e2 AP_Terrain: use 64-bit timestamps for dataflash logs 2015-05-27 11:54:16 +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
Lucas De Marchi 6ae2591cad AP_Terrain: use functor macros
Functor is not yet being used but let's make is macro fallback to the
previous Delegate implementation for easy of transition between the two.
2015-05-26 13:46:54 +10:00
Andrew Tridgell e6c6fe095f AP_Terrain: fixed a warning 2014-10-22 18:27:20 +11: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 af4dee39d8 AP_Terrain: added note on CPU cost of height_amsl() 2014-08-07 09:51:14 +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 f0f46a77d7 AP_Terrain: don't request data at 0/0 2014-08-06 22:13:37 +10:00
Andrew Tridgell 642a07b6bd AP_Terrain: enable the terrain database by default
MissionPlanner now supports terrain data, and having terrain data in
logs is useful even if users don't fly terrain missions
2014-08-06 20:53:34 +10:00
Andrew Tridgell efa1d370fa AP_Terrain: added missing TerrainMission.cpp 2014-08-06 19:32:53 +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 37b357f282 AP_Terrain: prevent valgrind error when terrain not available 2014-07-25 13:44:36 +10:00
Andrew Tridgell bb31a45596 AP_Terrain: expand parameter docs 2014-07-25 13:18:48 +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 1fcf35333f AP_Terrain: fixed init order and init more vars
thanks to Randy for spotting this
2014-07-25 09:45:47 +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 ce60bf8d3f AP_Terrain: removed incorrect ASSERT 2014-07-25 07:56:33 +10:00
Andrew Tridgell 7bc6561f2a AP_Terrain: fixed comment on function 2014-07-25 07:56:22 +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 5e2077185b AP_Terrain: fixed cm conversion error 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
Andrew Tridgell ee04c7de96 AP_Terrain: hold home location as a special location
this ensures home altitude is always available
2014-07-24 21:46:06 +10:00
Andrew Tridgell 0a3aa23619 AP_Terrain: fixed build on APM2 2014-07-24 21:46:06 +10:00
Andrew Tridgell 2f0279659a AP_Terrain: prevent disk blocks getting stuck
we need to match first on the expected state to ensure we don't get an
invalid block
2014-07-24 21:46:06 +10:00
Andrew Tridgell 28d6e39c4c AP_Terrain: added checking of block CRCs on disk
this allows us to cope with SD card data corruption
2014-07-24 21:46:06 +10:00
Andrew Tridgell eeb4ad56bc AP_Terrain: added checking and reporting messages
this allows the GCS to check the status of the terrain system
2014-07-24 21:45:56 +10:00
Andrew Tridgell 9f76f0276f AP_Terrain: added disk IO for terrain data 2014-07-24 21:45:56 +10:00
Andrew Tridgell 09214680fe AP_Terrain: request grids around current grid
this ensures we have grids ahead of time
2014-07-24 21:45:56 +10:00
Andrew Tridgell 18e09c2f3e AP_Terrain: added debug code 2014-07-24 21:45:56 +10:00
Andrew Tridgell 09518d2d91 AP_Terrain: added mavlink transport of terrain data 2014-07-24 21:45:46 +10:00
Andrew Tridgell 1d42eda4da AP_Terrain: started on update() logic 2014-07-24 21:45:46 +10:00
Andrew Tridgell a7eb2ac28c AP_Terrain: implement height_amsl() 2014-07-24 21:45:46 +10:00
Andrew Tridgell ee7fc984f0 AP_Terrain: initial structure 2014-07-24 21:44:50 +10:00