Commit Graph

708 Commits

Author SHA1 Message Date
Tom Pittenger ec5820044b AP_Math: add defines for AP_SEC_PER_HOUR and AP_MSEC_PER_HOUR 2021-11-23 09:16:04 +11:00
Buzz adaccdf0ba AP_Math: esp32 with esp_idf have MIN and MAX defined to something else.
Author: Charles Villard <charlesvillard10@gmail.com>
Author: Buzz <davidbuzz@gmail.com>
2021-11-01 17:40:31 +11:00
Josh Henderson 9b74452270 AP_Math: add Internal_Error for quaternion of 0 length 2021-09-28 19:09:16 +10:00
Josh Henderson 0125ae26ac AP_Math: enable SITL unit testing 2021-09-28 09:11:48 +10:00
Leonard Hall 77fbcf1741 AP_Math: Control: add expo calculation. 2021-09-23 20:03:53 +09:00
Pierre Kancir d853d16c42 AP_Math: fix vectorN ctor warning by using C++11 brace initilization in all cases 2021-09-21 20:51:37 +10:00
Tom Pittenger 8c9dcf4ad8 AP_Math: added CRC16_CCITT non-standard variant 2021-08-19 17:49:27 +10:00
Peter Barker be076e5b1a AP_Math: correct descriptions of quaternion functions 2021-08-19 10:00:35 +10:00
Peter Barker 2251e442cc AP_Math: move crc8_dvb_update into crc library 2021-08-13 16:22:37 +10:00
Leonard Hall ad2a152751 AP_Math: Spelling fix 2021-08-11 17:07:29 +09:00
Leonard Hall 8961695369 AP_Math: Control: Refactor to use Jerk 2021-08-11 17:07:29 +09:00
Leonard Hall 3a8924c185 AP_Math: Control: protect against divide by zero 2021-08-11 17:07:29 +09:00
Iampete1 22100dd37c AP_Math: move to 32 digit rotation constants 2021-07-28 18:09:05 +10:00
Iampete1 5ecfd3fbce AP_Math: remove unused ROTATION_MAX_AUTO_ROTATION define 2021-07-28 18:09:05 +10:00
Iampete1 dbd95f8163 AP_Math: make duplicate rotations clear 2021-07-28 18:09:05 +10:00
Iampete1 080f6c295c AP_Math: examples: rotations: add test for duplicate rotations. 2021-07-28 18:09:05 +10:00
Iampete1 f8220a8adf AP_Math: tests: test quaternion rotation is the same as vector 2021-07-28 18:09:05 +10:00
Iampete1 6c5424aad6 AP_Math: add roll +- 45 rotations 2021-07-28 18:09:05 +10:00
Peter Barker 118d3f085f AP_Math: quaternion: add from_euler(Vector3&) 2021-07-28 17:20:28 +10:00
Andrew Tridgell c5ef672fb5 AP_Math: fixed expo_curve()
doesn't make sense as constexpr
2021-07-23 14:47:14 +10:00
Randy Mackay 7daacfd63e AP_Math: vector2f gets float.h include 2021-07-22 08:51:41 +09:00
Randy Mackay 52bb8112b3 AP_Math: control.h needs vector2/3 includes 2021-07-22 08:51:41 +09:00
Randy Mackay 6c180994cd AP_Math: add support for crc8_maxim
Thanks to FastCRC
2021-07-13 10:01:14 +09:00
Leonard Hall de36398ebf AC_Math: Control: Support Accel only input 2021-07-10 20:25:05 +09:00
Andrew Tridgell 75411afd21 AP_Math: added test for SCurve::calculate_path
this was the values shown in the core dump for failing guided mode
test in CI
2021-07-10 10:34:01 +09:00
Andrew Tridgell 498220b9f3 AP_Math: fixed error where t4_out could be negative in SCurve::calculate_path
this case cropped up in SITL due to floating point accuracies
2021-07-10 10:34:01 +09:00
Andrew Tridgell f343c8501b AP_Math: fixed double fill_nanf() 2021-07-10 07:20:41 +10:00
Andrew Tridgell 168e860f70 AP_Math: fixed a few more single precision calls 2021-07-10 07:20:41 +10:00
Andrew Tridgell 1486a473bd AP_Math: remove unused rotation_matrix_norm() 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 afb928081a AP_Math: use ftype for a few internal trig fns 2021-07-10 07:20:41 +10:00
Andrew Tridgell 31a6663797 AP_Math: fixed vel correction test build 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
Michelle Rossouw f95cb16434 AP_Math: Add Vector2f+z initialiser for Vector3f 2021-07-06 14:56:02 +10:00
Andrew Tridgell 978ea307b0 AP_Math: fixed the value LATLON_TO_CM
it didn't have enough digits of precision, and was inconsistent with
LOCATION_SCALING_FACTOR
2021-06-29 17:26:34 +09:00
Andrew Tridgell aa03afafa7 AP_Math: added matrix3 tofloat and todouble 2021-06-24 21:34:30 +10:00
Andrew Tridgell 9b91cfe4ee AP_Math: implement double versions of some position control methods 2021-06-24 21:34:30 +10:00
Andrew Tridgell 3a3a30ab22 AP_Math: define postype_t and vectors 2021-06-24 21:34:30 +10:00
Andrew Tridgell 3315ec5acc AP_Math: added tofloat() and todouble() methods to Vector2 and Vector3 2021-06-24 21:34:30 +10:00
Andrew Tridgell 639570505b AP_Math: cleanups from Leonards feedback 2021-06-24 20:28:45 +10:00
Andrew Tridgell 566dd8ca8b AP_Math: cleanup API comments on control code 2021-06-24 20:28:45 +10:00
Andrew Tridgell 86f09cad09 AP_Math: cleanup position control APIs
use Vector2 for xy, float for z
2021-06-24 20:28:45 +10:00
Andrew Tridgell fe4abc521a AP_Math: make vector3 xy() method return a reference 2021-06-24 20:28:45 +10:00
Josh Henderson 566621e2ba AP_Math: SCurve check direction.length_squared is_zero 2021-06-14 13:26:44 +09:00
Andrew Tridgell f19b604a0c AP_Math: added xy() method on Vector3
useful for getting xy length
2021-06-13 07:50:02 +10:00
Rishabh b9fbf1a661 AP_Math: Update segment_to_segment_dis test 2021-06-12 13:31:52 +09:00
Rishabh 547f0efd57 AP_Math: Add segment to plane intersection function 2021-06-12 13:31:52 +09:00
Pierre Kancir 519b1a6913 AP_Math: correct and increase unit test coverage
AP_Math: correct some tests

AP_Math: more vector2 tests

AP_Math: make test_vector2 complete

AP_Math: add initial unittest for vector3
2021-06-09 18:06:18 +10:00
Randy Mackay b263a1d751 AP_Math: add Quaternion::roll_pitch_difference 2021-06-08 12:55:17 +09:00
Andrew Tridgell 154ae64e63 AP_Math: support either polarity in linear_interpolate() 2021-06-05 13:05:30 +10:00
Peter Barker d77d258442 AP_Math: add tests for the sqrt_controller 2021-06-04 23:00:19 +10:00
Leonard Hall 5c47c0a131 AP_Math: Fix before squash 2021-05-24 20:13:37 +10:00
Andrew Tridgell 53e5bef0c2 AP_Math: added rotate_xy to Vector3f
this makes it easy to rotate a vector3f in xy plane for earth/body
navigation
2021-05-24 20:13:37 +10:00
Leonard Hall c4bb8baf0c AP_Math: Control: Add XY S-Curve shapers and shaping limits 2021-05-24 20:13:37 +10:00
Leonard Hall 3530d9121f AP_Math: minor format fix to SCurve::advance_target_along_track 2021-05-12 19:53:57 +09:00
Tom Pittenger ba6bb21560 AP_Math: added helper for16bit float conversions 2021-04-28 19:22:53 -07:00
hs293go 93a13bbf0e AP_Math: Implement tests for the Quaternion class
These tests cover Quaternion multiplication, conversion to rotation
matrix, and the optimized rotation operator
2021-04-19 15:34:45 +10:00
hs293go 8bc02ab00b AP_Math: Implement quaternion vector rotation operator
Overloads operator*() with semantics of applying a rotation to a vector, in
common with usage in Eigen/OpenGL. This implementation carries out 30
operations, compared to 58 operations for the q*v*q.inverse() formula
2021-04-19 15:34:45 +10:00
Randy Mackay bc0da915c4 AP_Math: add SplineCurve library
Co-authored-by: Leonard Hall <leonardthall@gmail.com>

includes corrections from peer review
2021-04-03 12:07:59 +09:00
Leonard Hall af7403f4e9 AP_Math: add SCurve library
SCurve const more local variables
rename update to get_jerk_vel_pos_at_time
removed unused update
debug output in SITL
fixes to ensure finished at end of path
fixes including validity check
includes corrections from peer review
2021-04-03 12:07:59 +09:00
Randy Mackay 0e506a71a1 AP_Math: remove control's limit_vector_length
these have been moved to Vector2f and Vector3f
2021-04-03 12:07:59 +09:00
Randy Mackay e2b46d05dc AP_Math: Vector2,3 get limit_length methods 2021-04-03 12:07:59 +09:00
Leonard Hall 3bb0482795 AP_Math: add update_pos_vel_accel to control
also add shape_vel, shape_pos_vel and stopping_distance
also add calculation of kinematic limits
2021-04-03 12:07:59 +09:00
Andrew Tridgell 1f60eb68ec AP_Math: removed assert calls
these waste flash space and do not do us any good
2021-03-25 14:03:40 +11:00
Andrew Tridgell e884e4c5ac AP_Math: added fixedwing_turn_rate() helper 2021-02-27 14:42:20 +11:00
Patrick José Pereira 5d7d955378 AP_Math: Add missing const in member functions
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2021-02-03 18:45:14 +11:00
Rishabh f3d825bebe AP_Math: Add unit tests for 3-D lines 2021-02-01 14:34:13 +09:00
Rishabh 1262d73071 AP_Math: Add new methods to support 3D avoidance 2021-02-01 14:34:13 +09:00
Rishabh 79d5e432ee AP_Math: Add new method to extrapolate 3D vector given distance, yaw, pitch 2021-02-01 14:34:13 +09:00
Andrew Tridgell a1fb0592a9 AP_Math: specialise polyfit for vectors
this is needed to get the precision good enough for wide temperature
ranges when summing the resulting polygon coefficients
2021-01-21 13:09:21 +11:00
Andrew Tridgell 999268cbba AP_Math: fixup matrix algorithms to be in cpp file
this fixes an issue where optimize O2 was forced on any file that
included AP_Math.h. It also fixes the test suite for matrix_alg, and
fixes the type handling to be consistent
2021-01-21 13:09:21 +11:00
bugobliterator 3b3e2c01f8 AP_Math: templatize matrix_alg methods 2021-01-21 13:09:21 +11:00
Andrew Tridgell 64d9f43d94 AP_Math: added polygon fitting code 2021-01-21 13:09:21 +11:00
Andrew Tridgell 720f9a1de0 AP_Math: cleanup maths functions
use class template instantiation, and cleanup const in matrix code
2021-01-21 13:09:21 +11:00
Leonard Hall 1e38440c83 AP_Math: add control common functions 2021-01-20 18:19:40 +11:00
Andrew Tridgell d9dbcb17c4 AP_Math: enable constrain value with line numbers on all boards 2021-01-19 10:24:39 +11:00
Peter Barker c81df7b5ad AP_Math: add tests for circle-segment-intersection 2021-01-04 13:58:42 +11:00
Peter Barker f534963413 AP_Math: consolidate error checking 2021-01-04 13:58:42 +11:00
murata 4ffc559ccc AP_Math: judge isnan judgment before operation 2021-01-04 13:58:42 +11:00
Gone4Dirt 5edae526fd AP_Math: Add conversion Ams to mAh 2020-11-24 12:54:52 +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
Andrew Tridgell a56f07b74d AP_Math: allow build without other headers for vector2.h 2020-11-10 16:15:45 +11:00
Andrew Tridgell c0b20881d6 AP_Math: allow vector3.h to be included earlier in include chain 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
Andrew Tridgell 747b48d0a8 AP_Math: added crc_sum8
for FPort/FPort2
2020-10-28 09:00:34 +11:00
murata 9714d8dde9 AP_MAth: Move the CRC24 to the AP_Math class 2020-10-21 18:24:07 +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 a0f25640a2 Revert "AP_Math: add bitwise fetch/load 16, 24, 32bit operations"
This reverts commit 6efaa29577.
2020-10-07 19:11:38 +11:00
Tom Pittenger ee8f50e6a5 Revert "AP_Math: fix LoadUint() to allow 32bit values"
This reverts commit 5e2450c4ea.
2020-10-07 19:11:38 +11:00
Tom Pittenger 5e2450c4ea AP_Math: fix LoadUint() to allow 32bit values 2020-10-05 15:32:53 -07:00
Tom Pittenger 6efaa29577 AP_Math: add bitwise fetch/load 16, 24, 32bit operations 2020-09-15 13:09:50 -07: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
Pierre Kancir 240c34ecde AP_Math: add missing ; on benchmark test 2020-09-06 19:13:04 +10:00
yaapu 144f7df02f AP_Math: added CRCs needed by AP_MSP 2020-09-02 05:56:46 +10:00
bugobliterator a8d36a37c4 AP_Math: ensure that we use environment Python interpreter 2020-08-03 14:02:09 +10:00
Andy Piper d4c5b945b3 AP_Math: move crc8_dvb_s2 here and add additional crc8 functions 2020-07-07 18:48:06 +10:00
Andrew Tridgell b6a5509409 AP_Math: added test for vector2f rotate 2020-07-06 14:46:48 +10:00
Andrew Tridgell 24d0804249 AP_Math: added rotate() method to Vector2f 2020-07-06 14:46:48 +10:00