Tom Pittenger
00aaa78757
AP_Math: add separate check_lat() and check_lng()
9 years ago
Tom Pittenger
7b4c503052
AP_Math: use new check_latlng helper
9 years ago
Tom Pittenger
ce9ecf9f3d
AP_Math: added check_latlng helper
9 years ago
Ricardo de Almeida Gonzaga
481e3a2af6
AP_Math: Fix typos
9 years ago
dgrat
41661f815f
AP_Math: Replace the pythagorous* functions with a variadic template
...
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
9 years ago
dgrat
76362caee0
AP_Math: Replace wrap_* functions with template versions
9 years ago
Andrew Tridgell
e8142b0b5b
AP_Math: added wrap_360()
9 years ago
Michael du Breuil
bb7cf6c0b6
AP_Math: Update location_sanitize to sanitize for lat/lng
9 years ago
Tom Pittenger
278fb2e60d
AP_Math: add location sanity checker/fixer util
9 years ago
dgrat
672acdc8ef
AP_Math: Created location.h header for location functions
...
Helps to order AP_Math functions by purpose.
9 years ago
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.
9 years ago
Jonathan Challinger
fff275fd99
AP_Math: add wrap_2PI
9 years ago
Lucas De Marchi
fb28f426da
AP_Math: remove check for AVR CPUs
...
Remove the checks for HAL_CPU_CLASS > HAL_CPU_CLASS_16 and
HAL_CPU_CLASS >= HAL_CPU_CLASS_75. Corresponding dead code will be
removed on separate commits.
9 years ago
Lucas De Marchi
c7871d1bca
AP_Math: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1
9 years ago
Lucas De Marchi
20c6ffc5e3
Replace use of UARTDriver::printf_P() with UARTDriver::printf()
...
This also starts to show warnings on places that were already using
wrong printf format strings.
10 years ago
Lucas De Marchi
2c38e31c93
Remove use of PSTR
...
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.
This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.
AVR-specific places were not changed.
10 years ago
Randy Mackay
6145794da2
AP_Math: remove duplicate RADIUS_OF_EARTH definition
10 years ago
Tom Pittenger
4771d19073
AP_Math: added locations_are_same(loc1,loc2) helper
...
returns true if lat and lng are the same, ignores alt and options
10 years ago
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.
10 years ago
Andrew Tridgell
8f41d97548
AP_Math: fixed build error on PX4
...
variable set but not used with recent longitude_scale change
10 years ago
Andrew Tridgell
099392d3ca
AP_Math: don't optimise longitude_scale on faster CPUs
...
it causes problems with replay
10 years ago
Andrew Tridgell
0b897e04bb
AP_Math: revert AP_Math class change
10 years ago
Tom Pittenger
35f7a466e5
AP_Math: compiler warnings: apply is_zero(float) or is_equal(float)
10 years ago
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
10 years ago
Andrew Tridgell
f38f86ab8c
AP_Math: added location_path_proportion()
...
this can be used for glide slope calculations
10 years ago
Andrew Tridgell
b92873cab1
AP_Math: prevent negative longitude scaling
...
for crazy locations
11 years ago
Niels Joubert
879eb5936b
AP_MATH: Adding WGS GPS conversions, CRC16 checks, and double-precision Vectors and Matrices
11 years ago
Randy Mackay
37cfbc9ad5
AP_Math: float versions of wrap_360 and wrap_180
11 years ago
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.
11 years ago
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>
12 years ago
Andrew Tridgell
84ed2141a0
AP_Math: fixed float rounding in location_offset()
...
this prevents rounding of positions in the rover code
12 years ago
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
12 years ago
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>
12 years ago
Randy Mackay
8b87849acd
Math: add wrap_PI
12 years ago
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.
12 years ago
Andrew Tridgell
e1f9297551
AP_Math: move print_latlon() to location.cpp
12 years ago
Andrew Tridgell
8b119934ea
AP_Math: fixed grammar error
12 years ago
tobias
217b8d7a59
cleanup: use const for struct Location pointers and references
...
this allows the compiler to generate more efficient code
12 years ago
Andrew Tridgell
091b474a1d
AP_Math: added wrap_360_cd() and wrap_180_cd()
...
moved from per-vehicle code
12 years ago
Randy Mackay
7729ec950e
AP_Math: longitude_scale function made public
...
Added LATLON_TO_M and LATLON_TO_CM #defines
12 years ago
Randy Mackay
d2767b911c
AP_Math: switch get_distance_cm to return uint32_t
...
Includes changes required on ArduCopter and ArduPlane side as well
12 years ago
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.
12 years ago
Andrew Tridgell
d8bed0c2aa
AP_Math: fixed get_distance() function
12 years ago
Andrew Tridgell
a072afa223
AP_Math: expand some macros into functions
...
this saves some flash
12 years ago
Pat Hickey
7dbe198e5c
AP_Math: port to work on coreless arduino (AP_HAL)
12 years ago
uncrustify
64eaadb332
uncrustify libraries/AP_Math/location.cpp
13 years ago
Jason Short
a66e43aff1
Location Lib : Abs was overflowing causing bad comparison
13 years ago
Jason Short
ff38dadd00
Location Lib. Potential fix for bad angle and distance calcs.
...
last_lat changed to int32_t since it can be negative.
13 years ago
Andrew Tridgell
87fca1985f
AP_Math: added location_update() and location_offset() functions
...
these will be used by AHRS dead reckoning
13 years ago
Andrew Tridgell
8ae35cae1c
AP_Math: rename get_bearing() to get_bearing_cd() to make units obvious
13 years ago