Commit Graph

64 Commits

Author SHA1 Message Date
Andrew Tridgell a72f6acef6 AP_Math: added get_distance_cm() to return in centimeters 2012-07-11 07:49:05 +10:00
Andrew Tridgell 1cd8c54f21 AP_Math: cope with co-located waypoints in location_passed_point() 2012-07-04 14:24:04 +10:00
Andrew Tridgell 468dfe3faa AP_Math: the windows arduino build is missing acosf() 2012-07-04 14:14:58 +10:00
Andrew Tridgell 0bdce404a5 AP_Math: add include of math.h
this is needed for location.cpp
2012-07-04 13:59:23 +10:00
Andrew Tridgell dd200cba31 Math: added location functions to math library
these do common calculations on struct Location
2012-07-04 12:42:46 +10:00
Andrew Tridgell fe865bc1dc Math: added comment 2012-06-27 16:01:49 +10:00
Andrew Tridgell c30b0d85a3 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 22ff8cb197 examples: fixed build of some examples with new AP_Declination code 2012-03-30 14:25:27 +11:00
Andrew Tridgell a6d66dc45b 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 fe55a76335 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 17fbb8ea26 Math: fixed the build of the eulers test in SITL 2012-03-21 10:41:55 +11:00
Andrew Tridgell 17f7292fe9 Math: added a test for the rotate() method 2012-03-19 17:29:02 +11:00
Andrew Tridgell c16b353ea7 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 31e566475b Math: added zero() and identity() methods to Matrix3f 2012-03-19 17:29:02 +11:00
Andrew Tridgell d948a28e7c Math: change signs in quaternion library
thanks to Justin for the suggestion
2012-03-19 17:29:02 +11:00
Andrew Tridgell af9ce0cfc9 Math: allow eulers test to build with AP_Declination library 2012-03-19 17:29:02 +11:00
Andrew Tridgell 72a761170b Math: fixed build of eulers test on SITL 2012-03-19 17:29:02 +11:00
Andrew Tridgell 58a68c89d9 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 0ec9857689 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 4d3789d11c AP_Math: update the test suite 2012-03-11 15:37:07 +11:00
Andrew Tridgell 4422486d44 AP_Math: made rotation matrices more C++
thanks to Adam for the suggestion
2012-03-11 15:37:07 +11:00
Andrew Tridgell 5c6368bad3 AP_Math: allow null pointers in Quaternion::to_euler()
this matches the Matrix3f method
2012-03-11 15:37:07 +11:00
Andrew Tridgell 9f0cb78f08 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 55aa43a70d Math: added a test suite for the new rotation methods 2012-03-11 15:37:07 +11:00
Andrew Tridgell 289c64c0b9 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 a92fb67b70 AP_Math: expanded the math test suite 2012-03-10 10:34:31 +11:00
Andrew Tridgell 4d65cda0ea 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 8abbbe5713 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 1ec4c0777c Math: added comment on quaternion constructor 2012-03-10 10:34:30 +11:00
Andrew Tridgell f5e6dc0757 Math: added is_inf() on vector3f 2012-03-10 10:34:30 +11:00
Andrew Tridgell c7d5f06b21 AP_Math: added quaternion helper functions and a test suite 2012-03-10 10:34:30 +11:00
Andrew Tridgell 145fc91701 AP_Math: added a .zero() method to Vector3f 2012-03-10 10:34:28 +11:00
Andrew Tridgell 16ed8bc8f6 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 17d16bc8c6 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 502fbf6e17 AP_Math: added a safe_asin() function
this adds range checking to asin()
2012-02-24 11:52:55 +11:00
Andrew Tridgell 17170da96e AP_Math: added is_nan() methods to vector3f and matrix3f 2012-02-24 11:52:55 +11:00
Andrew Tridgell 882cd4ea83 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 11b8d56434 added comment in polygon code 2011-12-21 23:31:38 +11:00
Andrew Tridgell e7568db237 fixed comment 2011-12-19 20:52:59 +11:00
Andrew Tridgell 6efa2e53cb 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 a3a0e5646f 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 42522baf9f geofence: store fence points as int32_t
this keeps maximum precision in fence boundaries
2011-12-16 20:11:51 +11:00
Andrew Tridgell 9b6bab8904 AP_Math: better polygon algorithm
this one seems to do better with single precision floating point
2011-12-16 20:11:51 +11:00
Andrew Tridgell 62e92f406e AP_Math: make out vector and matrix elements used types with fixed sizes
this prevents differences between CPU types
2011-12-16 20:09:11 +11:00
Andrew Tridgell 85e295332f AP_Math: added Polygon_complete() function
used to veryify user supplied boundaries
2011-12-15 14:42:34 +11:00
Andrew Tridgell 117a98f9a2 AP_Math: added a Polygon_outside() function
this tests if a point is outside of a polygon. This will be used as
part of our geo-fencing support, and also for a new 'fenced mode'
2011-12-15 14:34:58 +11:00
James Goppert 0c7c508541 Optional recursion added. 2011-09-30 17:17:51 -04:00
James Goppert 5489b84f8e Improvements to cmake. 2011-09-29 21:23:26 -04:00
James Goppert d887a28b91 Added ArduBoat/ ArduRover/ and APO library. 2011-09-29 14:12:15 -04:00
unknown a4e001bbcf Adding CMake support 2011-09-14 15:44:55 +02:00