Commit Graph

80 Commits

Author SHA1 Message Date
Andrew Tridgell
6bff07397e AP_Math: added linear_interpolate() function 2016-04-02 22:44:47 +11:00
dgrat
5148e41c1a AP_Math: Cleaned macro definitions
Moved Definitions into a separate header. Replaced PI with M_PI and
removed the M_PI_*_F macros.
2016-02-27 02:51:33 -03:00
dgrat
7c4c8ea579 AP_Math: Remove ROTATION_COMBINATION_SUPPORT
This function is not used.
2016-02-27 02:51:33 -03:00
Valmantas Palikša
d4daf19151 AP_Math: Move simple math function implementations to header for better
compile time optimization

Functions like sq() are better moved to the header file as inline.
Compiler can then optimize these out when used in code, this saves cpu
cycles with stack push, pop during function calls.
2015-09-09 09:57:51 +10:00
Randy Mackay
46c652e42f Math: maxf and minf functions 2015-08-19 16:44:34 +09:00
Andrew Tridgell
77a2b4acf6 AP_Math: removed fast_atan 2015-05-05 13:57:22 +10:00
Tom Pittenger
4ec2fb3a9c AP_Math: Compiler warnings: nuke fast_atan2()
per Randy's suggestion, fast_atan2() is no longer necessary over atan2() because only copter uses it and copter is no longer supported on future builds of APM

ccd578664f (commitcomment-11025083)
2015-05-05 13:27:02 +10:00
Tom Pittenger
6e6f481ecb AP_Math: compiler warnings: apply is_zero(float) or is_equal(float) 2015-05-05 13:26:56 +10:00
Andrew Tridgell
eca675c556 AP_Math: fix for HAL_SITL rename 2015-05-05 09:45:55 +10:00
Randy Mackay
0392292489 AP_Math: inline is_equal, add is_zero 2015-04-28 16:19:01 +09:00
dgrat
726d7df710 AP_Math: add is_equal to compare floats 2015-04-28 16:18:59 +09:00
Tom Pittenger
a8dda9f2ed AP_Math: fix compile warnings re float constants 2015-04-24 14:03:54 +09:00
Jonathan Challinger
5f7480b740 AP_Math: change fast_atan2 to use atan2f on fast CPUs 2015-02-09 22:24:09 +09:00
David Dewey
17374ff5e8 AP_Math: fast_atan2
This is 126us per call vs 199us on the AVR.  it is accurate to about
0.28 degrees

Committed by rmackay9 but contribution is from David Dewey
2014-06-06 18:50:41 +09:00
Randy Mackay
d81b7b507d Math: add Leonard's fast tan function 2013-05-30 18:24:32 +09:00
Andrew Tridgell
ba83950fc4 libraries: replace constrain() with constrain_float()
this makes the type much more obvious. Thanks to Tobias for the
suggestion.
2013-05-02 10:25:40 +10:00
Andrew Tridgell
83dc7dbc92 AP_Math: handle NaN in constrain(), returning average
this makes it less likely a NaN will propogate
2013-04-15 14:28:51 +10:00
James Bielman
5631f865b2 Update floating point calculations to use floats instead of doubles.
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
Andrew Tridgell
38062bbb6d AP_Math: support some more rotation combinations 2013-01-13 17:32:48 +11:00
Andrew Tridgell
a072afa223 AP_Math: expand some macros into functions
this saves some flash
2012-12-20 14:52:38 +11:00
uncrustify
533860dd73 uncrustify libraries/AP_Math/AP_Math.cpp 2012-08-21 19:03:34 -07: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
4422486d44 AP_Math: made rotation matrices more C++
thanks to Adam for the suggestion
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
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
c7d5f06b21 AP_Math: added quaternion helper functions and a test suite 2012-03-10 10:34:30 +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