Commit Graph

765 Commits

Author SHA1 Message Date
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
Peter Barker 40c4bf5d6a AP_Math: add conversions from metres to feet 2023-09-08 19:44:07 +10:00
Peter Barker 8df2d4998b AP_Math: improve gating of use of AP_InternalError library
- gate calls into library directly on the define
 - INTERNAL_ERROR becomes empty if library not compiled in
2023-08-17 09:16:46 +10:00
Andy Piper eacc29e81e AP_Math: do not use internal_error() on iofirmware 2023-08-15 06:53:48 +10:00
Andrew Tridgell e97f5d8012 AP_Math: mark test_math_double.cpp as double precision source
fixed test_math_double
the wrap check needs to be wrap_PI() as otherwise rounding of 2*PI if
just over 6.28 will give a large error
ensure double tests are double
test_vector2
2023-08-02 16:22:59 +01:00
Andrew Tridgell af491e2f2a AP_Math: define M_PI to more digits for use by code that uses DOUBLE_PRECISION_SOURCES 2023-07-18 11:06:02 +10:00
Andy Piper 1b10008e38 AP_Math: use message with static assertion 2023-07-13 11:02:40 +10:00
Randy Mackay 46702e6c49 AP_Math: Vector2f::projected made const 2023-07-05 20:27:54 +09:00
Peter Barker c463b0d154 AP_Math: add alternate implementation of parity for AP_Periph
the __builtin_parity methods hardfault on AP_Periph builds
2023-06-07 21:41:14 +10:00
Peter Barker 43ecdc64b6 AP_Math: move use of __builtin_parity to crc 2023-06-07 21:41:14 +10:00
Ryan Friedman cf2b65877e AP_Math: Move conversion utilites next to AP_Math
* This is next to the constraining functions

Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
2023-06-05 09:09:13 +10:00
Michael du Breuil 32fd21592a AP_Math: Add fletcher16 CRC 2023-05-25 17:35:27 -07:00
Pierre Kancir cdfbadbfb6 AP_Math: add test_rotations for custom rotations testing 2023-05-24 17:56:58 +10:00
jfbblue0922 7d924f10e2 AP_Math: add crc8_sae 2023-05-10 17:24:02 +10:00
Iampete1 ff4b63f9dc AP_Math: Chirp: add complete method to see if chirp is finished 2023-05-02 09:36:03 +10:00
Peter Barker 0b2e1e7989 AP_Math: allow conversion of a quaternion into an rpy Vector3f
There are several places in the code that can use this
2023-04-19 14:24:45 +10:00
Peter Barker ddf62cc060 AP_Math: add waf argument to get consistent builds 2023-02-17 20:48:45 +11:00
Peter Barker 5c262144f0 AP_Math: avoid using struct Location
clang reports this could be a problem when compiling under some EABIs.  Remove it from most places as it is just noise, replace with class where we want to avoid including Location.h
2023-02-04 22:51:54 +11:00
Peter Barker 5c77c0fbe4 AP_Math: use classes to fix MATH_CHECK_INDEXES 2023-01-25 19:58:54 +11:00
Andrew Tridgell c19554e23a AP_Math: added Vector3i comparison 2023-01-24 11:16:39 +11:00
Leonard Hall aeb25ca20a AP_Math: extend the control.cpp test suite 2022-12-30 20:25:58 +09:00
Andrew Tridgell f0d8a383d1 AP_Math: added a control.cpp test suite 2022-12-30 20:25:58 +09:00
Leonard Hall ac3a3d9576 AP_Math: Target velocity can reduce when limited
AP_Math: Target velocity can reduce when limited
2022-12-30 20:25:58 +09:00