Commit Graph

563 Commits

Author SHA1 Message Date
Peter Barker 51f8bba3a1 AP_Common: add STR_VALUE macro 2022-02-10 12:13:43 +11:00
Andy Piper bdbcda6b0f AP_Common: allow ExpandingString to be reset 2022-02-09 12:47:55 +00:00
Peter Barker 8814486572 AP_Common: include integer version of hash in FWVersion struct 2022-02-09 18:32:38 +11:00
Peter Barker 8cdda7dec2 AP_Common: stop passing mission in Terrain constructor
Terrain can use the mission singleton

This means Copter can have terrain while compiling mission out
2022-02-08 11:20:20 +11:00
Andrew Tridgell 8b7ea70029 AP_Common: support AP_CUSTOM_FIRMWARE_STRING
this allows vendors to setup a custom firmware string in hwdef.dat,
which makes maintaining a vehicle specific firmware easier
2022-01-19 08:07:45 +11:00
Peter Barker 522b12135f AP_Common: correct UINT32_VALUE 2021-12-10 08:07:43 -08:00
Randy Mackay f6e6ca197f Location: get_vector_from_origin gets units comment 2021-12-01 09:03:40 +09:00
bugobliterator 60e0bec628 AP_Common: add support for setting custom external buffer 2021-11-10 17:21:35 +11:00
murata 1e91dfe9d6 AP_Common: Make the char_to_hex method a common method 2021-11-09 10:16:25 +11:00
Andy Piper 32482a29db AP_Common: define build directory for tests 2021-10-26 11:42:12 +11:00
Andy Piper ad55a570ee AP_Common: define build directory for tests 2021-10-26 11:42:12 +11:00
Sandy Urazayev 644726ff50 AP_Common: Added missing fenv exception functions from FreeBSD fenv tree
Signed-off-by: Sandy Urazayev <ctu@ku.edu>
2021-10-16 20:09:11 +11:00
Pierre Kancir cceaa1e2fc AP_Common: use correct #pragma GCC diagnostic pop 2021-09-29 17:27:29 +10:00
Iampete1 407b70b82e AP_Common: location: add get alt distance method 2021-09-28 09:31:13 +10:00
Josh Henderson 6c3612b51d AP_Common: enable SITL unit testing
apcommon
2021-09-28 09:11:48 +10:00
Peter Barker d73ce0ed57 AP_Common: tests: stop overriding non-virtual method
set_origin is no longer virtual.  These tests can be reinstated once we
have a single origin for the AHRS
2021-08-05 10:37:47 +10:00
Andrew Tridgell 68a33e996d AP_Common: fixed invalid nmea test 2021-08-05 09:43:35 +10:00
Andrew Tridgell a49f5b92e2 AP_Common: fixed printf format errors 2021-08-05 09:43:35 +10:00
Randy Mackay 70c6694798 AP_Common: add Location::linear_interpolate_alt 2021-07-22 08:51:41 +09:00
Peter Barker 2bd8a45c58 AP_Common: rename for AHRS restructuring 2021-07-21 21:01:39 +10:00
Andrew Tridgell 416c0724d2 AP_Common: use double precision for more location functions when available
this makes the location functions more accurate at long distances when
EKF double enabled
2021-07-14 17:34:40 +10:00
Andrew Tridgell 3ded1e6c10 AP_Common: added ftype precision offset call 2021-07-14 17:34:40 +10:00
Peter Barker fc2338612e AP_Common: stop setting terrain pointer in test_location
Also enable/disable as required for testing
2021-07-12 17:34:44 +10:00
Peter Barker b625596dfa AP_Common: use singleton to access AP_Terrain data 2021-07-12 17:34:44 +10:00
Andrew Tridgell 56d9134e38 AP_Common: adjust test_location values
for adjusted longitude scale accuracy
2021-07-10 07:20:41 +10:00
Andrew Tridgell a924f66f70 AP_Common: fixed comment 2021-07-10 07:20:41 +10:00
Andrew Tridgell 6a3b12956a AP_Common: make longitude_scale() a static
this changes the use of longitude_scale() to use the average latitude
instead of the lattitude at one end of the line when calculating
positions and distances. It means we obey the basic geometry rule
that:

 pos1 + offs = pos2
 pos2 - offs == pos1
2021-07-10 07:20:41 +10:00
Andrew Tridgell b8e42be5d1 AP_Common: added double methods for SITL 2021-07-10 07:20:41 +10:00
Andrew Tridgell a7f31929ea AP_Common: use longitude scaling from definitions.h 2021-06-29 17:26:34 +09:00
Peter Barker f69e2a49f6 AP_Common: add test for longitude wrapping 2021-06-25 15:33:55 +10:00
Andrew Tridgell 77d83b9c77 AP_Common: fixed Location class for wrap at 180 degrees longitude
this allows us to fly missions across the date line
2021-06-25 15:33:55 +10:00
Andrew Tridgell 61faeb2d7f AP_Common: added double methods for SITL 2021-06-24 21:34:30 +10:00
Pierre Kancir 983e402804 AP_Common: add more unitttests 2021-06-21 21:16:29 +10:00
Pierre Kancir 614ebff842 AP_Common: add more unit tests 2021-06-18 16:03:51 +10:00
Josh Henderson 206a414553 AP_Common: Location vec3 constructor zero out fields 2021-06-12 10:52:36 +09:00
Pierre Kancir ba94d8839f AP_Common: Make location PANIC message more explicit 2021-06-10 11:37:10 +10:00
Andy Piper 88bbec01b0 AP_Common: add firmware string without git hash. 2021-06-09 17:35:11 +10:00
Peter Barker 4abf854c45 AP_Common: remove weird cast of location object 2021-06-08 12:14:17 +10:00
Andrew Tridgell 6c0c6a1f48 AP_Common: added CLASS_NO_COPY() macro
used to make it easy to forbid copy of classes
2021-06-08 11:14:52 +10:00
Andrew Tridgell 71f207403e AP_Common: make angles in degrees end in _deg
to make it obvious it is not radians
2021-06-05 13:05:30 +10:00
Andrew Tridgell 5a7ee5a376 AP_Common: fixed null termination bug in ExpandingString
not all HALs zero memory on realloc
2021-04-21 07:12:55 +10:00
Andrew Tridgell 3fb280ff50 AP_Common: added return to ExpandingString append 2021-04-21 07:12:55 +10:00
Andrew Tridgell 6c29f8c24f AP_Common: added common nmea_printf code 2021-04-13 09:36:52 +10:00
Josh Henderson dce01fbb43 AP_Common: make Location(Vector3f) require ALTFRAME 2021-03-30 08:56:35 +09:00
Andrew Tridgell 504f500fae AP_Common: added get_writeable_string to ExpandingString 2021-01-21 13:09:21 +11:00
Andrew Tridgell 6c1891fcb3 AP_Common: added ExpandingString class
useful for @SYS output construction
2021-01-05 10:52:00 +11:00
Patrick José Pereira adda695630 AP_Common: Update AP_FWVersion struct to be used with binary parsers
- Add an uint64_t header to allow easy detection of struct
- Add an uint16_t version
    - MSB is for major release, compatibility break
    - LSB for minor version, no compatibility break
- Add pointer size variable to allow decode of pointers
- Add vehicle type information
- Add board type and subtype to allow hardware identification
- Set type of fw_type to uint8_t since enum is declared as int
- Organize struct to be packed inside 32bits system

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-10-07 19:32:12 +11:00
Randy Mackay d9de6e8de9 AP_Common: UINT16_VALUE, UINT32_VALUE get parentheses around arguments 2020-10-06 20:52:29 +11:00
Randy Mackay f3b193d6f8 AP_Common: add UINT32_VALUE 2020-10-06 20:52:29 +11:00
Patrick José Pereira 1ee03a0d2e AP_Common: Add missing const in AP_FWVersion variables
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-09-25 08:55:18 +10:00
Patrick José Pereira e81f9fccd9 AP_Common: Add new AP_FWVersionDefine header
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Co-authored-by: Peter Barker <pb-gh@barker.dropbear.id.au>
2020-09-23 20:58:35 +10:00
yaapu 6a0531c08a AP_Common: added missing bit set/clear functions 2020-09-02 05:56:46 +10:00
Patrick José Pereira 6e24880f87 AP_Common: missing: Add definition for strndupa
`strndupa` is only available when using the GNU GCC suite.
With this definition is possible to use the MUSL compiler.

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-08-25 07:15:00 -07:00
Rishabh 55923d8b7b AP_Common: Add new method to extrapolate location from bearing and pitch 2020-08-24 08:53:20 +09:00
Andrew Tridgell 18deb1c0bd AP_Common: added strncpy_noterm
used to suppress string termination warnings
2020-07-10 13:32:24 +10:00
Andrew Tridgell 7138811a57 AP_Common: fixed cast warnings for ExpandingArray 2020-07-07 10:23:00 +10:00
Michael du Breuil ab2dea5b86 AP_Common: Add % operator to TSIndex 2020-06-16 10:09:14 +10:00
Peter Barker 8e82ea2540 AP_Common: create and use INTERNAL_ERROR macro so we get line numbers 2020-04-30 13:21:36 +10:00
bugobliterator 88de9572aa AP_Common: use standard realloc method from HAL 2020-03-24 10:32:14 +11:00
Siddharth Purohit faacd03e3a AP_Common: add method that can help to put contraint on accessor type 2020-02-19 13:59:53 +09:00
Andrew Tridgell b8f9f171e0 AP_Common: added IGNORE_RETURN() macro 2020-01-16 20:36:54 +11:00
Peter Barker 6c0b4206c5 AP_Common: remove is-zero checks for Location::offset
Only one call in 160 actually passes these in as zeroes, so doing the
checks vastly outweighs the benefits of not doing the maths

We do call this a lot when doing terrain checks.
2019-11-19 10:49:19 +11:00
Michael du Breuil a99f67fd5b AP_Common: Add a radian method for getting location bearings 2019-10-25 08:48:22 +08:00
Andrew Tridgell c29867ecad AP_Common: removed fcntl overrides
not needed with AP_Filesystem, and fixes lots of warnings with newer
compilers
2019-09-28 14:19:46 +10:00
Michael du Breuil 819d1b5246 AP_Common: Include altitude in the init check for a location 2019-09-17 09:30:56 +10:00
Randy Mackay 246bfcf4a1 AP_Common: expanding array checks memory before allocating 2019-09-11 06:56:35 +10:00
murata a39228c453 AP_Common: Make hexadecimal character number conversion method common 2019-08-06 10:14:12 +10:00
Pierre Kancir 17c0cf8d5c AP_Common: check for feenableexcept on WAF 2019-08-06 09:37:30 +10:00
Randy Mackay df6c666740 AP_Common: add AP_ExpandingGeneric to reduce code size 2019-06-20 15:09:23 +09:00
Randy Mackay 4ef3005d2c AP_Common: add AP_ExpandingArray delete 2019-06-20 15:09:23 +09:00
Randy Mackay 2cb89d9a02 AP_Common: expanding array uses realloc
also make chunk_size const and recommend factor of 2
also reduce top level array's initial size to 32 elements
2019-06-20 15:09:23 +09:00
Randy Mackay 073ce8c3db AP_ExpandingArray: add class description and remove default constructor
also made the following changes:
replaced delete with free
renamed chunk_ptr typedef to chunk_ptr_t
2019-06-20 15:09:23 +09:00
Randy Mackay 528e7c60b0 AP_Common: add AP_ExpandingArray class 2019-06-20 15:09:23 +09:00
Peter Barker b48c729bb1 AP_Common: add os_sw_version to AP_FWVersion 2019-06-18 10:54:01 +10:00
Michael du Breuil 6e0cceff0d AP_Common: Remove extra comparison from longitude_scale() 2019-06-18 10:09:09 +10:00
Peter Barker 4e5842a150 AP_Common: add initialised() method to Location
Sometimes code paths are crossed when they shouldn't be.  This method
can help in the short term if a codepath is calling methods on a
Location when it is not initialised, but generally a vehicle should be
calling position_ok() and other methods rather than this one.
2019-06-18 09:07:56 +09:00
Peter Barker ab7ee4fefb AP_Common: Location.cpp: add sanity checks 2019-05-29 09:04:37 +09:00
Peter Barker 9d4bdbf3d5 AP_Common: add sanity check into bitmask get/set
Also return false if we are asked about an out-of-bounds bit
2019-05-28 09:43:17 +10:00
Andrew Tridgell 75397c1734 AP_Common: removed old Semaphore.h
now moved to AP_HAL/Semaphores.h
2019-05-15 15:33:48 +10:00
Peter Barker 71d16557fa AP_Common: Location: add WARN_IF_UNUSED to boolean methods 2019-05-09 13:03:49 +10:00
Pierre Kancir ff4587a33a AP_Math: move location define to Location class 2019-04-23 09:20:43 +10:00
Pierre Kancir 4f31c3dcd5 AP_Math: move line_path_proportion to Location 2019-04-23 09:20:43 +10:00
Pierre Kancir e06d7dbbf7 AP_Math: move location_passed_point to Location and rename 2019-04-23 09:20:43 +10:00
Peter Barker e51a0a7a52 AP_Common: make Bitmask a template on number of bits 2019-04-16 15:12:07 +10:00
Peter Barker 2352dd3f12 AP_Common: clean includes up in Location.h 2019-04-16 10:00:29 +10:00
Pierre Kancir 121e5d0abf AP_Math: move location_3d_diff_NED to Location and rename 2019-04-09 20:59:48 +10:00
Pierre Kancir 29b2d7996b AP_Common: move check_latlng to Location 2019-04-08 12:56:01 -07:00
Pierre Kancir b10e75f4e1 AP_Math: move locations_are_same to Location and rename to same_latlon_as 2019-04-08 08:05:05 -07:00
Pierre Kancir 00fa07ef33 AP_Math: move location_diff to Location and rename 2019-04-08 08:00:52 -07:00
Pierre Kancir a30404fb11 AP_Common: move location_update to Location and rename to offset_bearing 2019-04-06 09:10:28 +11:00
Pierre Kancir 6faf1d2849 AP_Common: move get_bearing_cd to Location and rename to get_bearing_to 2019-04-06 09:10:28 +11:00
Peter Barker a6755b6406 AP_Common: correct type conversion issues in _assert_storage_size 2019-04-05 05:48:41 -07:00
Peter Barker fd294101ec AP_Common: Location: move sanitize to be a method on location 2019-04-02 10:19:38 +11:00
murata 7340502f18 AP_Common: Set the value of UINT16 with HIGH byte and LOW byte 2019-03-28 12:02:55 +11:00
Peter Barker 649130adcb AP_Common: uniqify semaphore names 2019-03-23 11:23:07 +11:00
Peter Barker 22c0175d7f AP_Location: use enum class for AltFrame enumeration 2019-03-19 10:31:18 +11:00
Peter Barker a1c751919c AP_Common: move longitude_scale into Location class 2019-03-12 10:11:12 +11:00
Tom Pittenger 785c91e269 AP_Common: Semaphore is missing an include
Everyone who is already including common/Semaphore has extra includes to make this compile. This reduces that dependancy
2019-03-08 17:24:48 -08:00
Peter Barker 7f63720257 AP_Common: Location.cpp: force handling of all alt frames
By removing the default case we will generate a compiler error a new alt
frame is not handled
2019-03-05 10:39:29 +11:00
Peter Barker c3004bff20 AP_Common: remove keywords.txt 2019-02-17 00:29:38 -08:00