mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 11:43:33 +08:00
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
This commit is contained in:
committed by
James Goppert
parent
07fba8322a
commit
65679fbcbb
@@ -16,6 +16,9 @@ namespace matrix
|
||||
template <typename Type, size_t M>
|
||||
class Vector;
|
||||
|
||||
template<typename Type>
|
||||
class Dcm;
|
||||
|
||||
template<typename Type>
|
||||
class Vector3 : public Vector<Type, 3>
|
||||
{
|
||||
@@ -61,6 +64,21 @@ public:
|
||||
return (*this).cross(b);
|
||||
}
|
||||
|
||||
Dcm<Type> hat() const { // inverse to Dcm.vee() operation
|
||||
const Vector3 &v(*this);
|
||||
Dcm<Type> A;
|
||||
A(0,0) = 0;
|
||||
A(0,1) = -v(2);
|
||||
A(0,2) = v(1);
|
||||
A(1,0) = v(2);
|
||||
A(1,1) = 0;
|
||||
A(1,2) = -v(0);
|
||||
A(2,0) = -v(1);
|
||||
A(2,1) = v(0);
|
||||
A(2,2) = 0;
|
||||
return A;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef Vector3<float> Vector3f;
|
||||
|
||||
Reference in New Issue
Block a user