Peter Barker
790d9434ce
AP_Common: avoid use of Location .alt field
...
various changes to avoid use of the Location .alt field, which should be private.
Introduces several new helper functions on Location to help with this
2025-07-22 17:46:53 +10:00
Peter Barker
3708936c62
global: correct shebang lines to refernce python3
...
also remove the odd encoding line which is not required in Py3
2025-07-22 10:45:57 +10:00
Thomas Watson
f0de37fa33
AP_Common: use mem_realloc for ExpandingString
...
New memory was already zeroed so no change in behavior.
2025-07-15 09:51:25 +10:00
Thomas Watson
4c024b5a59
AP_Common: use mem_realloc for ExpandingArray
...
No change in behavior, non-zeroed area was never used.
2025-07-15 09:51:25 +10:00
Thomas Watson
98ebe2a28b
AP_Common: add fully defined mem_realloc function
...
* named differently to emphasize different behavior
* always properly zeros newly available memory including trailing bytes
* fully defines new_size == 0
* always allocating and copying matches all existing implementations
except linux, so performance and memory usage won't be affected
2025-07-15 09:51:25 +10:00
Christian Clauss
dc9446af62
wscript: Add # flake8: noqa linter directive
2025-06-20 20:30:15 +10:00
Peter Barker
1316b0b12a
AP_Common: replace ToRad with radians and ToDeg with degrees
2025-05-29 11:24:56 +10:00
Leonard Hall
3e4dafd4a2
AP_Common: Create DEGX100 to rad_to_cd
2025-05-28 20:16:26 +09:00
Peter Barker
214942b03c
AP_Common: allow AHRS to return postype for position-relative-to-origin
2025-05-24 09:23:35 +09:00
Peter Barker
45d6c75bc1
AP_Common: tests: remove un-needed vehicle object
2025-05-14 17:02:37 +10:00
Peter Barker
3a479a2bd4
AP_Common: add _cm to get_vector_from_origin_NEU
...
... and the _NE equivalent.
Moves us closer to using metres in interfaces. Several places already *0.01 the result of these methods
2025-04-29 08:29:41 +09:00
Peter Barker
71e2360387
AP_Common: Location: add copy_alt_from method
2025-04-15 21:15:42 +10:00
Peter Barker
cfd0dc1ec9
AP_Common: rename get_alt_distance to get_height_above
2025-04-12 08:36:31 +10:00
Andrew Tridgell
31d725ab22
AP_Common: catch invalid combination of terrain_alt and relative_alt
2025-04-10 06:44:55 +10:00
Andy Piper
61fa005d4b
AP_Common: test cartesian polygon distance calculator
2025-04-09 17:01:04 +01:00
Peter Barker
040973bb1b
AP_Common: Location: avoid converting to absolute alt in get_alt_distance
2025-04-08 10:49:25 +10:00
Peter Barker
ddad45aaac
AP_Common: remove un-needed GCS_MAVLINK_Parameters::var_info instantiations
...
structure which required this has been removed
2025-04-07 10:58:41 +10:00
Peter Barker
bd95d3057f
AP_Common: add guarantee that return parameter unmodified upon failure
2025-04-02 19:14:15 +11:00
Ryan Friedman
a5ed6ee6d4
AP_Common: Add cont array constructor to AP_Bitmask
...
Signed-off-by: Ryan Friedman <25047695+Ryanf55@users.noreply.github.com >
2025-01-08 08:52:21 +11:00
Andrew Tridgell
725b625967
AP_Common: removed old MultiHeap code
2024-11-20 07:32:03 +11:00
Andrew Tridgell
8ebfa28183
AP_Common: added last_failed for leveraging lua GC
...
we want the lua garbage collector to be used to re-use memory where
possible. This implements a suggestion from Thomas to avoid heap
expansion unless the last allocation failed
2024-11-20 07:32:03 +11:00
Andrew Tridgell
9f75ad1be8
AP_Common: allow expansion of heaps in MultiHeap
...
this allows for new heaps to be added at runtime for lua scripting if
you run out of memory while armed
2024-11-20 07:32:03 +11:00
Peter Barker
ed37ee821b
AP_Common: move constructor to header to allow inlining
2024-11-18 20:58:22 +11:00
Peter Barker
0077066ffb
AP_Common: Location: add set_alt_m
...
we have get_alt_m already, and there's a bunch of places that *100
2024-11-06 18:12:48 +11:00
Peter Barker and muramura
1e26441ae6
AP_Common: Integrate methods for converting hexadecimal characters to numbers
...
Co-authored-by: muramura <ma2maru@gmail.com >
2024-09-25 08:48:44 +10:00
Andrew Tridgell
4daca86ba1
AP_Common: fixed cygwin for non-SITL builds
2024-09-04 11:12:45 +10:00
Peter Barker
1c15488e35
AP_Common: add comment on top of float16 storage
...
there are multiple standards for storing these values
2024-08-27 10:19:26 +10:00
Andy Piper
0c6ea4790d
AP_Common: fix initialization of ExpandingString so that it can be used on the stack
...
zero out passed in buffers for ExpandingString
2024-07-24 08:24:06 +10:00
Andrew Tridgell
3a6024e8ab
AP_Common: support QURT
2024-07-12 15:56:48 +10:00
Thomas Watson
1249388f23
AP_Common: use template parameter in bitmask functions
...
Substantially improves code optimization and reduces memory usage.
2024-07-09 11:51:41 +10:00
Thomas Watson
6a4520e8fd
AP_Common: clean up bitmask operators
...
Code already won't compile if there are different numbers of bits as the
template parameter will be different.
2024-07-09 11:51:41 +10:00
Thomas Watson
b030b8e789
AP_Common: correctly bound bitmask datatypes
...
Probably won't work correctly (and of questionable use) if less than 1.
The `first_set()` function might not be able to return a valid value if
greater than INT16_MAX.
unsigned int needs to be >= uint32_t so that the shift ops are in range.
2024-07-09 11:51:41 +10:00
Thomas Watson
0b320fe303
AP_Common: unify bitmask out of bounds checking
...
Ensures out-of-bounds reads and writes are never performed for setting,
clearing, and checking. Fixes test failure when the number of bits
evenly divides the word size.
2024-07-09 11:51:41 +10:00
Thomas Watson
9a89223531
AP_Common: fix bitmask setall()
...
Fixes an issue where the last word was not set to all 1s if the number
of bits evenly divided the word size.
Also fixes UB if there were 31 valid bits.
2024-07-09 11:51:41 +10:00
Thomas Watson
122cd72d9c
AP_Common: improve bitmask test coverage
2024-07-09 11:51:41 +10:00
Thomas Watson
4a2f03f851
AP_Common: test more bitmask bit widths
...
Actually test different widths and reveal problems with edge cases.
2024-07-09 11:51:41 +10:00
Thomas Watson
521cf00964
AP_Common: templatify bitmask tests
...
Enables testing of different widths and edge cases.
2024-07-09 11:51:41 +10:00
Randy Mackay
b6c5ad450d
AP_Common: char_to_hex returns 0 on invalid char
2024-07-09 09:08:51 +10:00
Andrew Tridgell
db19bce1d2
AP_Common: wrap _malloc_r on cygwin
...
fixes dual allocation heap bug
See https://cygwin.com/pipermail/cygwin/2000-July/038916.html
2024-07-07 07:11:59 +10:00
Peter Barker
1d945cc5ac
AP_Common: Location: allow retrieval of Vector3p from vector-from-origin
2024-06-11 19:50:18 +10:00
Peter Barker
911375fa9a
AP_Common: rearrange get_vector_from_origin_NEU to be less destructive
...
this change means that if the origin call failes we don't half-update the object before returning false
2024-06-11 09:47:14 +10:00
Andrew Tridgell
5620fee636
AP_Common: use NEW_NOTHROW for new(std::nothrow)
2024-06-04 09:20:21 +10:00
Andrew Tridgell
aa2f885e2f
AP_Common: added checks for new without std::nothrow
...
and add NEW_NOTHROW macro
2024-06-04 09:20:21 +10:00
Iampete1
1b1ce9530c
AP_Common: add get_distance_NED_alt_frame method
2024-04-30 08:03:39 +09:00
Peter Barker
44359ff6b2
AP_Common: add get_alt - 100 times better than get_alt_cm
2024-04-16 19:14:12 +10:00
Peter Barker
5488ca6403
AP_Common: add ASSERT_STORAGE_SIZE macro
...
saves havin gto name the dummy variable yourself
2024-01-22 22:44:05 +11:00
Ryan Friedman
76861eaa9b
AP_Common: Define units for locatoin data members
...
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com >
2023-12-20 02:37:01 +00:00
Mykhailo Kuznietsov
4e7d5e9ecf
AP_Common: Fix some typos
...
Fixed some typos found in the code.
2023-10-12 18:30:42 +11:00
Peter Barker
61be71eea6
AP_Common: make Location.cpp compile without AP::ahrs() available
2023-10-04 18:10:58 +11:00
Peter Barker
72f485b5a5
AP_Common: remove unused Location constructor from Vector3d
...
Replaced with AHRS method
2023-09-12 09:29:26 +10:00