- 3.0.2 rigid body dynamics module.
RigidBodyVelocities.h
Go to the documentation of this file.
1 /**********************************************************************************************************************
2 This file is part of the Control Toolbox (https://github.com/ethz-adrl/control-toolbox), copyright by ETH Zurich.
3 Licensed under the BSD-2 license (see LICENSE file in main directory)
4 **********************************************************************************************************************/
5 
6 #pragma once
7 
8 namespace ct {
9 namespace rbd {
10 namespace tpl {
11 
16 // unfortunately kindr stores linear velocity first and not rotational velocity.
17 // so we cannot use it directly. Instead we privately inherit and make the "safe"
18 // methods public and "override" the others.
19 template <typename SCALAR = double>
20 class RigidBodyVelocities : private kindr::TwistLinearVelocityLocalAngularVelocity<SCALAR>
21 {
22 public:
23  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
24 
25  typedef Eigen::Matrix<SCALAR, 6, 1> Vector6;
26 
27  using kindr::TwistLinearVelocityLocalAngularVelocity<SCALAR>::getTranslationalVelocity;
28  using kindr::TwistLinearVelocityLocalAngularVelocity<SCALAR>::getRotationalVelocity;
29  using kindr::TwistLinearVelocityLocalAngularVelocity<SCALAR>::setZero;
30 
31  Vector6 getVector() const
32  {
33  Vector6 vector6;
34  vector6 << getRotationalVelocity().toImplementation(), getTranslationalVelocity().toImplementation();
35  return vector6;
36  }
37 
38  void setVector(const Vector6& vector6)
39  {
40  getRotationalVelocity().toImplementation() = vector6.template head<3>();
41  getTranslationalVelocity().toImplementation() = vector6.template tail<3>();
42  }
43 
44 private:
45 };
46 
47 } // namespace tpl
48 
49 // convenience typedef (required)
51 
52 } /* namespace rbd */
53 } /* namespace ct */
void setVector(const Vector6 &vector6)
Definition: RigidBodyVelocities.h:38
Representation of Rigid Body Velocities, currently just a typedef.
Definition: RigidBodyVelocities.h:20
Vector6 getVector() const
Definition: RigidBodyVelocities.h:31
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Eigen::Matrix< SCALAR, 6, 1 > Vector6
Definition: RigidBodyVelocities.h:25
tpl::RigidBodyVelocities< double > RigidBodyVelocities
Definition: RigidBodyVelocities.h:50