Commit Graph

386 Commits

Author SHA1 Message Date
Randy Mackay 46c652e42f Math: maxf and minf functions 2015-08-19 16:44:34 +09:00
Gustavo Jose de Sousa 4790371f9b AP_Math: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:38:18 +10:00
Lucas De Marchi 0471de2342 AP_Math: use ARRAY_SIZE macro 2015-07-21 14:25:09 +09:00
Lucas De Marchi fb2eb262e7 AP_Math: use ARRAY_SIZE instead of defining another one 2015-07-21 14:24:49 +09:00
Andrew Tridgell 6009ae55b1 AP_Math: fixed build of eulers example sketch 2015-07-17 08:24:49 +10:00
Andrew Tridgell 8f41d97548 AP_Math: fixed build error on PX4
variable set but not used with recent longitude_scale change
2015-07-06 08:19:57 +10:00
Andrew Tridgell 099392d3ca AP_Math: don't optimise longitude_scale on faster CPUs
it causes problems with replay
2015-07-05 17:27:53 +10:00
Andrew Tridgell 3edac37929 AP_Math: removed unused include in example 2015-06-01 17:35:03 +10:00
Andrew Tridgell 4d040bbb94 AP_Math: convert example from .pde to .cpp 2015-06-01 17:07:04 +10:00
Andrew Tridgell 2b828a794e AP_Math: fixed example build 2015-06-01 16:36:54 +10:00
Randy Mackay 114c4f4077 AP_Match: fix example sketch 2015-05-27 09:47:24 +09:00
Andrew Tridgell 2a8f645d81 AP_Math: use matrix3 euler312 operations in quaternion library 2015-05-25 09:08:31 +10:00
Andrew Tridgell 7aa7e03169 AP_Math: added euler312 functions (for gimbal) 2015-05-25 09:03:11 +10:00
Andrew Tridgell 605b8b4ece AP_Math: converted rotations example to cpp
this is just a test conversion before we start converting on-mass
2015-05-21 13:41:20 +10:00
Andrew Tridgell 062c9406bd AP_Math: fixed rotations example build 2015-05-21 13:37:44 +10:00
Tom Pittenger 5f677c2b5b AP_Math: float to double promotion via cos instead of cosf 2015-05-16 08:21:49 +10:00
Tom Pittenger e20ffa8c75 AP_Math: replace fabs() with fabsf() 2015-05-09 09:57:27 +10:00
Randy Mackay 9dede2f0ec Math: remove duplicate HALF_SQRT_2 definition 2015-05-05 14:23:14 +09:00
Andrew Tridgell 77a2b4acf6 AP_Math: removed fast_atan 2015-05-05 13:57:22 +10:00
Andrew Tridgell 0b897e04bb AP_Math: revert AP_Math class change 2015-05-05 13:27:06 +10:00
Andrew Tridgell 936fbbb362 AP_Math: removed AP_Math class 2015-05-05 13:27:03 +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 330e4126bb Ap_Math: compile warnings: float to double. use atan2f instead of atan2 2015-05-05 13:27:00 +10:00
Tom Pittenger 820f0bf02a AP_Math: compiler warnings: float to double promotion
cast as float because we're in magical template land where T minus T means promote to double
2015-05-05 13:26:58 +10:00
Tom Pittenger 1c3ad00aa7 AP_Math: compiler warnings: use double for the constant so the template can handle it 2015-05-05 13:26:57 +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
Tom Pittenger 35f7a466e5 AP_Math: compiler warnings: apply is_zero(float) or is_equal(float) 2015-05-05 13:26:52 +10:00
Tom Pittenger a5d2f3a82f AP_Math: compiler warnings: float to double 2015-05-05 13:26:52 +10:00
Tom Pittenger ac4e7b2b03 AP_Math: compiler warnings: apply is_equal(float) 2015-05-05 13:26:51 +10:00
Tom Pittenger c93c773de2 AP_Math: change is_equal and is_zero to static class for better visability 2015-05-05 13:26:50 +10:00
Tom Pittenger bdda11b327 AP_Math: compiler warning: is_zero special case for vector3.h in a template 2015-05-05 13:26:50 +10:00
Andrew Tridgell eca675c556 AP_Math: fix for HAL_SITL rename 2015-05-05 09:45:55 +10:00
Andrew Tridgell 24b051565b AP_Math: added normalize() method to Matrix3f 2015-05-05 09:45:52 +10:00
Randy Mackay fecbf06008 AP_Math: fix example sketches 2015-05-01 20:57:38 +09:00
Randy Mackay eaedeeb7bf AP_Math: add quaternion.initialise 2015-05-01 16:37:34 +09: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
Jonathan Challinger 3812773485 AP_Math: make quaternion divide by zero protection more conservative 2015-04-28 11:42:13 +10:00
Jonathan Challinger fb8da1b2d8 AP_Math: add get_euler_(roll|pitch|yaw) functions to quaternion 2015-04-28 11:42:13 +10:00
Tom Pittenger 10c933966b AP_Math: fix compile warning re float constants 2015-04-24 14:25:02 +09:00
Tom Pittenger a8dda9f2ed AP_Math: fix compile warnings re float constants 2015-04-24 14:03:54 +09:00
Jonathan Challinger 6baec4952b AP_Math: add conversions to and from 3-1-2 euler angles 2015-04-07 21:20:51 -07:00
Jonathan Challinger a1d4f40c16 AP_Math: change quaternion operator* and operator/ to const 2015-04-07 21:20:51 -07:00
Jonathan Challinger 07735fefa6 AP_Math: fix div by zero in quaternion 2015-04-07 21:20:51 -07:00
Andrew Tridgell 728dbf24db AP_Math: fixed vector inequality test
many thanks to cat888

fixes issue #2039
2015-04-01 20:40:37 -07:00
Grant Morphett 300a02f4e4 AP_Math: Changes to fix the warnings in rover sitl build.
We are starting the process of resolving all the warnings in the
ardupilot builds of all vehicles and platforms.
2015-02-11 18:16:46 +11:00
Jonathan Challinger 5f7480b740 AP_Math: change fast_atan2 to use atan2f on fast CPUs 2015-02-09 22:24:09 +09:00
Paul Riseborough 255252f387 AP_Math: Fix bug in quaternion division 2015-02-03 09:49:16 +11:00
Paul Riseborough 17445d03f0 AP_Math: Add quaternion division 2015-02-03 09:49:16 +11:00
Randy Mackay 689cc9e298 AP_Math: fix example sketch 2015-01-28 17:15:43 +09:00
Andrew Tridgell fefdc37a4d AP_Math: fixed warnings on bounds checking in quaternion 2015-01-09 11:04:50 +11:00
Andrew Tridgell 6bb4a8c361 AP_Math: make location_path_proportion() and location_passed_point() more efficient
the dot product is much more efficient than the trigonometry. Thanks
to Paul for the suggestion
2015-01-03 14:06:59 +11:00
Jonathan Challinger 9e5a30d5ba AP_Math: change ROTATION_YAW_293_PITCH_68_ROLL_180 to ROLL_90 2015-01-02 17:15:18 +09:00
Andrew Tridgell f38f86ab8c AP_Math: added location_path_proportion()
this can be used for glide slope calculations
2015-01-01 15:17:10 +11:00
Andrew Tridgell 38c5f25c70 AP_Math: fixed example build 2014-11-25 13:22:17 +11:00
Andrew Tridgell 8d54368650 AP_Math: fixed build warning 2014-11-25 08:17:15 +11:00
Randy Mackay 503d14428d AP_Math: add new rotation to example rotation sketch 2014-11-22 14:10:00 +09:00
Randy Mackay 3d2c9910b3 AP_Math: add yaw 293, pitch 68, roll 180 rotation 2014-11-22 14:09:16 +09:00
Jonathan Challinger cdd2199138 AP_Math: expand frame transformation test case for quaternions 2014-10-20 06:24:33 +11:00
Jonathan Challinger 3befe74afa AP_Math: change quaternion class to use const references where optimal 2014-10-20 06:24:30 +11:00
Jonathan Challinger 70845882a7 AP_Math: fix up rotation test suite 2014-10-20 06:24:27 +11:00
Jonathan Challinger 1f7e393e38 AP_Math: refactor quaternion library 2014-10-20 06:24:22 +11:00
Andrew Tridgell 184c4c8ac5 AP_Math: fixed example build 2014-08-13 22:12:04 +10:00
Andrew Tridgell 917c9f7865 AP_Math: fixed example build 2014-08-13 21:48:35 +10:00
Daniel Frenzel b1a9d6bbcc AP_Math: Using const references in matrix3
Signed-off-by: Daniel Frenzel <dgdanielf@gmail.com>
2014-08-11 09:24:05 +10:00
Andrew Tridgell b92873cab1 AP_Math: prevent negative longitude scaling
for crazy locations
2014-08-07 09:30:02 +10:00
Andrew Tridgell 03dc27147e AP_Math: port examples to Linux 2014-07-29 15:49:38 +10:00
Andrew Tridgell aa5940c378 AP_Math: fixed example build 2014-07-25 17:51:30 +10:00
Niels Joubert 398f32d538 AP_Math: Comments on WGS coordinate conversions 2014-06-30 10:29:56 +10: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
Andrew Tridgell 7e5a491f14 AP_Math: prevent a floating point exception 2014-04-21 15:37:08 +10:00
Andrew Tridgell e566802bf3 AP_Math: fixed example build 2014-04-07 07:37:34 +10:00
Niels Joubert 879eb5936b AP_MATH: Adding WGS GPS conversions, CRC16 checks, and double-precision Vectors and Matrices 2014-04-05 13:42:23 +11:00
Andrew Tridgell 9278685cdf AP_Math: fixed location build on SITL 2014-04-01 14:20:10 +11:00
Andrew Tridgell acd54d0826 AP_Math: fixed example build 2014-03-19 12:13:48 +09:00
Andrew Tridgell 009913ec60 AP_Math: make is_nan const for quaternion and add .zero() for vector2 2014-02-21 20:24:47 +11:00
Andrew Tridgell 599c3a8abf AP_Math: added more operators to VectorN 2014-02-19 10:14:58 +11:00
Andrew Tridgell 2df314799e AP_Math: added tests for quaternion to/from rotation matrix 2014-02-15 12:20:51 +11:00
Andrew Tridgell 689f230d40 AP_Math: added quaternion.from_rotation_matrix() 2014-02-15 12:20:31 +11:00
Andrew Tridgell c1dff6aa65 AP_Math: fixed example build 2014-02-15 06:39:43 +11:00
Andrew Tridgell 1e0f3f5398 AP_Math: make to_euler() const 2014-02-15 05:27:51 +11:00
Andrew Tridgell 90c41981ac AP_Math: added quaternion normalization 2014-02-15 05:27:51 +11:00
Randy Mackay 37cfbc9ad5 AP_Math: float versions of wrap_360 and wrap_180 2014-02-15 05:27:45 +11:00
Randy Mackay a963ec7e3b AP_Math: bug fix to wrap_360 and wrap_180
angles above 720deg and below 3200deg might not have been properly
wrapped.
wrap_360_cd could return 36000 when really this should be wrapped back
to zero.
2014-02-03 12:56:56 +09:00
Andrew Tridgell 93070a673e AP_Math: fixed example build 2014-01-30 13:33:46 +11:00
Andrew Tridgell 0d174db05b AP_Math: added equality operator for VectorN 2014-01-24 10:37:08 +11:00
Paul Riseborough f2c2811ef3 AP_AHRS & AP_Math: fixed bug in use of AHRS_TRIM parameters 2014-01-19 07:19:43 +11:00
Andrew Tridgell 4c99d09265 AP_Math: fixed build of vectorN class on PX4 2013-12-31 10:28:27 +11:00
Andrew Tridgell 96df09fd08 AP_Math: add const to quaternion API 2013-12-30 14:33:17 +11:00
Andrew Tridgell 2e9744d0b3 AP_Math: prevent transpose usage error in matrix API 2013-12-30 14:33:17 +11:00
Andrew Tridgell 2c1e0ba130 AP_Math: added vectorN class, and index checking 2013-12-30 14:33:17 +11:00
Andrew Tridgell 828eed1984 AP_Math: allow vector3 and matrix3 objects to be used as arrays 2013-12-29 18:39:09 +11:00
Andrew Tridgell 9b5b4ced60 AP_Math: fixed example build 2013-12-17 11:51:37 +11:00
Andrew Tridgell 57d5345774 AP_Math: added M_PI_F define 2013-12-11 10:22:47 +11:00
Andrew Tridgell db400ffa51 AP_Math: added is_zero() method to Vector3 2013-12-09 17:34:06 +11:00
Andrew Tridgell d2deee07df AP_Math: fixed zero function for integer vectors 2013-11-07 12:48:16 +11:00
Andrew Tridgell fb19dbb404 AP_Math: cope with large values passed into the wrap functions
this uses modulus if the function would loop too many times

Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-10-03 12:21:07 +10:00
Andrew Tridgell 18896d9c9b AP_Math: fixed DOS CR/LF errors 2013-09-19 16:26:32 +10:00
Andrew Tridgell 84ed2141a0 AP_Math: fixed float rounding in location_offset()
this prevents rounding of positions in the rover code
2013-09-16 11:38:55 +10:00
Andrew Tridgell 97b7130bb9 libraries: update license header to GPLv3
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Andrew Tridgell 873e54deb1 AP_Math: fixed example build 2013-08-30 13:01:39 +10:00
Andrew Tridgell 4c752e4a94 AP_Math: simplify rotations test code 2013-08-30 13:01:34 +10:00
Andrew Tridgell e2b0e07973 AP_Math: removed unused matrix rotation code
we only need to rotate vectors
2013-08-30 13:01:34 +10:00
Andrew Tridgell a295a01bbc AP_Math: added missing 90 degree rotations
this ensures we can handle all 90 degree rotations of the compass and
main board. A test in examples/rotations shows that we have them all.
2013-08-30 13:01:33 +10:00
Andrew Tridgell 2b1fcc964f AP_Math: added a quick test of floating point location accuracy
just confirming some maths ...
2013-08-30 13:01:32 +10:00
Andrew Tridgell 5434b2c017 AP_Math: update location code to avoid float rounding
this avoids manipulating global coordinates as float variables. Using
a float reduces our precision from 1cm to about 70cm.

This also adds location_diff() which will be used in the L1 controller
to avoid global positions in floats
2013-08-13 12:07:34 +10:00
Andrew Tridgell 9cb6c987d4 AP_Math: fixed example build 2013-08-05 12:37:51 +10:00
Andrew Tridgell 1d75b52411 AP_Math: use const references not pointers for location functions
this makes life a bit easier for the new AP_Mission library

Pair-Programmed-With: Brandon Jones <brnjones@gmail.com>
2013-08-05 10:23:40 +10:00
Andrew Tridgell 468e55d425 AP_Math: added two new vector/matrix ops for kalman airspeed filter 2013-07-22 12:50:00 +10:00
Randy Mackay 540ca25b84 AP_Math: add rotateXY 2013-07-20 17:59:06 +09:00
Randy Mackay bd6a60f28b AP_Math: add M_PI_2 definition
Required when building under arduino
2013-07-14 15:57:26 +09:00
Andrew Tridgell 8c49ed78a5 AP_Math: make the rotation numbers easier to find 2013-07-08 12:17:59 +10:00
Randy Mackay 8b87849acd Math: add wrap_PI 2013-06-01 18:21:29 +09:00
Randy Mackay d81b7b507d Math: add Leonard's fast tan function 2013-05-30 18:24:32 +09:00
Andrew Tridgell 5024da2695 AP_Math: fixed indent-tabs-mode 2013-05-30 09:51:51 +10:00
Randy Mackay 7c9d9b9800 AP_Math: use DEG_TO_RAD in longitude_scale
Also increased accuracy of RadiansToCentiDegrees although it is like the
compiler will throw away the extra digits anyway.
2013-05-05 14:31:24 +09:00
Andrew Tridgell 737f0305ef AP_Math: implement vector2 cross product
useful in DCM for faster yaw correction
2013-05-05 13:47:51 +10:00
Andrew Tridgell f4189e083b AP_Math: added mulXY() for matrix3 and vector3
returns the XY components of the product
2013-05-05 13:47:23 +10: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 e1f9297551 AP_Math: move print_latlon() to location.cpp 2013-04-20 13:52:36 +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
Andrew Tridgell 43c3c60de2 AP_Math: moved a lot of vector templates to cpp from .h
this reduces the code size quite a lot on AVR
2013-04-12 12:48:08 +10:00
Andrew Tridgell 78eb12a4ac AP_Math: added RadiansToCentiDegrees and RADIUS_OF_EARTH 2013-04-12 12:48:08 +10:00
Andrew Tridgell 8b119934ea AP_Math: fixed grammar error 2013-04-12 12:48:08 +10:00
Andrew Tridgell 2d29a6a7be AP_Math: added Vector2f.angle()
useful for calculating the vector in polar coordinates
2013-04-12 12:48:08 +10:00
tobias 217b8d7a59 cleanup: use const for struct Location pointers and references
this allows the compiler to generate more efficient code
2013-04-09 12:10:32 +10:00
Andrew Tridgell 091b474a1d AP_Math: added wrap_360_cd() and wrap_180_cd()
moved from per-vehicle code
2013-03-29 13:13:37 +11:00
Randy Mackay 7729ec950e AP_Math: longitude_scale function made public
Added LATLON_TO_M and LATLON_TO_CM #defines
2013-01-27 23:21:39 +09:00
Randy Mackay d2767b911c AP_Math: switch get_distance_cm to return uint32_t
Includes changes required on ArduCopter and ArduPlane side as well
2013-01-26 17:04:12 +09:00
James Bielman 4fa7bb1486 Add AVR compatibility header for missing math.h definitions.
- Define float versions of math functions to the double versions
  on AVR (eg. #define sinf sin).
- These macros appear to be missing in older versions of avr-libs.
- Include AP_Math.h rather than math.h to get these definitions.
2013-01-16 13:52:17 +11: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 374af1cd14 build: change from Arduino.mk to apm.mk 2013-01-02 17:29:37 +11:00
Andrew Tridgell eb74fddd9f AP_Math: added global GRAVITY_MSS define 2013-01-02 14:45:08 +11:00
Andrew Tridgell e7b915b0f4 AP_Math: fixed error comment 2012-12-22 12:52:42 +11:00
Andrew Tridgell d8bed0c2aa AP_Math: fixed get_distance() function 2012-12-20 14:53:23 +11:00
Andrew Tridgell a072afa223 AP_Math: expand some macros into functions
this saves some flash
2012-12-20 14:52:38 +11:00
Andrew Tridgell a1187519a8 AP_HAL: use AP_HAL_BOARD_DRIVER in remaining test sketches 2012-12-20 14:52:37 +11:00
Andrew Tridgell a76688e630 Math: fixed example warnings 2012-12-20 14:52:36 +11:00
Pat Hickey eb530b86e8 move Arduino.mk to /mk/Arduino.mk 2012-12-20 14:52:35 +11:00
Andrew Tridgell 7d27e420ae AP_HAL: remove unnecessary Arduino.h includes 2012-12-20 14:52:30 +11:00
Pat Hickey 475da4eca4 CONFIG_HAL_BOARD - test sketches fixed up, build all passes 2012-12-20 14:51:37 +11:00
Pat Hickey a4f1f6a5db AP_Progmem: fix dependencies for all sketches touched by AP_HAL_AVR 2012-12-20 14:51:28 +11:00
Pat Hickey 7dbe198e5c AP_Math: port to work on coreless arduino (AP_HAL) 2012-12-20 14:51:24 +11:00
Pat Hickey 3f1d9d7f69 AP_Param: #include <AP_Param.h> fixups for libraries & sketches
* I mostly went through with grep and added an #include <AP_Param.h> below
  every #include <AP_Common.h>. Not all of these example sketches might
  strictly need AP_Param.
2012-12-20 14:51:19 +11:00
rmackay9 56f88821e9 AP_AHRS: fix example sketch
AP_Airspeed: fix example sketch
AP_Baro: fix example sketch
AP_Declination: fix example sketch
AP_Math: fix example sketch
2012-11-08 00:08:18 +09:00
rmackay9 3fd07805a7 AP_Math: added rotation method accuracy test to example sketch 2012-11-04 13:05:37 +09:00
rmackay9 d6324b3964 AP_Math: fix compile errors example sketches 2012-11-04 11:55:59 +09:00
uncrustify 652b490345 uncrustify libraries/AP_Math/vector2.h 2012-08-21 19:03:34 -07:00
uncrustify 97994a4e3a uncrustify libraries/AP_Math/AP_Math.h 2012-08-21 19:03:34 -07:00
uncrustify 7e19ae5868 uncrustify libraries/AP_Math/matrix3.h 2012-08-21 19:03:34 -07:00
uncrustify 9bb0b42f28 uncrustify libraries/AP_Math/rotations.h 2012-08-21 19:03:34 -07:00
uncrustify 57d4db2be4 uncrustify libraries/AP_Math/vector3.h 2012-08-21 19:03:34 -07:00
uncrustify d50c606c97 uncrustify libraries/AP_Math/quaternion.h 2012-08-21 19:03:34 -07:00
uncrustify 9ccb38260d uncrustify libraries/AP_Math/polygon.h 2012-08-21 19:03:34 -07:00
uncrustify 533860dd73 uncrustify libraries/AP_Math/AP_Math.cpp 2012-08-21 19:03:34 -07:00
uncrustify b5bee9deff uncrustify libraries/AP_Math/polygon.cpp 2012-08-21 19:03:34 -07:00
uncrustify a208fbb2d9 uncrustify libraries/AP_Math/vector3.cpp 2012-08-21 19:03:34 -07:00
uncrustify 424baf3f29 uncrustify libraries/AP_Math/quaternion.cpp 2012-08-21 19:03:33 -07:00
uncrustify d6e803fd3c uncrustify libraries/AP_Math/matrix3.cpp 2012-08-21 19:03:33 -07:00
uncrustify 64eaadb332 uncrustify libraries/AP_Math/location.cpp 2012-08-21 19:03:33 -07:00
uncrustify d0d401581f uncrustify libraries/AP_Math/examples/location/location.pde 2012-08-21 19:03:33 -07:00
uncrustify 52dbb56bf0 uncrustify libraries/AP_Math/examples/rotations/rotations.pde 2012-08-21 19:03:33 -07:00
uncrustify 87c263fbb9 uncrustify libraries/AP_Math/examples/polygon/polygon.pde 2012-08-21 19:03:33 -07:00
uncrustify 86627c9a9d uncrustify libraries/AP_Math/examples/eulers/eulers.pde 2012-08-21 19:03:33 -07:00
Andrew Tridgell 6300fa7399 math: more abs() fixes
abs() is 16 bit
2012-08-16 15:17:42 +10:00
Jason Short a66e43aff1 Location Lib : Abs was overflowing causing bad comparison 2012-08-15 22:01:51 -07:00
Jason Short ff38dadd00 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 0ba57d05eb AP_Math: added matrix column extraction functions 2012-08-11 22:06:02 +10:00
Andrew Tridgell 87fca1985f 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 2a7b298bbc 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 8ae35cae1c AP_Math: rename get_bearing() to get_bearing_cd() to make units obvious 2012-08-08 12:12:30 +10:00
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