Commit Graph

71 Commits

Author SHA1 Message Date
Andrew Tridgell 50e2458df0 math: more abs() fixes
abs() is 16 bit
2012-08-16 15:17:42 +10:00
Jason Short e2c3149b2f Location Lib : Abs was overflowing causing bad comparison 2012-08-15 22:01:51 -07:00
Jason Short 555e26d5fa Location Lib. Potential fix for bad angle and distance calcs.
last_lat changed to int32_t since it can be negative.
2012-08-15 21:36:55 -07:00
Andrew Tridgell 20a30e3a6b AP_Math: added matrix column extraction functions 2012-08-11 22:06:02 +10:00
Andrew Tridgell e1ffd37411 AP_Math: added location_update() and location_offset() functions
these will be used by AHRS dead reckoning
2012-08-11 11:56:54 +10:00
Andrew Tridgell 16d63978f1 MAVLink: moved mavlink variables back to library
these were moved to the main sketches to allow for compile time
selection of MAVLink 0.9 vs 1.0. We no longer support 0.9, so we can
move it back, which simplifies some test sketches
2012-08-09 12:06:21 +10:00
Andrew Tridgell 891ed81f74 AP_Math: rename get_bearing() to get_bearing_cd() to make units obvious 2012-08-08 12:12:30 +10:00
Andrew Tridgell 63a83b95b4 AP_Math: added get_distance_cm() to return in centimeters 2012-07-11 07:49:05 +10:00
Andrew Tridgell 6cf2e2fa13 AP_Math: cope with co-located waypoints in location_passed_point() 2012-07-04 14:24:04 +10:00
Andrew Tridgell 7be29c8b04 AP_Math: the windows arduino build is missing acosf() 2012-07-04 14:14:58 +10:00
Andrew Tridgell 8fa1acb141 AP_Math: add include of math.h
this is needed for location.cpp
2012-07-04 13:59:23 +10:00
Andrew Tridgell 84a489498d Math: added location functions to math library
these do common calculations on struct Location
2012-07-04 12:42:46 +10:00
Andrew Tridgell 2b352d2b5c Math: added comment 2012-06-27 16:01:49 +10:00
Andrew Tridgell f23cebc808 Math: moved more template functions to the .cpp files
save a bit more code space for larger functions
2012-06-27 16:01:49 +10:00
Andrew Tridgell c2ff66c9cd examples: fixed build of some examples with new AP_Declination code 2012-03-30 14:25:27 +11:00
Andrew Tridgell 477b31fb0d Math: added mul_transpose() operation
this is equivalent to multiplying by m.transposed(), but is more
efficient
2012-03-23 16:48:52 +11:00
Andrew Tridgell fb9790e1f4 Math: moved matrix multiple operations to .cpp file
this means we only link this in once, rather than for every use of
matrix multiply, which saves us some flash space

We need to be careful not to put large pieces of code in template
headers, as if the operation is used a lot, it costs us a lot of code
space
2012-03-21 10:43:48 +11:00
Andrew Tridgell ece2aac4b9 Math: fixed the build of the eulers test in SITL 2012-03-21 10:41:55 +11:00
Andrew Tridgell 9a40b4b1de Math: added a test for the rotate() method 2012-03-19 17:29:02 +11:00
Andrew Tridgell 7d155c77b1 Math: added rotate() method to Matrix3f
this is the core method used to update the DCM matrix with a gyro
vector. Moving it to AP_Math allows us to have a test for it
2012-03-19 17:29:02 +11:00
Andrew Tridgell a41281ab7f Math: added zero() and identity() methods to Matrix3f 2012-03-19 17:29:02 +11:00
Andrew Tridgell df79703ed1 Math: change signs in quaternion library
thanks to Justin for the suggestion
2012-03-19 17:29:02 +11:00
Andrew Tridgell c87b945fd2 Math: allow eulers test to build with AP_Declination library 2012-03-19 17:29:02 +11:00
Andrew Tridgell 39067299a5 Math: fixed build of eulers test on SITL 2012-03-19 17:29:02 +11:00
Andrew Tridgell b6040878b4 Math: added a function to combine standard rotations
this will allow us to have an overall board rotation plus a per-sensor
rotation
2012-03-19 17:29:02 +11:00
Andrew Tridgell cc1961b1e8 Math: any euler angle with pitch > 90 is invalid
both DCM and quaternion always return pitch in the range -90 to 90
2012-03-11 15:37:07 +11:00
Andrew Tridgell 01535a7a21 AP_Math: update the test suite 2012-03-11 15:37:07 +11:00
Andrew Tridgell 6d08e38d5d AP_Math: made rotation matrices more C++
thanks to Adam for the suggestion
2012-03-11 15:37:07 +11:00
Andrew Tridgell 92ada85f49 AP_Math: allow null pointers in Quaternion::to_euler()
this matches the Matrix3f method
2012-03-11 15:37:07 +11:00
Andrew Tridgell a9b8c4dd82 AP_Math: re-work quaternion functions to be more C++ like
thanks to Adam for the suggestion!
2012-03-11 15:37:07 +11:00
Andrew Tridgell 24a9fe8827 Math: added a test suite for the new rotation methods 2012-03-11 15:37:07 +11:00
Andrew Tridgell 85c3c1d2ea Math: added vector3.rotate() and matrix3.rotation() methods
these operate on a "enum Rotation" which defines a set of standard
rotations. These are much faster than our previous method, plus use
less memory
2012-03-11 15:37:07 +11:00
Andrew Tridgell b39323bf1b AP_Math: expanded the math test suite 2012-03-10 10:34:31 +11:00
Andrew Tridgell a8fd31a5e1 AP_Math: added quaternion->matrix and earth frame routines
this will be used for 3d acceleration
2012-03-10 10:34:31 +11:00
Andrew Tridgell d3dc5bd751 AP_Math: better way of handling safe_sqrt()
better to test the result, than predict it
2012-03-10 10:34:31 +11:00
Andrew Tridgell d24b055b66 Math: added comment on quaternion constructor 2012-03-10 10:34:30 +11:00
Andrew Tridgell 1f5095e722 Math: added is_inf() on vector3f 2012-03-10 10:34:30 +11:00
Andrew Tridgell f2e6714598 AP_Math: added quaternion helper functions and a test suite 2012-03-10 10:34:30 +11:00
Andrew Tridgell de32c3bc31 AP_Math: added a .zero() method to Vector3f 2012-03-10 10:34:28 +11:00
Andrew Tridgell df6013616e AP_Math: added rotmat <-> euler functions
these will make the dcm matrix manipulation easier to understand
2012-02-24 11:52:55 +11:00
Andrew Tridgell 8190204287 AP_Math: added safe_sqrt() function
this function will never return NAN. It will return zero for negative
numbers.
2012-02-24 11:52:55 +11:00
Andrew Tridgell 1a32ececb4 AP_Math: added a safe_asin() function
this adds range checking to asin()
2012-02-24 11:52:55 +11:00
Andrew Tridgell 7dd909a16b AP_Math: added is_nan() methods to vector3f and matrix3f 2012-02-24 11:52:55 +11:00
Andrew Tridgell 2b8f0c3a48 AP_Param: moved AP_Vector3f and AP_Matrix3f declarations to AP_Math.h
this avoids us needing AP_Math.h in every utility sketch and example
2012-02-18 10:51:57 +11:00
Andrew Tridgell 845683a56c added comment in polygon code 2011-12-21 23:31:38 +11:00
Andrew Tridgell b52cd45670 fixed comment 2011-12-19 20:52:59 +11:00
Andrew Tridgell 7c9c26e2b7 AP_Math: re-work polygon algorithm for perfect precision
using sign checking and 64 bit integer math only when needed results
in an algorithm that is just as fast as the floating point version,
but has perfect results for any representable lat/lng
2011-12-19 18:52:56 +11:00
Andrew Tridgell 7442ba31d8 polygon: improve the speed and precision of the polygon algorithm
now takes 156 usec per test, with a 11 point boundary
2011-12-18 12:59:50 +11:00
Andrew Tridgell 1ab2b416a3 geofence: store fence points as int32_t
this keeps maximum precision in fence boundaries
2011-12-16 20:11:51 +11:00
Andrew Tridgell 3ddfc6664a AP_Math: better polygon algorithm
this one seems to do better with single precision floating point
2011-12-16 20:11:51 +11:00