Skip to content
Snippets Groups Projects
Commit 77acba5c authored by Médéric Fourmy's avatar Médéric Fourmy
Browse files

Exp Log IMU Lie test passing

parent 40f18270
No related branches found
No related tags found
No related merge requests found
...@@ -382,7 +382,7 @@ inline Matrix<typename D1::Scalar, 11, 1> betweenStates(const MatrixBase<D1>& x1 ...@@ -382,7 +382,7 @@ inline Matrix<typename D1::Scalar, 11, 1> betweenStates(const MatrixBase<D1>& x1
template<typename D1, typename D2, typename D3> template<typename D1, typename D2, typename D3>
inline void QandPmat(const MatrixBase<D1>& th, MatrixBase<D2>& Q, MatrixBase<D3>& P){ inline void QandPmat(const MatrixBase<D1>& th, MatrixBase<D2>& Q, MatrixBase<D3>& P){
// See equations 29-31 humanoids fourmy 19 // See equations 29-31 humanoids fourmy 19
// th = omega * dt // th = omega * dt is elt of the IMU Lie group tangent space
MatrixSizeCheck<3, 1>::check(th); MatrixSizeCheck<3, 1>::check(th);
MatrixSizeCheck<3, 3>::check(Q); MatrixSizeCheck<3, 3>::check(Q);
MatrixSizeCheck<3, 3>::check(P); MatrixSizeCheck<3, 3>::check(P);
...@@ -399,7 +399,7 @@ inline void QandPmat(const MatrixBase<D1>& th, MatrixBase<D2>& Q, MatrixBase<D3> ...@@ -399,7 +399,7 @@ inline void QandPmat(const MatrixBase<D1>& th, MatrixBase<D2>& Q, MatrixBase<D3>
Matrix<typename D1::Scalar, 3, 1> u = th / thn; Matrix<typename D1::Scalar, 3, 1> u = th / thn;
Matrix<typename D1::Scalar, 3, 3> ux = skew(u); Matrix<typename D1::Scalar, 3, 3> ux = skew(u);
Q = Id + Q = Id
+ ((1 - cos(thn))/thn)*ux + ((1 - cos(thn))/thn)*ux
+ ((thn - sin(thn))/(thn*thn))*(ux*ux); + ((thn - sin(thn))/(thn*thn))*(ux*ux);
...@@ -429,13 +429,9 @@ Matrix<typename Derived::Scalar, 11, 1> exp_IMU(const MatrixBase<Derived>& d_in) ...@@ -429,13 +429,9 @@ Matrix<typename Derived::Scalar, 11, 1> exp_IMU(const MatrixBase<Derived>& d_in)
Matrix<typename Derived::Scalar, 3, 3> Q; Matrix<typename Derived::Scalar, 3, 3> Q;
Matrix<typename Derived::Scalar, 3, 3> P; Matrix<typename Derived::Scalar, 3, 3> P;
QandPmat(do_in, Q, P); QandPmat(do_in, Q, P);
std::cout << "Q" << std::endl;
std::cout << Q << std::endl;
std::cout << "P" << std::endl;
std::cout << P << std::endl;
dp = Q*dp_in + P*dv_in*dt_in; dp = Q*dp_in + P*dv_in*dt_in;
dv = Q*dp_in; dv = Q*dv_in;
dq = exp_q(do_in); dq = exp_q(do_in);
dt = dt_in; dt = dt_in;
...@@ -451,7 +447,7 @@ Matrix<typename Derived::Scalar, 10, 1> log_IMU(const MatrixBase<Derived>& delta ...@@ -451,7 +447,7 @@ Matrix<typename Derived::Scalar, 10, 1> log_IMU(const MatrixBase<Derived>& delta
Map<const Matrix<typename Derived::Scalar, 3, 1> > dp_in ( & delta_in(0) ); Map<const Matrix<typename Derived::Scalar, 3, 1> > dp_in ( & delta_in(0) );
Map<const Quaternion<typename Derived::Scalar> > dq_in ( & delta_in(3) ); Map<const Quaternion<typename Derived::Scalar> > dq_in ( & delta_in(3) );
Map<const Matrix<typename Derived::Scalar, 3, 1> > dv_in ( & delta_in(7) ); Map<const Matrix<typename Derived::Scalar, 3, 1> > dv_in ( & delta_in(7) );
const typename Derived::Scalar& dt_in = delta_in(9); const typename Derived::Scalar& dt_in = delta_in(10);
Map<Matrix<typename Derived::Scalar, 3, 1> > dp_ret ( & ret(0) ); Map<Matrix<typename Derived::Scalar, 3, 1> > dp_ret ( & ret(0) );
Map<Matrix<typename Derived::Scalar, 3, 1> > do_ret ( & ret(3) ); Map<Matrix<typename Derived::Scalar, 3, 1> > do_ret ( & ret(3) );
Map<Matrix<typename Derived::Scalar, 3, 1> > dv_ret ( & ret(6) ); Map<Matrix<typename Derived::Scalar, 3, 1> > dv_ret ( & ret(6) );
...@@ -468,6 +464,7 @@ Matrix<typename Derived::Scalar, 10, 1> log_IMU(const MatrixBase<Derived>& delta ...@@ -468,6 +464,7 @@ Matrix<typename Derived::Scalar, 10, 1> log_IMU(const MatrixBase<Derived>& delta
dv_ret = Qinv*dv_in; dv_ret = Qinv*dv_in;
dt_ret = dt_in; dt_ret = dt_in;
std::cout << "Log ret" << ret.transpose() << std::endl;
return ret; return ret;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment