Commit Graph

142 Commits

Author SHA1 Message Date
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