Peter Barker
7baf6f18fe
AP_Math: replace ToRad with radians and ToDeg with degrees
2025-05-29 11:24:56 +10:00
Leonard Hall
f35312f921
AP_Math: Remove RadiansToCentiDegrees and CentiDegreesToRadians
2025-05-28 20:16:26 +09:00
Leonard Hall
986fb7e29d
AP_Math: Create cd_to_rad , rad_to_cd, remove DEGX100
2025-05-28 20:16:26 +09:00
Leonard Hall
5fb3e867fb
AP_Math: Control: add Const
2025-05-22 11:53:02 +09:00
Leonard Hall
dd091a7fe0
AP_Math: fix shape limits
2025-05-22 11:53:02 +09:00
Leonard Hall
2b818520cc
AP_Math: Control: Add heading input shaping
2025-05-22 11:53:02 +09:00
muramura
4dd2fb2cb0
AP_Math: Clarify the floating-point value
2025-05-05 21:49:43 +10:00
Andy Piper
14bc825f74
AP_Math: remove new distance to point code
2025-04-09 17:01:04 +01:00
Andy Piper
385f9de5a2
AP_Math: re-instate cartesian polygon distance calculator
2025-04-09 17:01:04 +01:00
Andy Piper
abaa64a754
AP_Math: correct Polygon_closest_distance_point() for use with lat/lng at small distances
...
add polygon proximity tests
2025-04-09 17:01:04 +01:00
Thomas Watson
0ecdae05ba
AP_Math: split radians into float and double variants
...
Most `radians` uses give a float argument and use a float return type.
On `HAL_WITH_EKF_DOUBLE` boards this results in a bunch of unnecessary
conversions. Create separate double and float variants of the function
to eliminate the impact. The `DEG_TO_RAD` constant is already a float,
therefore there is no loss of precision in the operation.
We also need a variant that takes an `int` argument as these are
supplied in several places, primarily as constants, and the `int`
conversion is otherwise ambiguous.
Saves a few hundred bytes of flash on such boards.
2025-04-08 22:06:37 +10:00
Thomas Watson
19972714b1
AP_Math: drop AP_Matrix3f param mention
...
It hasn't been a thing for nearly a decade.
2025-04-05 19:32:25 -05:00
Leonard Hall
36b0bfb708
SCurve: Clarify segment names
2025-04-02 12:18:37 +11:00
Leonard Hall
56b99d4aa5
SCurve: Fix speed and accel checks to include z component when transitioning fast waypoints
2025-04-02 12:18:37 +11:00
Peter Barker
0ae3e7cdcb
AP_Math: allow initial value to be specified for crc8_generic
...
some crc8's start with a non-zero value
2025-03-05 18:17:28 +11:00
Julio Cesar Matias
076951f003
matrix_alg: Probable redundancy
2025-03-03 08:57:39 +09:00
Andy Piper
fba40313ce
AP_Math: add get_twos_complement() from betaflight
2025-02-27 22:32:10 +00:00
Peter Barker
bbf7b4ceb6
AP_Math: remove Python print_function import
2025-02-26 10:06:11 +11:00
Peter Barker
43061b2d6c
AP_Math: correct description of linear_interpolate
...
the return-value comment was just flat-out wrong.
Fix the parameter naming to make it clearer what is going on
2025-01-11 11:24:36 +11:00
Peter Barker
f236a6c6fc
AP_Math: tests: we no longer expect an exception when limiting corner case
2025-01-07 16:08:03 +11:00
9dc992619b
AP_Math: prevent FPE in SITL when limiting accel vectors
...
The cross-product code can produce something slightly negative. Fix
safe_sqrt to avoid barfing on that, as was originally intended, and
clarify why it's being used.
Co-authored-by: Leonard Hall <leonardthall@gmail.com >
Co-authored-by: Thomas Watson <twatson52@icloud.com >
2025-01-07 16:08:03 +11:00
Peter Barker
a968ce8d33
AP_Math: add test for FPE in control code
2025-01-07 16:08:03 +11:00
Peter Barker
dc62483e0c
AP_Math: move zeroing to header, use memset, reuse in identity
...
this method is in ITCM memory on STM32 - which makes small optimisations worthwhile
2024-11-05 08:39:25 +09:00
Peter Barker
7710e3c9bc
AP_Math: add and use global NaNf float value
2024-09-26 19:26:59 +10:00
Peter Barker
3c0c2bfa67
AP_Math: add a test for rand_float
2024-08-27 11:09:13 +10:00
Peter Barker
84bcea73e1
AP_Math: correct range of returned value for rand_float on real hardware
2024-08-27 11:09:13 +10:00
Andrew Tridgell
6de6de694a
AP_Math: allow rand_float() on STM32
2024-08-27 11:09:13 +10:00
Peter Barker
6c788c6ae0
AP_Math: correct warning on fabsF
...
2024-08-08T01:51:53.6780446Z ../../libraries/AP_Math/vector3.cpp:432:9: warning: absolute value function 'fabsf' given an argument of type 'const double' but has parameter of type 'float' which may cause truncation of value [-Wabsolute-value]
2024-08-08T01:51:53.6781336Z if (fabsF(cosv) >= 1) {
2024-08-08T01:51:53.6781583Z ^
2024-08-08T01:51:53.6781930Z ../../libraries/AP_Math/ftype.h:50:18: note: expanded from macro 'fabsF'
2024-08-08T01:51:53.6782342Z #define fabsF(x) fabsf(x)
2024-08-08T01:51:53.6782572Z ^
2024-08-08T01:51:53.6789178Z ../../libraries/AP_Math/vector3.cpp:633:16: note: in instantiation of member function 'Vector3<double>::angle' requested here
2024-08-08T01:51:53.6789800Z template class Vector3<double>;
2024-08-13 10:42:23 +10:00
Peter Barker
d7caf1e6b5
AP_Math: remove method operator
...
remove the metho operator from the class.
This means this will no longer work:
Quaternion q{0,1,2,3};
q(5,6,7,8);
.... that used to set the quaternion componets, but is an odd / atypical syntax to use
2024-07-31 08:54:37 +10:00
Andrew Tridgell
2ce6532698
AP_Math: updated EulerAngles.pdf link
2024-07-27 11:14:10 +10:00
Andrew Tridgell
98733882f5
AP_Math: added comments and a test for euler ordering
...
our main euler functions did not have a comment on the ordering
convention
2024-07-27 11:14:10 +10:00
Michael du Breuil
aafa2f3998
AP_Math: Remove template parameter from constructor
...
Not valid in C++20, and makes GCC 14.1.1 very unhappy.
2024-07-10 10:07:24 +10:00
George Zogopoulos
9a3f6ae9c7
AP_Math: Created CentiDegreesToRadians
2024-06-20 09:12:50 +10:00
Peter Barker
0fc6fc4e9c
AP_Math: move definition of HAL_WITH_POSTYPE_DOUBLE into AP_HAL_Boards.h
...
other libraries need to know if we are doing double-precision offsets
2024-06-11 19:50:18 +10:00
Andrew Tridgell
72c77b3453
AP_Math: use NEW_NOTHROW for new(std::nothrow)
2024-06-04 09:20:21 +10:00
rishabsingh3003
276ee86f38
AP_Math: Add RDS02UF RangeFinder CRC
2024-04-01 16:12:53 +11:00
Pierre Kancir
2319a125d5
AP_Math: add missing include in vector2.h
2024-03-20 18:57:28 +11:00
Pierre Kancir
1762844686
AP_Math: remove unused include
2024-03-20 18:57:28 +11:00
Peter Barker
cf9c85d295
AP_Math: add and use AP_CUSTOMROTATIONS_ENABLED
...
also add to build_options.py
2024-03-03 08:22:46 +11:00
Peter Barker
9168a8fc50
AP_Math: allow compilation with HAL_LOGGING_ENABLED false
2024-01-17 18:25:55 +11:00
Andrew Tridgell
49c3536ca7
AP_Math: added uint64_div1000()
...
and test suite
2023-12-21 09:09:11 +11:00
Andrew Tridgell
7102205be3
AP_Math: added crc_sum_of_bytes_16()
2023-12-17 09:47:30 +11:00
Andrew Tridgell
ee1975d47a
AP_Math: added tesla conversions
2023-12-17 09:47:30 +11:00
Andrew Tridgell
ddccc92e7d
AP_Math: added rfu_to_frd() method for Vector3
2023-12-17 09:47:30 +11:00
Peter Barker
d34e6049c9
AP_Math: rename crc_sum8 to crc_sum8_with_carry
...
the name "sum8" is usually used for "sum all bytes into a uint8_t discarding carry"
2023-11-29 18:50:26 +11:00
Ryan Friedman
3965c7e4bf
AP_Math: Replace deprecated benchmark function
...
* Been deprecated since 1.2.0
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com >
2023-11-28 12:21:10 +11:00
Peter Barker
c5eab29f5e
AP_Math: add F_TO_KELVIN and C_TO_F
2023-11-17 13:09:02 +11:00
Peter Barker
3f730a8a94
AP_Math: add crc_sum_of_bytes
...
sums the values of the bytes in a buffer and returns that sum modulus 256
2023-11-17 13:09:02 +11:00
jfbblue0922
c17907cadc
AP_Math: add CRC crc16_ccitt_r function
2023-11-15 10:50:49 +11:00
Joshua Henderson
8e634f05d9
AP_Math: add CRC8_generic method
2023-10-05 08:23:00 +11:00