Momentum.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2022 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 #include <mc_tvm/CoM.h>
8 
9 #include <RBDyn/Momentum.h>
10 
11 namespace mc_tvm
12 {
13 
26 struct MC_TVM_DLLAPI Momentum : public tvm::graph::abstract::Node<Momentum>
27 {
28  SET_OUTPUTS(Momentum, Momentum, Jacobian, Velocity, NormalAcceleration, JDot)
29  SET_UPDATES(Momentum, Momentum, Jacobian, NormalAcceleration, JDot)
30 
31  friend struct Robot;
32 
33 private:
34  struct NewMomentumToken
35  {
36  };
37 
38 public:
46  Momentum(NewMomentumToken, CoM & com);
47 
48  inline const auto & momentum() const noexcept { return momentum_; }
49 
50  inline const auto & velocity() const noexcept { return velocity_; }
51 
52  inline const auto & normalAcceleration() const noexcept { return normalAcceleration_; }
53 
54  inline const Eigen::MatrixXd & jacobian() const noexcept { return mat_.matrix(); }
55 
56  inline const Eigen::MatrixXd & JDot() const noexcept { return mat_.matrixDot(); }
57 
58  inline const Robot & robot() const noexcept { return com_.robot(); }
59 
60  inline Robot & robot() noexcept { return com_.robot(); }
61 
62 private:
63  CoM & com_;
64  rbd::CentroidalMomentumMatrix mat_;
65 
66  sva::ForceVecd momentum_;
67  void updateMomentum();
68 
69  sva::ForceVecd velocity_ = sva::ForceVecd::Zero();
70 
71  sva::ForceVecd normalAcceleration_;
72  void updateNormalAcceleration();
73 
74  void updateJacobian();
75 
76  void updateJDot();
77 };
78 
79 } // namespace mc_tvm
#define MC_TVM_DLLAPI
Definition: api.h:47
Definition: CollisionFunction.h:16
Definition: CoM.h:34
Definition: Momentum.h:27
const auto & velocity() const noexcept
Definition: Momentum.h:50
Momentum(NewMomentumToken, CoM &com)
const Robot & robot() const noexcept
Definition: Momentum.h:58
const auto & momentum() const noexcept
Definition: Momentum.h:48
const Eigen::MatrixXd & JDot() const noexcept
Definition: Momentum.h:56
Robot & robot() noexcept
Definition: Momentum.h:60
const auto & normalAcceleration() const noexcept
Definition: Momentum.h:52
const Eigen::MatrixXd & jacobian() const noexcept
Definition: Momentum.h:54
Definition: Robot.h:49
const mc_rbdyn::Robot & robot() const
Definition: Robot.h:76