Michael du Breuil
48610ea0a0
AP_Math: Remove an unneeded safe_sqrtf, leverage is_zero
2018-11-07 10:43:28 +11:00
Peter Barker
154d771e6c
AP_Math: correct compilation when running MATH_CHECK_INDEXES
2018-10-19 08:46:43 +11:00
Peter Barker
dc14d7bce4
AP_Math: add another test for wrap_360_cd
2018-10-16 10:29:24 +11:00
Lucas De Marchi
5521fce676
AP_Math: add non-uniform Vector3f scaling
2018-10-15 14:41:09 -07:00
Andrew Tridgell
d4eaf09baf
AP_Math: added rotation_equal()
2018-10-01 14:26:56 +09:00
Michael du Breuil
9cd1be1d6f
AP_Math: Speed up location calculations slightly
2018-09-19 14:40:48 +10:00
Peter Barker
43f3d611b2
AP_Math: pragma away the float-equal test for the maths tests
...
There are legitimate reasons for doing direct equivalence in these files
2018-08-28 09:54:47 +10:00
Peter Barker
8fee27937a
AP_Math: eliminate SITL float-equals issues
2018-08-28 09:54:47 +10:00
Peter Barker
fa5757f618
AP_Math: fix float-equals warnings
2018-08-15 12:16:49 +10:00
Andrew Tridgell
c3cf8f5435
AP_Math: fixed a bug in segment_intersection()
...
we could get an intercept point beyond the end of the segment
2018-08-14 19:41:45 +10:00
Peter Barker
626467db14
AP_Math: add tests for line intersection
2018-08-14 19:41:45 +10:00
Michael du Breuil
d568767164
AP_Math: Add conversion between inches of water to pascals
2018-08-08 09:07:17 +10:00
Michael du Breuil
46355e3de9
AP_Math: Add a warning to rotations to indicate that it is expected to
...
match the MAVLink definitions
2018-07-26 12:58:14 +09:00
Andrew Tridgell
8170fbcf80
AP_Math: added a comment on conventions for to_euler()
2018-07-18 16:07:19 +10:00
Peter Barker
20d22f3629
AP_Math: quaternion requires isnan, so include math.h to get it
2018-07-02 09:31:11 +10:00
Peter Barker
6af0dcfed0
AP_Math: create a constrain_int64
...
The template system doesn't work across 32/64 bit builds (SITL
vs fmuv4), probably because int is typedef'd to int64
2018-06-15 08:01:22 +10:00
Tom Pittenger
3653ba61d7
AP_Math: add is_valid_octal helper function.
...
returns true if valid
2018-05-23 14:02:45 -07:00
Patrick José Pereira
1ca6647b2e
AP_Math: Create Standard Sea Level variables
...
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2018-05-23 02:36:43 +01:00
Andrew Tridgell
d4d7d1f734
AP_Math: avoid double maths when not needed
2018-05-07 11:43:23 +10:00
Andrew Tridgell
61c8dfac31
AP_Math: split out double precision location functions
...
this allows ALLOW_DOUBLE_MATH_FUNCTIONS to be used
2018-05-07 11:43:23 +10:00
Andrew Tridgell
3b8ec3a2a0
AP_Math: allow double precision maths where needed
2018-05-07 11:43:23 +10:00
Jacob Walser
f97ac4af30
AP_Math: add custom rotation option
2018-04-24 13:04:37 +01:00
Jacob Walser
4f02f709a2
AP_Math: fix typo
2018-04-24 13:04:37 +01:00
Jacob Walser
e738f33770
AP_Math: Add ROTATION_PITCH_315 and ROTATION_ROLL_90_PITCH_315
2018-04-24 13:04:37 +01:00
Andrew Tridgell
a6e05cbf5a
AP_Math: added crc32 for IOMCU bootloader protocol
2018-04-17 08:44:44 +10:00
Andrew Tridgell
17f2f40b11
AP_Math: added xmodem CRC
...
used by blheli 4-way ESC protocol
2018-04-07 09:10:29 +10:00
Peter Barker
febcdd766b
AP_Math: narrow enumeration to uint8_t to avoid narrowing-warnings
...
/home/pbarker/rc/ardupilot/libraries/DataFlash/LogFile.cpp:361:25:
error: non-constant-expression cannot be narrowed from type 'enum
Rotation' to 'uint8_t' (aka 'unsigned char') in initializer list
[-Wc++11-narrowing]
orient1 : s0 ? s0->orientation() : ROTATION_NONE,
2018-04-02 14:12:09 +09:00
Peter Barker
c343a286c5
AP_Math: quaternion: add contructor from float[4]
2018-03-27 20:13:03 +09:00
bnsgeyer
600e0dac92
AP_Math: added support for cubic spline interpolation
2018-03-27 09:07:03 +11:00
Randy Mackay
c28cfcdc27
AP_Math: add Vector2f::circle_segment_intersection
2018-01-22 17:18:41 +09:00
Randy Mackay
a655c36159
AP_Math: add Vector2f::segment_intersection
2018-01-22 17:18:41 +09:00
Andrew Tridgell
ee1fea55ce
AP_Math: moved constants from AP_Baro
2018-01-16 07:14:20 +11:00
Andrew Tridgell
4ce696a520
AP_Math: fixed example build on ChibiOS
2018-01-15 11:46:02 +11:00
Andrew Tridgell
f5b24a3838
AP_Math: fixed build of Sub with ChibiOS
2018-01-15 11:46:02 +11:00
Andrew Tridgell
3d2c4ffa79
AP_Math: allow write to indexed vector2
2018-01-15 11:46:02 +11:00
Andrew Tridgell
f088c3de23
AP_Math: added long templates
2018-01-15 11:46:02 +11:00
Dr.-Ing. Amilcar Do Carmo Lucas
e13281ab2d
AP_Math: add overloaded functions get_horizontal_distance_cm() and get_bearing_cd() (NFC)
2017-12-05 08:54:49 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas
ec1790dad9
AP_Math: Use DEGX100 define instead of hardcoded value (NFC)
2017-12-05 08:54:49 +09:00
Andrew Tridgell
9660973975
AP_Math: make crc_crc8 const
2017-11-27 10:15:07 +09:00
Andrew Tridgell
3f226cd2b9
AP_Math: added from_rotation() method to Matrix3
...
this is used to get a rotation matrix from a rotation enum
2017-11-23 14:26:11 +11:00
Peter Barker
1ca76173a5
AP_Math: set radians(...) and degrees(...) as constexpr
2017-10-27 16:33:45 +11:00
Randy Mackay
2aa1f3f100
AP_Math: replace divide with multiply in distance_to_segment
2017-09-09 14:05:41 +09:00
Randy Mackay
e892bbbac0
AP_Math: add Vector3f::distance_to_segment
2017-09-09 14:05:41 +09:00
Randy Mackay
e6328c350d
AP_Math: add Vector3f::distance_squared
2017-09-09 14:05:41 +09:00
khancyr
15398f8b0e
AP_Math: correct variable init and remove define in polygon
2017-07-31 17:35:08 +09:00
Miguel Arroyo
7cea21afa2
AP_Math: Moves rand_vec3f from SITL_State.
2017-06-29 09:22:08 +10:00
Francisco Ferreira
da5060964b
AP_Math: uniformize template type parameter keyword
...
Use typename everywhere instead of class
2017-06-21 18:19:31 +09:00
Francisco Ferreira
1ffe12008c
AP_Math: adapt test for new norm method API
2017-06-21 18:19:31 +09:00
Francisco Ferreira
7b98f41947
AP_Math: correct norm to need two arguments
...
Correctly use sqrtf instead of the double version
Stop casting to float since sq already returns one
2017-06-21 18:19:31 +09:00
Randy Mackay
db45442de2
AP_Math: remove unused angle method
2017-06-09 15:21:58 +09:00
Michael du Breuil
2cd6ff6dd5
AP_Math: Accept float epsilon in is_positive is_negative as a valid result
2017-05-27 10:46:59 -07:00
Michael du Breuil
5a15413513
AP_Math: Add is_negative and is_positive helpers
2017-05-24 15:22:27 -07:00
Andrew Tridgell
607220d12b
AP_Math: rename macros to avoid conflicts
...
these macros were also defined in NuttX in clock.h
2017-05-06 15:21:14 +10:00
Andrew Tridgell
2fcecaa7c5
AP_Math: added rand_float()
2017-05-03 20:12:04 +10:00
Pierre Kancir
f2812c1efd
AP_Math: example fix travis warning
...
missing function declaration
implicit cast
some style fix
2017-04-13 19:56:16 +01:00
Tom Pittenger
1abeb03d2b
AP_Math: remove HAL_CPU_CLASS_16
2017-04-12 17:25:30 -07:00
Andrey Kolobov
a1fa2a9de3
AP_Math: added matrixN for soaring controller
2017-03-14 08:35:44 +11:00
Francisco Ferreira
7afcbf51ec
AP_Math: also fix SEC_PER_WEEK
2017-03-13 02:57:30 +00:00
murata
1982285e23
AP_Math: update MSEC_PER_SEC definition to fix GPS time calcs
2017-03-13 11:50:33 +09:00
Michael du Breuil
c5c94949bf
AP_Math: Extend vector2::angle(vector2) to distinguish parallel and antiparallel vectors
...
There are a number of use cases where distingusihing antiparallel from parallel vectors is important
2017-03-02 00:50:44 +00:00
Michael du Breuil
97c57764c4
AP_Math: Add a 3D location difference, returning NED
2017-02-13 09:23:14 +11:00
murata
30151c8253
Global: Define MSEC_PER_SEC, MSEC_PER_WEEK, SEC_PER_WEEK and UNIX_OFFSET.
2017-02-11 01:34:09 -08:00
Lucas De Marchi
2b9478f430
AP_Math: tests: make both arguments double
...
libraries/AP_Math/tests/test_math.cpp.3.o: In function `MathTest_IsEqual_Test::TestBody()':
test_math.cpp:(.text._ZN21MathTest_IsEqual_Test8TestBodyEv+0x1a0): undefined reference to `std::enable_if<std::is_floating_point<std::common_type<float, double>::type>::value, bool>::type is_equal<float, double>(float, double)'
collect2: error: ld returned 1 exit status
2017-02-06 09:27:22 -08:00
Lucas De Marchi
008ac0a2a8
AP_Math: remove unused double instantiation
2017-02-06 09:27:22 -08:00
Lucas De Marchi
87038d8ef1
AP_Math: add casts to consider literals as doubles
...
Since we pass -fsingle-precision-constant to the compiler, add casts to
make literals real doubles.
2017-02-06 09:27:22 -08:00
Lucas De Marchi
48d94db259
AP_Math: double constants need a type
...
We can't use define since we use -fsingle-precision-constant and they
would be interpreted as float.
2017-02-06 09:27:22 -08:00
Lucas De Marchi
a500aced3c
AP_Math: remove unused double constants
2017-02-06 09:27:22 -08:00
Lucas De Marchi
87c82ce0c6
AP_Math: add some more tests for constrain_value()
2017-01-27 12:15:20 -08:00
Lucas De Marchi
82d210144b
AP_Math: remove warnings from constrain_value()
...
Return type is T which can be an integral type, float or double. By
dividing by 2 we avoid float operation on the first case and do the
right thing on the second and third.
2017-01-27 12:15:19 -08:00
Lucas De Marchi
2605c7265b
AP_Math: remove warnings from safe_asin()
...
Return type is float, so operate on float types everywhere.
Fixes this warning while building for PX4:
../../libraries/AP_Math/AP_Math.cpp: In instantiation of 'float safe_asin(T) [with T = double]':
../../libraries/AP_Math/AP_Math.cpp:56:48: required from here
../../libraries/AP_Math/AP_Math.cpp:44:11: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
if (v >= 1.0f) {
^
../../libraries/AP_Math/AP_Math.cpp:47:11: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
if (v <= -1.0f) {
^
2017-01-27 12:15:19 -08:00
Lucas De Marchi
69a9cd3625
AP_Math: add tests to is_equal()
...
Contemplate the use of double values.
2017-01-27 12:15:19 -08:00
Lucas De Marchi
4f8d2059f8
AP_Math: use right epsilon for is_equal()
...
We are calling fabsf(), which returns a float. We should use the epsilon
from float type, not from the argument type passed to fabsf().
On the other hand when the double version is instantiated we do want to
use the std::numeric_limits<double>::epsilon() value.
This adds a branch to the function, but it's removed when the function
is intantiated by the compiler since the type is known at compile-time.
Fixes this warning when building for PX4:
../../libraries/AP_Math/AP_Math.cpp: In instantiation of 'typename std::enable_if<std::is_floating_point<typename std::common_type<_Tp, _Up>::type>::value, bool>::type is_equal(Arithmetic1, Arithmetic2) [with Arithmetic1 = double; Arithmetic2 = double; typename std::enable_if<std::is_floating_point<typename std::common_type<_Tp, _Up>::type>::value, bool>::type = bool]':
../../libraries/AP_Math/AP_Math.cpp:23:66: required from here
../../libraries/AP_Math/AP_Math.cpp:17:29: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
return fabsf(v_1 - v_2) < std::numeric_limits<decltype(v_1 - v_2)>::epsilon();
^
2017-01-27 12:15:19 -08:00
murata
ec4cce15a1
AP_Math: Unify from print or println to printf.
2017-01-27 18:20:22 +11:00
Andrew Tridgell
67a2441b12
AP_Math: started a set of crc functions
...
these functions are often common between drivers
2017-01-27 18:11:29 +11:00
murata
e903cb9945
AP_Math: Change mask value to hexadecimal number.
2017-01-17 10:20:15 -08:00
Pierre Kancir
47f1a754c5
AP_Math: add some test for vector2 equality test
2016-12-20 14:09:04 +00:00
Pierre Kancir
eae093cd2a
AP_Math: add test for is_equal for int
2016-12-20 14:09:04 +00:00
Pierre Kancir
da49149d19
AP_Math: is_equal correct comparison for integer as epsilon doesn't exist.
...
Credit to Kwikius for the right solution
2016-12-20 14:09:04 +00:00
Pierre Kancir
ce734b5f7b
AP_Math: Remove unecessary check
2016-12-19 14:36:03 +00:00
Pierre Kancir
556993d7f0
AP_Math: Vector2 add == operator for int
2016-12-06 09:31:21 -08:00
Pierre Kancir
6bf1322633
AP_Math: polygon.cpp correct float comparison
2016-12-06 09:31:21 -08:00
Pierre Kancir
79a9e8dfad
AP_Math: Matrix_alg fix implicite cast from bool to float
2016-12-05 12:39:31 -08:00
Pierre Kancir
fb7a00799f
AP_Math: quaternion fix missing return
2016-12-05 10:33:41 -08:00
Andrew Tridgell
a8d10e8c2c
AP_Math: added get_random16()
2016-12-02 09:49:38 +11:00
murata
f9add59b58
Global: Aggregate the same definitions.
...
Global: Aggregate the same definitions.
2016-11-09 11:46:55 -03:00
Andrew Tridgell
b00fd95725
AP_Math: define Vector3l for += op
2016-11-09 17:08:13 +11:00
murata
c808ee2f49
Global: To nullptr from NULL.
...
RC_Channel: To nullptr from NULL.
AC_Fence: To nullptr from NULL.
AC_Avoidance: To nullptr from NULL.
AC_PrecLand: To nullptr from NULL.
DataFlash: To nullptr from NULL.
SITL: To nullptr from NULL.
GCS_MAVLink: To nullptr from NULL.
DataFlash: To nullptr from NULL.
AP_Compass: To nullptr from NULL.
Global: To nullptr from NULL.
Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
Mathieu OTHACEHE
152edf7189
Global: remove mode line from headers
...
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Jonathan Challinger
80d9092993
AP_Math: remove rotateXY and rotateXYinv
2016-10-13 10:02:14 +11:00
Lucas De Marchi
ae53920e5b
build: don't build examples with old build system
...
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file. Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11:00
Lucas De Marchi
0d4caa3ccc
AP_Math: remove declaration of not implemented functions
2016-08-03 00:16:35 -03:00
Murilo Belluzzo
70942472d3
AP_Math: Matrix: Change deallocator to match allocator used
2016-08-03 00:09:11 -03:00
Lucas De Marchi
7b7e73680f
AP_Math: add USEC_PER_MSEC
2016-07-30 00:55:28 -03:00
Peter Barker
2047d53470
Math: move closest_point in from AC_Avoid
2016-07-25 20:24:37 +09:00
Peter Barker
779f78d471
AP_Math: vector3 perpendicular function
2016-07-25 20:24:37 +09:00
Peter Barker
f6cb0ffb6f
AP_Math: add Vector2f perpendicular
...
Add closest_distance_between_radial_and_point function
2016-07-25 20:24:37 +09:00
Peter Barker
b6d0b028c3
AP_Math: add operator[] to Vector2
2016-07-25 20:24:37 +09:00
Daniel Ricketts
249d95b413
AP_Math: add Polygon_outside and Polygon_complete functions
2016-06-25 15:55:55 +09:00
Leonard Hall
e0eecd56b2
AP_Math: use is_zero and float constants
2016-06-24 16:16:34 +09:00
Leonard Hall
7f933140c7
AP_Math: small formatting fix to quaternion rotation_matrix
...
No functional change
2016-06-24 16:16:33 +09:00