Commit Graph

94 Commits

Author SHA1 Message Date
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 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
Andy Piper 1b10008e38 AP_Math: use message with static assertion 2023-07-13 11:02:40 +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
Leonard Hall 1382923db0 AP_Math: Support changing update period 2022-12-13 17:10:06 +11:00
Peter Barker fffad18324 AP_Math: remove normalization of random compass Vector3f 2022-11-17 15:13:34 +11:00
Peter Barker 406119ed41 AP_Math: make rand_vec a little more efficient 2022-11-17 15:13:34 +11:00
Andrew Tridgell e1c006c25d AP_Math: added double_to_int32 and double_to_uint32 2022-09-06 10:49:50 +10:00
Andrew Tridgell 88f0a324fd AP_Math: added rounding functions
prevent undefined behaviour in float -> integer types
2022-07-12 11:00:08 +10:00
Iampete1 702245f89e AP_Math: calc_lowpass_alpha_dt: remove unused constrain 2022-06-08 17:11:08 +10:00
Andrew Tridgell a95b429acc AP_Math: added unsigned versions of constrain functions
sometimes it really does matter that we use constrain_uint32() instead
of constrain_int32(). For example, if we have a value like 0xFFFFFFFF
then the result will be very different

we should use unsigned constrain when dealing with unsigned values
2022-04-05 17:46:52 +10:00
Peter Barker e07ddf95b4 AP_Math: provide rand_float on embedded hardware 2022-03-17 14:39:55 +11:00
Andrew Tridgell 319592a148 AP_Math: added degF_to_Kelvin() 2022-01-17 15:16:24 +11:00
Peter Barker 99b1659e4b AP_Math: memcpy nanfs rather than iteratively setting them 2021-11-30 10:35:38 +11:00
Andrew Tridgell c5ef672fb5 AP_Math: fixed expo_curve()
doesn't make sense as constexpr
2021-07-23 14:47:14 +10:00
Andrew Tridgell f343c8501b AP_Math: fixed double fill_nanf() 2021-07-10 07:20:41 +10:00
Andrew Tridgell d91397f2f2 AP_Math: change wrap_PI to ftype
prevent loss of precision
2021-07-10 07:20:41 +10:00
Andrew Tridgell 0f2f0d4cb2 AP_Math: allow for double EKF build 2021-07-10 07:20:41 +10:00
Andrew Tridgell 154ae64e63 AP_Math: support either polarity in linear_interpolate() 2021-06-05 13:05:30 +10:00
Tom Pittenger ba6bb21560 AP_Math: added helper for16bit float conversions 2021-04-28 19:22:53 -07:00
Andrew Tridgell e884e4c5ac AP_Math: added fixedwing_turn_rate() helper 2021-02-27 14:42:20 +11:00
Andrew Tridgell 806852c9c3 AP_Math: speedup fill nanf 2020-11-10 16:15:45 +11:00
Andrew Tridgell cdcf32d22c AP_Math: added calc_lowpass_alpha_dt()
used in several places
2020-11-10 16:15:45 +11:00
Michael du Breuil 051640e2b2 AP_Math: Log line numbers on constrain_nan's for constrain float 2020-11-03 11:04:13 +11:00
Patrick José Pereira 6ee401cb00 AP_Math: Remove isnan check for non-float type
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-10-16 09:22:05 +11:00
Tom Pittenger 787d7f5254 Revert "AP_Math: add function to convert any base to any base"
This reverts commit 935cb39dff.
2020-10-07 19:11:38 +11:00
Tom Pittenger 935cb39dff AP_Math: add function to convert any base to any base
Example: convert dec 12345 to 0x12345 or dec 1200 to octal 1200
2020-09-15 13:09:50 -07:00
Randy Mackay bdb67532b0 AP_Math: clarify get_vel_correction_for_sensor_offset comment 2020-06-02 08:33:42 +09:00
Randy Mackay 4639e8a698 AP_Math: add get_vel_correction_for_sensor_offset 2020-06-01 17:51:24 +09:00
Peter Barker 58a8e54d83 AP_Math: create and use INTERNAL_ERROR macro so we get line numbers 2020-04-30 13:21:36 +10:00
Patrick José Pereira 1635054c4f AP_Math: Add missing constexpr
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-03-17 10:23:47 +11:00
Andrew Tridgell 66b4e92444 AP_Math: make fill_nanf() use a signalling NaN
we want use of these values to trigger a FPE
2019-10-01 17:35:26 +10:00
Peter Barker 6fe09b6120 AP_Math: move is_valid_octal into adsb
This doesn't ensure the value is octal digits - there's more magic in
it.
2019-10-01 09:18:15 +10:00
Peter Barker 975804fa35 AP_Math: remove unit_mod concept from wrap functions
devcall decided it would be clearer to have non-shared implementation
for the _cd variants
2019-09-25 13:19:44 +10:00
Andrew Tridgell 9b746b89db AP_Math: added fill_nanf()
used in SITL to invalidate memory
2019-09-24 12:51:54 +10:00
Peter Barker 5692f3d79e AP_Math: stop returning float for integer wrap_180/wrap_360 etc 2019-09-18 12:57:02 +10:00
Mark Whitehorn b515431008 AP_Math: add expo and throttle_curve functions 2019-04-23 09:46:38 +10:00
Peter Barker 381bb41a5e AP_Math: make constraining NaNs an internal error 2019-04-09 10:18:43 +10:00
Andrew Tridgell d4eaf09baf AP_Math: added rotation_equal() 2018-10-01 14:26:56 +09:00
Peter Barker 8fee27937a AP_Math: eliminate SITL float-equals issues 2018-08-28 09:54:47 +10:00
Peter Barker 6af0dcfed0 AP_Math: create a constrain_int64
The template system doesn't work across 32/64 bit builds (SITL
vs fmuv4), probably because int is typedef'd to int64
2018-06-15 08:01:22 +10:00
Tom Pittenger 3653ba61d7 AP_Math: add is_valid_octal helper function.
returns true if valid
2018-05-23 14:02:45 -07:00
Andrew Tridgell d4d7d1f734 AP_Math: avoid double maths when not needed 2018-05-07 11:43:23 +10:00
Andrew Tridgell f5b24a3838 AP_Math: fixed build of Sub with ChibiOS 2018-01-15 11:46:02 +11:00
Andrew Tridgell f088c3de23 AP_Math: added long templates 2018-01-15 11:46:02 +11:00
Miguel Arroyo 7cea21afa2 AP_Math: Moves rand_vec3f from SITL_State. 2017-06-29 09:22:08 +10:00
Francisco Ferreira da5060964b AP_Math: uniformize template type parameter keyword
Use typename everywhere instead of class
2017-06-21 18:19:31 +09:00
Andrew Tridgell 2fcecaa7c5 AP_Math: added rand_float() 2017-05-03 20:12:04 +10:00