26 template <
size_t NJOINTS,
typename SCALAR =
double>
30 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
32 static const size_t NDOF = NJOINTS + 6;
33 static const size_t NSTATE = 2 * (NJOINTS + 6);
103 return joints().getPositions();
112 return joints().getVelocities();
117 state_vector_quat_t state;
119 state <<
base().
pose().getRotationQuaternion().w(),
base().
pose().getRotationQuaternion().x(),
120 base().
pose().getRotationQuaternion().y(),
base().
pose().getRotationQuaternion().z(),
121 base().
pose().position().toImplementation(),
joints().getPositions(),
130 coordinate_vector_t q;
131 q <<
base().
pose().getEulerAnglesXyz().getUnique().toImplementation(),
132 base().
pose().position().toImplementation(),
joints().getPositions();
138 coordinate_vector_t q;
139 q <<
base().
pose().getEulerAnglesXyz().toImplementation(),
base().
pose().position().toImplementation(),
146 coordinate_vector_t dq;
147 dq <<
base().
velocities().getRotationalVelocity().toImplementation(),
154 state_vector_euler_t state;
163 state_vector_euler_t state;
172 base().
pose().setFromRotationQuaternion(kindr::RotationQuaternion<SCALAR>(state.template head<4>()));
173 base().
pose().position().toImplementation() = state.template segment<3>(4);
174 joints().getPositions() = state.template segment<NJOINTS>(7);
175 base().
velocities().getRotationalVelocity().toImplementation() = state.template segment<3>(7 + NJOINTS);
176 base().
velocities().getTranslationalVelocity().toImplementation() = state.template segment<3>(10 + NJOINTS);
177 joints().getVelocities() = state.template tail<NJOINTS>();
182 base().
pose().setFromEulerAnglesXyz(state.template head<3>());
183 base().
pose().position().toImplementation() = state.template segment<3>(3);
184 joints().getPositions() = state.template segment<NJOINTS>(6);
185 base().
velocities().getRotationalVelocity().toImplementation() = state.template segment<3>(6 + NJOINTS);
186 base().
velocities().getTranslationalVelocity().toImplementation() = state.template segment<3>(9 + NJOINTS);
187 joints().getVelocities() = state.template tail<NJOINTS>();
JointState< NJOINTS, SCALAR > jointState_
Definition: RBDState.h:213
void setRandom()
Definition: RigidBodyState.h:67
RBDState(const RigidBodyState_t &baseState, const JointState< NJOINTS, SCALAR > &jointState)
Definition: RBDState.h:49
state_vector_euler_t toStateVectorEulerXyz() const
Definition: RBDState.h:161
STORAGE_TYPE
the orientation can either be stored as EulerAngles or as quaternion.
Definition: RigidBodyPose.h:38
RigidBodyPose_t & basePose()
get base pose
Definition: RBDState.h:67
RBDState(typename RigidBodyPose_t::STORAGE_TYPE storage=RigidBodyPose_t::EULER)
Definition: RBDState.h:42
JointState< NJOINTS, SCALAR >::JointPositionBlock jointPositions()
get joint positions
Definition: RBDState.h:99
RigidBodyState_t & base()
get base states
Definition: RBDState.h:63
void fromStateVectorRaw(const state_vector_euler_t &state)
Definition: RBDState.h:191
RigidBodyPose< SCALAR > & pose()
return the rigid body pose
Definition: RigidBodyState.h:38
joint state and joint velocity
Definition: JointState.h:21
const RigidBodyState_t & base() const
get constant base states
Definition: RBDState.h:65
virtual ~RBDState()=default
RigidBodyVelocities< SCALAR > & velocities()
return the rigid body velocities
Definition: RigidBodyState.h:42
coordinate_vector_t toCoordinatePositionUnique() const
Definition: RBDState.h:128
joint states and base states
Definition: RBDState.h:27
bool operator!=(const RBDState &other) const
Definition: RBDState.h:56
coordinate_vector_t toCoordinatePosition() const
Definition: RBDState.h:136
static const size_t NSTATE_QUAT
Definition: RBDState.h:34
bool isApprox(const RBDState &rhs, const SCALAR &tol=1e-10)
Definition: RBDState.h:57
CppAD::AD< CppAD::cg::CG< double > > SCALAR
kindr::Velocity< SCALAR, 3 > & baseLinearVelocity()
get base linear velocity
Definition: RBDState.h:86
const kindr::LocalAngularVelocity< SCALAR > & baseLocalAngularVelocity() const
get constant base local angular velocity
Definition: RBDState.h:80
Representation of Rigid Body Velocities, currently just a typedef.
Definition: RigidBodyVelocities.h:20
static const size_t NSTATE
Definition: RBDState.h:33
void setIdentity()
Definition: RigidBodyState.h:61
kindr::LocalAngularVelocity< SCALAR > & baseLocalAngularVelocity()
get base local angular velocity
Definition: RBDState.h:75
ct::core::StateVector< NSTATE, SCALAR > state_vector_euler_t
Definition: RBDState.h:39
tpl::RigidBodyVelocities< SCALAR > & baseVelocities()
get base velocities
Definition: RBDState.h:71
void fromStateVectorEulerXyz(const state_vector_euler_t &state)
Definition: RBDState.h:180
JointState< NJOINTS, SCALAR >::JointPositionBlock jointVelocities()
get joint velocities
Definition: RBDState.h:108
Definition: RigidBodyPose.h:41
void fromStateVectorQuaternion(const state_vector_quat_t &state)
Definition: RBDState.h:170
state_vector_quat_t toStateVectorQuaternion() const
Definition: RBDState.h:115
const kindr::Velocity< SCALAR, 3 > & baseLinearVelocity() const
get constant base local angular velocity
Definition: RBDState.h:88
ct::core::StateVector< NDOF, SCALAR > coordinate_vector_t
Definition: RBDState.h:40
const JointState< NJOINTS, SCALAR > & joints() const
get constant joint states
Definition: RBDState.h:96
bool isApprox(const RigidBodyState &rhs, const double &tol=1e-10)
numerically comparing two rigid body states
Definition: RigidBodyState.h:46
virtual void setDefault()
Definition: RBDState.h:192
RigidBodyState_t baseState_
Definition: RBDState.h:212
RBDState(const RBDState &other)
Definition: RBDState.h:48
static EIGEN_MAKE_ALIGNED_OPERATOR_NEW const size_t NDOF
Definition: RBDState.h:32
state_vector_euler_t toStateVectorEulerXyzUnique() const
Definition: RBDState.h:152
JointState< NJOINTS, SCALAR > & joints()
get joint states
Definition: RBDState.h:94
const RigidBodyPose_t & basePose() const
get constant base states
Definition: RBDState.h:69
ct::core::StateVector< NSTATE_QUAT, SCALAR > state_vector_quat_t
Definition: RBDState.h:38
const JointState< NJOINTS, SCALAR >::JointPositionBlockConst jointPositions() const
get constant joint positions
Definition: RBDState.h:101
void setZero()
Definition: RBDState.h:198
coordinate_vector_t toCoordinateVelocity() const
Definition: RBDState.h:144
void setRandom()
Definition: RBDState.h:204
void fromStateVectorRaw(const state_vector_quat_t &state)
Definition: RBDState.h:190
const tpl::RigidBodyVelocities< SCALAR > & baseVelocities() const
get constant base velocities
Definition: RBDState.h:73
const JointState< NJOINTS, SCALAR >::JointPositionBlockConst jointVelocities() const
get constant joint velocities
Definition: RBDState.h:110