Commit Graph

686 Commits

Author SHA1 Message Date
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
Rishabh 0779cf436e AP_Math: Added function to calculate shortest distance betwwen point and line segment in 3D 2020-06-19 09:45:34 +09:00
Peter Barker 2f8c0dd65b AP_Math: remove use of Vector3 as function 2020-06-16 11:06:47 +10:00
Peter Barker dad5b4e903 AP_Math: remove use of Vector2 as function 2020-06-16 11:00:44 +10:00
Andrew Tridgell a56a7f7da4 AP_Math: added more vector3f ops for lua 2020-06-04 09:49:52 +10: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
bugobliterator 05fe49a51f AP_Math: disable INEXACT flag from Float exception 2020-05-17 16:12:43 +10:00
Andrew Tridgell 3e853344f3 AP_Math: avoid build warnings 2020-05-10 15:11:22 +10: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
Mark Whitehorn 7d3d664ddf AP_Math: generate internalError on call to Vector3<T>::rotate and Quaternion::from_rotation with bad rotation value 2020-04-28 10:52:21 +10:00
Randy Mackay 9fd39f3768 AP_Math: alternative quaternion rotation test 2020-04-09 19:41:08 +09:00
Randy Mackay 26e4dd6fef AP_Math: correct quaternion::from_rotation for pitch-180 2020-04-09 19:41:08 +09:00
Randy Mackay c18fce6714 AP_Math: add quaternion rotation test 2020-04-09 19:41:08 +09:00
Randy Mackay 61a06bbb04 AP_Math: add quaternion rotate, from_rotation and invert 2020-04-09 19:41:08 +09:00
Randy Mackay 338548c5eb AP_Math: move HALF_SQRT_2 def to rotation.h
This allows it to be used by the Quaternion class
2020-04-09 19:41:08 +09:00
Samuel Tabor 45cb663d73 AP_Math: Add template for Vector2f::projected. 2020-04-08 09:11:54 +10:00
Randy Mackay 9c8a5a7392 AP_Math: add comments above some quaternion methods
thanks to jchallinger
2020-04-03 10:16:07 +09:00
Randy Mackay 7a48a3f354 AP_Math: minor comment fix 2020-03-30 20:20:02 +09: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 f908e56154 AP_Math: define ROTATION_MAX_AUTO_ROTATION
we don't want to use ROTATION_PITCH_7 in our auto rotation mix, as it
is too close to level
2020-01-01 16:59:27 +11:00
Randy Mackay f87ae7d445 AP_Math: add vector2f::offset_bearing 2020-01-01 13:38:41 +09:00
Andrew Tridgell ff2cfbaafb AP_Math: added smaller footprint crc32 2019-10-28 15:53:16 +11:00