Crocoddyl
joint.hpp
1 // BSD 3-Clause License
3 //
4 // Copyright (C) 2022, University of Edinburgh, Heriot-Watt University
5 // Copyright note valid unless otherwise stated in individual files.
6 // All rights reserved.
8 
9 #ifndef CROCODDYL_CORE_DATA_JOINT_HPP_
10 #define CROCODDYL_CORE_DATA_JOINT_HPP_
11 
12 #include <boost/shared_ptr.hpp>
13 
14 #include "crocoddyl/core/data-collector-base.hpp"
15 #include "crocoddyl/core/data/actuation.hpp"
16 #include "crocoddyl/core/fwd.hpp"
17 #include "crocoddyl/core/state-base.hpp"
18 
19 namespace crocoddyl {
20 
21 template <typename _Scalar>
23  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
24 
25  typedef _Scalar Scalar;
29  typedef typename MathBase::VectorXs VectorXs;
30  typedef typename MathBase::MatrixXs MatrixXs;
31 
40  JointDataAbstractTpl(boost::shared_ptr<StateAbstract> state,
41  boost::shared_ptr<ActuationModelAbstract> actuation,
42  const std::size_t nu)
43  : tau(actuation->get_nu()),
44  a(state->get_nv()),
45  dtau_dx(actuation->get_nu(), state->get_ndx()),
46  dtau_du(actuation->get_nu(), nu),
47  da_dx(state->get_nv(), state->get_ndx()),
48  da_du(state->get_nv(), nu) {
49  tau.setZero();
50  a.setZero();
51  dtau_dx.setZero();
52  dtau_du.setZero();
53  da_dx.setZero();
54  da_du.setZero();
55  }
56  virtual ~JointDataAbstractTpl() {}
57 
58  VectorXs tau;
59  VectorXs a;
60  MatrixXs dtau_dx;
62  MatrixXs dtau_du;
64  MatrixXs da_dx;
66  MatrixXs da_du;
68 };
69 
70 template <typename Scalar>
72  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
73 
74  DataCollectorJointTpl(boost::shared_ptr<JointDataAbstractTpl<Scalar> > joint)
75  : DataCollectorAbstractTpl<Scalar>(), joint(joint) {}
76  virtual ~DataCollectorJointTpl() {}
77 
78  boost::shared_ptr<JointDataAbstractTpl<Scalar> > joint;
79 };
80 
81 template <typename Scalar>
83  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
84 
92  boost::shared_ptr<ActuationDataAbstractTpl<Scalar> > actuation,
93  boost::shared_ptr<JointDataAbstractTpl<Scalar> > joint)
94  : DataCollectorActuationTpl<Scalar>(actuation), joint(joint) {}
95  virtual ~DataCollectorJointActuationTpl() {}
96 
97  boost::shared_ptr<JointDataAbstractTpl<Scalar> > joint;
98 };
99 
100 } // namespace crocoddyl
101 
102 #endif // CROCODDYL_CORE_DATA_JOINT_HPP_
Abstract class for the actuation-mapping model.
Abstract class for the state representation.
Definition: state-base.hpp:46
EIGEN_MAKE_ALIGNED_OPERATOR_NEW DataCollectorJointActuationTpl(boost::shared_ptr< ActuationDataAbstractTpl< Scalar > > actuation, boost::shared_ptr< JointDataAbstractTpl< Scalar > > joint)
Initialize the joint-actuation data collector.
Definition: joint.hpp:91
VectorXs a
Generalized joint acceleration.
Definition: joint.hpp:59
VectorXs tau
Joint efforts.
Definition: joint.hpp:58
JointDataAbstractTpl(boost::shared_ptr< StateAbstract > state, boost::shared_ptr< ActuationModelAbstract > actuation, const std::size_t nu)
Initialize a joint data structure containing generalized accelerations and joint efforts,...
Definition: joint.hpp:40