pose_estimation
BodyStateMeasurement.hpp
Go to the documentation of this file.
1 #ifndef _POSE_ESTIMATION_BODY_STATE_MEASUREMENT_HPP
2 #define _POSE_ESTIMATION_BODY_STATE_MEASUREMENT_HPP
3 
4 #include <base/Time.hpp>
5 #include <base/samples/RigidBodyState.hpp>
6 #include <Eigen/Core>
7 #include "PoseWithVelocity.hpp"
8 
9 namespace pose_estimation
10 {
11 
13 {
14  static void fromRigidBodyState(const base::samples::RigidBodyState &body_state, PoseWithVelocity &filter_state, PoseWithVelocityCovariance &filter_state_cov)
15  {
16  filter_state.position = TranslationType(body_state.position);
17  filter_state.orientation = RotationType(MTK::SO3<double>(body_state.orientation));
18  filter_state.velocity = VelocityType(body_state.velocity);
19  filter_state.angular_velocity = VelocityType(body_state.angular_velocity);
20 
21  filter_state_cov.setZero();
22  filter_state_cov.block(0, 0, 3, 3) = body_state.cov_position;
23  filter_state_cov.block(3, 3, 3, 3) = body_state.cov_orientation;
24  filter_state_cov.block(6, 6, 3, 3) = body_state.cov_velocity;
25  filter_state_cov.block(9, 9, 3, 3) = body_state.cov_angular_velocity;
26  }
27 
28  static void toRigidBodyState(const PoseWithVelocity &filter_state, const PoseWithVelocityCovariance &filter_state_cov, base::samples::RigidBodyState &body_state)
29  {
30  body_state.position = filter_state.position;
31  body_state.orientation = filter_state.orientation;
32  body_state.velocity = body_state.orientation * filter_state.velocity;
33  body_state.angular_velocity = filter_state.angular_velocity;
34 
35  body_state.cov_position = filter_state_cov.block(0, 0, 3, 3);
36  body_state.cov_orientation = filter_state_cov.block(3, 3, 3, 3);
37  body_state.cov_velocity = filter_state_cov.block(6, 6, 3, 3);
38  body_state.cov_angular_velocity = filter_state_cov.block(9, 9, 3, 3);
39  }
40 };
41 
42 }
43 
44 #endif
ukfom::mtkwrap< MTK::SO3< double > > RotationType
Definition: OrientationState.hpp:15
static void toRigidBodyState(const PoseWithVelocity &filter_state, const PoseWithVelocityCovariance &filter_state_cov, base::samples::RigidBodyState &body_state)
Definition: BodyStateMeasurement.hpp:28
static void fromRigidBodyState(const base::samples::RigidBodyState &body_state, PoseWithVelocity &filter_state, PoseWithVelocityCovariance &filter_state_cov)
Definition: BodyStateMeasurement.hpp:14
Definition: GeographicProjection.hpp:9
Definition: BodyStateMeasurement.hpp:12
ukfom::mtkwrap< RotationType::vect_type > VelocityType
Definition: OrientationState.hpp:16
ukfom::mtkwrap< RotationType::vect_type > TranslationType
Definition: PoseWithVelocity.hpp:15