398 Commits

Author SHA1 Message Date
Daniel Agar
b8568a89db Euler: improve quaternion constructor 2021-04-14 22:56:03 -04:00
Daniel Agar
1d0e7f1ca1
Matrix: use naive per element copy instead of memcpy call 2021-04-14 15:44:18 -04:00
Daniel Agar
1344ce06fd
Euler: simplify DCM constructor
Co-authored-by: Matthias Grob <maetugr@gmail.com>
2021-04-14 15:40:24 -04:00
Daniel Agar
3679f7fd51 add double precision alias declarations and remove typedefs 2021-02-11 12:40:54 -05:00
Julian Kent
977cf52322 Ignore debug line in code coverage 2021-01-22 17:30:00 +01:00
Julian Kent
4837316f9b Fix small inconsistencies and compiler warnings 2021-01-22 17:30:00 +01:00
Julian Kent
d540ca5de2 Coerce default epsilon values to Type 2021-01-13 10:17:09 +01:00
Julian Kent
054f8b12f4 Use a single inverse implementation for a single matrix size 2021-01-05 09:02:09 +01:00
Julian Kent
15e54ceda1 Rework rank-detection tolerance in pseudoinverse 2020-12-18 12:07:19 +01:00
Julian Kent
d9a5e3dec2 Add test for new cutoff threshold 2020-12-18 12:07:19 +01:00
JacobCrabill
ea43303c1c test/vector3: Add test for scalar +/- operators 2020-12-17 18:05:46 +01:00
JacobCrabill
158409abce Vector3f: Add operator+/- for scalars 2020-12-17 18:05:46 +01:00
Mitchell-Lee-93
a504b6e881 precision of tol for float has been changed 2020-11-04 10:00:55 +01:00
Julian Oes
ce6b10b99a Fix clang-tidy warnings
This comes from PX4 CI.
2020-08-27 17:42:42 +02:00
Kamil Ritz
13f092a30f sparse quadratic form 2020-08-26 19:45:05 +02:00
Julian Oes
3a5bfb2bd1
matrix: inline to prevent multiple definitions (#147)
Without inline we get multiple definitions during linking.
2020-08-25 12:58:04 +02:00
Julian Oes
e101edc0e7
Matrix: fix warning if M == N (#146)
This fixes the warning appearing with GCC 10.2:

../../src/lib/matrix/matrix/Matrix.hpp:481:34: error: logical ‘and’ of equal expressions [-Werror=logical-op]
  481 |         for (size_t i = 0; i < M && i < N; i++) {
      |

I would prefered something with if constexpr but we don't have that yet
in because we're using C++14.
2020-08-24 14:19:43 +02:00
Morten Fyhn Amundsen
cd8ad1584c
Make wrap() work with integer types (#145)
* Make wrap() work with integers
2020-08-24 10:49:12 +02:00
kamilritz
25c0455348 comply with Firmware style requirements 2020-08-10 10:13:40 +02:00
kritz
f981cea2ae
add possibility to iterate over SparseVector data at runtime (#143) 2020-08-09 09:44:49 +02:00
kamilritz
e714a28c83 use size_t instead of int in sparseVector 2020-08-07 19:45:02 +02:00
kritz
18699416b0
SparseVector (#140)
* Add SparseVector

temp

* Add gtest

* Some reworking of the sparse concept

* Change type of M from int to size_t

* Add const modifier

* Add needed declaration for accessing elements of _indices

* Add norm_squared, norm, longerThan

* Add test for all sparse vector functions

* Add missing const to slice's norm_squared, norm and longerThan

* Construction from Vector<M> and carray[N]

* try to fix ci

Co-authored-by: Julian Kent <julian@auterion.com>
2020-08-07 18:44:48 +02:00
kamilritz
6ed5dbc2db Construct Vector from Slice<1,M> alias row() 2020-08-06 16:15:05 +02:00
Matthias Grob
a126be0882 attitude test: refactoring to avoid identity quaternion confusion 2020-07-20 18:44:08 +02:00
Matthias Grob
572bafb01f Quaternion: use template type for division by two 2020-07-20 18:44:08 +02:00
Matthias Grob
242b38ee9e Quaternion: remove deprecated axis_angle conversions 2020-07-20 18:44:08 +02:00
Matthias Grob
7a3009f7a3 Remove asserts for unsigned integer >= 0
GCC 10 gives a warning
"comparison of unsigned expression in ‘>= 0’ is always true"
for these asserts since checking if an unsigned integer cannot
be negative and hence the statement gets droped.
2020-07-20 15:10:49 +02:00
Matthias Grob
0fd99c59f1 Switch operator() to return a const reference 2020-07-17 10:43:34 +02:00
kamilritz
8a59b463f2 Quaternion: Use template type instead of single hardcoded type 2020-07-17 10:37:18 +02:00
Julian Kent
9a30828a0a Add explicit matrix + scalar test 2020-06-30 10:37:10 -04:00
Julian Kent
f3cf615023 Do += -= and scalar *= /= in place 2020-06-30 10:37:10 -04:00
kamilritz
f529358e9a Add missing const modifier 2020-06-28 14:24:49 +02:00
kamilritz
674bd99f3b Add operator* and operator/ for slice with type 2020-06-12 11:34:09 +02:00
Nicolas MARTIN
38b3acce96 fix conjugate_inversed comment 2020-06-11 16:17:28 +02:00
Matthias Grob
2bee0d078c Quaternion: refactor multiplication to matrix multiplication style
Most often the multiplication in convention descriptions and papers is
described in matrix multiplication style like this:
q · p := Q(q)p

Q(q) :=
[q0 −q1 −q2 −q3]
[q1 q0 −q3 q2]
[q2 q3 q0 −q1]
[q3 −q2 q1 q0]

I'm just rearanging the terms such that it's easily comparable with
these definitions additional to it being clearly described by
documenting we use the hamilton convention.
2020-05-06 13:17:02 +02:00
kamilritz
d613055462 Add more assignment operators for slices 2020-04-07 09:12:17 +02:00
Matthias Grob
976ada411b Matrix: min max comments and test style 2020-03-23 09:46:07 +01:00
Matthias Grob
fa7153ecfb Matrix: omit min max nan case with same result
I observed this during review in
https://github.com/PX4/Matrix/pull/105/files#r348386226
2020-03-23 09:46:07 +01:00
Matthias Grob
a32892926c Matrix: capture stdout for print() test
I want to switch the print() function back to use printf()
such that it's fully compatible with all (embedded) platforms.

To still test the print function I'm capturing stdout into a file
such that the print() function can stay unchanged and the result of
the printf()s can be evaluated.
2020-03-12 13:24:08 +01:00
Matthias Grob
c6db357c92 Matrix: correct print buffer size prediction
Apparently printf of %8.8g can result in
8 significant digits + dot + scientific notation e.g. "e+12" = 14 bytes
2020-03-12 10:08:04 +01:00
Matthias Grob
2cca35c8fe AxisAngle: call q.imag().norm() for conversion
This is important depending on the platform because norm()
calls matrix::squrt() which dispatches correctly to the implementation
for the used type. Otherwise float squrt()s can get calculated as
double.
2020-03-12 07:35:44 +01:00
kritz
4873dc1c1e
Analytic inverse implementation (#122)
* Add analytic 2x2 matrix inverse

* Add analytical 3x3 matrix inverse
2020-03-04 09:14:04 +01:00
Julian Kent
649c837b6b Use faster but less accurate average 2020-02-25 15:08:17 +01:00
kamilritz
a37b91c96a Type cast remaining integer 2020-01-13 12:21:18 +01:00
Lorenz Meier
3b581fb599 Update .travis.yml
Bring Ubuntu and Mac OS toolchains to latest.
2020-01-01 15:53:50 +01:00
Lorenz Meier
efa5580a67 Update CMakeLists.txt
Remove non-compatible compile option.
2020-01-01 15:53:50 +01:00
Lorenz Meier
20a9e91d44 Fix CMake configuration for coverage tests on Mac OS 2019-12-31 15:54:51 +01:00
kritz
d18be0d0fa Fix AngleAxis constructors (#117) 2019-12-28 17:18:15 -05:00
kritz
e81483a808 Catch quaternion canonical corner cases (#116) 2019-12-18 14:12:47 +01:00
kritz
4f3565da94 Add asserts (#115)
* Add asserts

* Type cast literals

* asserts for indexing vectors

* include assert

* Fix accessing elements outside of slice
2019-12-09 10:21:27 +01:00