- 3.0.2 rigid body dynamics module.
JointAcceleration.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 
16 template <size_t NJOINTS, typename SCALAR = double>
18 {
19 public:
20  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
21 
22  enum NDOFS
23  {
24  NDOFS = NJOINTS
25  };
26 
27  typedef Eigen::Matrix<SCALAR, NJOINTS, 1> Acceleration;
28 
30  JointAcceleration(const Eigen::Matrix<SCALAR, NJOINTS, 1>& acceleration) : acceleration_(acceleration) {}
32  size_t getSize() { return NJOINTS; }
34  SCALAR& operator()(size_t i) { return acceleration_(i); }
36  Eigen::Matrix<SCALAR, NJOINTS, 1>& getAcceleration() { return acceleration_; }
38  const Eigen::Matrix<SCALAR, NJOINTS, 1>& getAcceleration() const { return acceleration_; }
40  void setAcceleration(const Eigen::Matrix<SCALAR, NJOINTS, 1>& acceleration) { acceleration_ = acceleration; }
42  void setZero() { acceleration_.setZero(); }
44  {
46  jstate.setZero();
47  return jstate;
48  }
49 
50 protected:
51  Acceleration acceleration_;
52 };
53 
54 } // namespace rbd
55 } // namespace ct
size_t getSize()
get number of degrees of freedom
Definition: JointAcceleration.h:32
void setAcceleration(const Eigen::Matrix< SCALAR, NJOINTS, 1 > &acceleration)
set joint acceleration
Definition: JointAcceleration.h:40
static JointAcceleration< NJOINTS, SCALAR > Zero()
Definition: JointAcceleration.h:43
Acceleration acceleration_
Definition: JointAcceleration.h:51
JointAcceleration()
Definition: JointAcceleration.h:29
joint acceleration
Definition: JointAcceleration.h:17
CppAD::AD< CppAD::cg::CG< double > > SCALAR
Eigen::Matrix< SCALAR, NJOINTS, 1 > Acceleration
Definition: JointAcceleration.h:27
SCALAR & operator()(size_t i)
get i-th joint acceleration
Definition: JointAcceleration.h:34
JointAcceleration(const Eigen::Matrix< SCALAR, NJOINTS, 1 > &acceleration)
Definition: JointAcceleration.h:30
const Eigen::Matrix< SCALAR, NJOINTS, 1 > & getAcceleration() const
get constant joint acceleration
Definition: JointAcceleration.h:38
void setZero()
set joint acceleration to zero
Definition: JointAcceleration.h:42
NDOFS
Definition: JointAcceleration.h:22
Eigen::Matrix< SCALAR, NJOINTS, 1 > & getAcceleration()
get joint acceleration
Definition: JointAcceleration.h:36