76 Commits

Author SHA1 Message Date
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
kritz
5cbcf6035a Set Matrix's col amd row to single value (#113) 2019-12-05 18:16:14 +01:00
Daniel Agar
cd185c995b add braces around statements and cleanup formatting (#107) 2019-11-13 10:41:38 -08:00
kritz
38e966cea1 Add min, max, constrain function for Matrix (#105)
* Add min, max, constrain function for Matrix

* Set individual elements to nan in constrain

* Deal with NANs
2019-11-12 18:57:12 +01:00
Julian Kent
9f46483951 Fix GCC-4.8 bug 2019-11-04 11:11:30 -05:00
Julian Kent
215203fc6f
Automatic Differentiation 'Dual' Type (#100)
* Dual numbers initial implementation

* Add test coverage, with partial derivative example

* Add Jacobian test, fix small issues

* Improve test to demonstrate non-square jacobian

* Better naming for collectReals/Derivatives

* Improve comments

* Potential GCC 4.8 bug workaround

* Add fallback workaround for non-IEEE float platforms
2019-10-23 12:07:51 +02:00
Julian Kent
92d1c8761e
More features: longerThan, norm, copyTo and slice on a Slice (#97)
* Allow slices of slices, add longerThan to Vector/Slice
2019-10-03 13:47:36 +02:00
Matthias Grob
740324cf1e Make all array constructors explicit (#99)
* Make all array constructors explicit

to avoid accidental implicit casts like e.g.
Vector3f v = 0;
assigning nullpointer content.
2019-10-03 13:38:51 +02:00
Matthias Grob
973999a4d3 Fix some template type conversions and style 2019-09-23 10:59:12 +02:00
Matthias Grob
33a629105c Matrix: add proper print function testing
Before the print function was just implicitly called somewhere
and that's why we had 100% line coverage. With this we have actual
testing of the functions.
2019-09-18 09:59:50 +02:00
Matthias Grob
5844b0e46e Implement one float equality check and use it everywhere 2019-09-18 09:59:50 +02:00
James Goppert
60c9c99dcc Fix type for division. 2019-09-17 11:08:00 -04:00
Julian Kent
b4714e2ed2 Don't lose array sizes in copyTo 2019-09-17 15:09:12 +02:00
Julian Kent
51d2f9f0dc Remove direct access to internal data 2019-09-16 21:58:32 -04:00
Julian Kent
b817e8677d Add helpers based on Slice: row(), col(), xy() 2019-09-16 16:11:08 +02:00
Julian Kent
82d565f4d9 Add support for Slice to Matrix, SquareMatrix, Vector 2019-09-16 16:11:08 +02:00
Matthias Grob
31450c407c Matrix: use existing print() if isEqual test fails 2019-09-05 10:19:47 +02:00
Martina Rivizzigno
cc084e0791 matrix: add method to check all values are nan (#82) 2019-08-26 19:27:58 +02:00
Oskar Weigl
5ccfa74c72 Fix const error 2019-03-08 19:17:40 +00:00
Oskar Weigl
eea6b59973 Implement slice as copy loop 2019-03-08 19:17:40 +00:00
TSC21
96cb9ab146 add NaN value set for Matrix; add return of URT of a matrix 2019-02-24 17:14:05 +00:00
Matthias Grob
9c0acfba36 Matrix: remove unsafe copyToRaw method
It used a pointer and could therefore not do correct type checking
for index out of bound or struct memebr order.
Has to be considered unsafe and bad practise.
We should switch to arrays as representation for vectors
inside the messages instead of foo_x, foo_y, foo_z fields.
2018-11-20 16:39:44 +00:00
Daniel Agar
dc3af80977 constructors use array size rather than pointers 2018-08-31 08:11:02 +02:00
Daniel Agar
f1bee775a0 use default constructors and skip unnecessary initialization 2018-08-31 08:11:02 +02:00
James Goppert
d142ac234c Fix coverage and bug in matrix equal test. 2018-03-28 00:09:01 -04:00
Daniel Agar
50446a55c8 Matrix add == and != operators 2018-03-27 15:05:22 -04:00
Matthias Grob
41ad2bdea5 Matrix: added copyToRaw method to allow copying to a pointer
because most uORB messages still contain all components of a vector one by one after each other
2017-11-17 09:30:56 +01:00
Matthias Grob
1dffd5930b Matrix: add copyTo copying data to an array and copyToColumnMajor which does the same but with column-major order
same functionality explicitly for quaternions can be deleted
2017-11-16 04:42:54 +01:00
Matthias Grob
0527471a52 Matrix: adjust buffer size calculation to account for additional characters
Note: If the buffer is too small there's no memory corruption because of the snprintf limit but part of the output gets missing.
2017-10-17 17:37:23 +02:00
Nate Weibley
471e96ff6f Provide const dataptr access 2017-03-23 20:22:45 -07:00
Nate Weibley
2ad3ec46b9 Mark simple min, max, abs methods as const 2017-03-23 20:22:45 -07:00
Nate Weibley
66e1b406b8 Remove artifical need to virtualize dtors 2017-03-23 20:22:45 -07:00
Pavel Kirienko
552dad40a1 Fixed inclusions in matrix/ 2017-03-17 12:18:39 -04:00
Daniel Agar
cfa68c2196 clang-tidy trivial cleanup 2017-02-24 20:47:41 -05:00
Daniel Agar
f00edc9442 update to astyle 2.06 and fix formatting 2017-02-24 20:47:41 -05:00
James Goppert
63aea23f9e Add cholesky decomp, Closes #30, and dynamic print buf 2017-02-03 17:54:16 -05:00
James Goppert
0eb8aa0c0b Support more of mathlib function for easier swap in px4. 2016-08-16 19:03:54 -04:00
James Goppert
558777f34c Fix formatting. 2016-08-16 12:43:42 -04:00
James Goppert
262a715d90 Fix some when building in px4. 2016-08-16 12:37:41 -04:00
James Goppert
4f13809420 Added axis angle accessors, removed == operator. 2016-08-16 11:05:01 -04:00
James Goppert
e6a6b4680c Use quaternion multiplaction for quaternion derivative. 2016-08-16 01:03:23 -04:00
jaredkw
3509329f30 Define M_PI float, change logical and to && 2016-05-11 18:35:05 -04:00
MaEtUgR
b2eb4d13d8 Matrix.setCol off by one bug fixed
The Column Vector you are copying from, only has one Column and it is indexed by 0 not 1.
I also completed the unit test stub that would have found this bug.
2016-05-05 13:18:51 +02:00
Matthias Grob
65679fbcbb Features and fixes
* added the trace function for a SquareMatrix

* added Vector3.hat() and it's counterpart Dcm.vee()
for skewsymskew symmetric matrix operations in relation to the cross product
see https://en.wikipedia.org/wiki/Hat_operator

* Matrix::write_string produced runtime errors when I used it in PX4 posix simulation, i simplified it

* a Matrix3f is a SquareMatrix

* added tests for SquareMatrix.trace, Vector3.hat and Dcm.vee

* added a test for quaternion initialisation from array

* preventing buffer overflows in Matrix.write_string method
2016-04-28 15:16:36 -04:00
James Goppert
07fba8322a Fix for effective cpp. 2016-03-18 20:56:41 -04:00
James Goppert
0e14e11183 Added support for attitude_estimator_q functions. 2016-03-15 06:35:13 -04:00
mcsauder
46c83a8c18 Correct a few indexing copy/paste errors that likely previously only functioned properly on square matrices. 2016-02-25 18:51:28 -07:00
James Goppert
95e3d7d6ce Added set function. 2016-02-16 14:54:15 -05:00
James Goppert
5a01e6c939 Added slice function for matrix. 2016-02-16 12:22:08 -05:00
James Goppert
a92d5c1338 Removed unneeded headers. 2016-01-24 02:44:25 -05:00