1 #include "CovTransformPose.hh"
3 #include <Base/Math/Vector3.hh>
4 #include <Base/Math/Matrix.hh>
5 #include <Geometry/RMatrix.hh>
6 #include <Base/Geometry/Quaternion.hh>
11 CovTransformPose::CovTransformPose()
16 int CovTransformPose::
29 for (
unsigned int i = 0; i < 3; i++) src[i] = posQ[i];
30 for (
unsigned int i = 0; i < 4; i++) src[i+3] = rotQ[i];
34 if (Transform(src, covQ, dst, covE) != 0) {
35 BIASERR(
"Error in Unscented Transform!");
39 for (
unsigned int i = 0; i < 3; i++) posE[i] = dst[i];
40 for (
unsigned int i = 0; i < 3; i++) rotE[i] = dst[i+3];
49 int CovTransformPose::
62 for (
unsigned int i = 0; i < 3; i++) src[i] = posE[i];
63 for (
unsigned int i = 0; i < 3; i++) src[i+3] = rotE[i];
67 if (Transform(src, covE, dst, covQ) != 0) {
68 BIASERR(
"Error in Unscented Transform!");
72 for (
unsigned int i = 0; i < 3; i++) posQ[i] = dst[i];
73 for (
unsigned int i = 0; i < 4; i++) rotQ[i] = dst[i+3];
83 int CovTransformPose::
101 for (
unsigned int i = 0; i < 3; i++) {
102 src[i] = inputPos[i];
103 src[i+7] = translate[i];
105 for (
unsigned int i = 0; i < 4; i++) {
106 src[i+3] = inputRot[i];
107 src[i+10] = rotate[i];
114 for (
unsigned int i = 0; i < 7; i++) {
115 for (
unsigned int j = 0; j < 7; j++) {
116 srcCov[i][j] = inputCov[i][j];
117 srcCov[i+7][j+7] = transformCov[i][j];
122 if (Transform(src, srcCov, dst, dstCov) != 0) {
123 BIASERR(
"Error in Unscented Transform!");
127 for (
unsigned int i = 0; i < 3; i++) resultPos[i] = dst[i];
128 for (
unsigned int i = 0; i < 4; i++) resultRot[i] = dst[i+3];
139 int CovTransformPose::
155 for (
unsigned int i = 0; i < 3; i++) src[i] = point3D[i];
156 for (
unsigned int i = 0; i < 3; i++) src[i+3] = translate[i];
157 for (
unsigned int i = 0; i < 4; i++) src[i+6] = rotate[i];
162 for (
unsigned int i = 0; i < 3; i++) {
163 for (
unsigned int j = 0; j < 3; j++) {
164 srcCov[i][j] = cov3D[i][j];
167 for (
unsigned int i = 0; i < 7; i++) {
168 for (
unsigned int j = 0; j < 7; j++) {
169 srcCov[i+3][j+3] = transformCov[i][j];
177 if (Transform(src, srcCov, dst, dstCov) != 0) {
178 BIASERR(
"Error in Unscented Transform!");
182 for (
unsigned int i = 0; i < 3; i++) resultPoint3D[i] = dst[i];
183 for (
unsigned int i = 0; i < 3; i++) {
184 for (
unsigned int j = 0; j < 3; j++) {
185 resultCov3D[i][j] = dstCov[i][j];
197 int CovTransformPose::
212 double xPhi, yPhi, zPhi;
215 BIASERR(
"Error in matrix decomposition!");
221 for (
unsigned int i=0; i<3; i++) dst[i] = src[i];
236 q.
SetZYX(src[3], src[4], src[5]);
240 for (
unsigned int i=0; i<3; i++) dst[i] = src[i];
242 for (
unsigned int i=0; i<4; i++) dst[i+3] = q[i];
260 for (
unsigned int i = 0; i < 3; i++) dst[i] = resC[i];
262 for (
unsigned int i = 0; i < 4; i++) dst[i+3] = resQ[i];
278 for (
unsigned int i = 0; i < 3; i++) dst[i] = resX[i];
284 BIASERR(
"We should't end up here!!!");
int GetRotationAnglesZYX(double &PhiX, double &PhiY, double &PhiZ) const
Get Euler angles for this rotation matrix in order ZYX.
Subscript num_cols() const
int SetFromQuaternion(const Quaternion< ROTATION_MATRIX_TYPE > &q)
Set rotation matrix from a quaternion.
int SetZYX(QUAT_TYPE radX, QUAT_TYPE radY, QUAT_TYPE radZ)
Sets quaternion as concatenated rotations around x,y,z-axis; this = q_z * q_y * q_x (BIAS-RMatrix con...
int MultVec(const Vector3< QUAT_TYPE > &vec, Vector3< QUAT_TYPE > &res) const
rotates the given Vector qith the quaternion ( q v q* ) the resulting vector is given in res ...
Vector< T > & newsize(Subscript N)
Subscript num_rows() const
void MakeSymmetric()
componentwise: this = 0.5(this + this^T) yields symmetric matrix only allowed for square shaped matri...