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
mc_tvm::Momentum
Definition: Momentum.h:26
mc_tvm::Momentum::jacobian
const Eigen::MatrixXd & jacobian() const noexcept
Definition: Momentum.h:54
mc_tvm::Momentum::JDot
const Eigen::MatrixXd & JDot() const noexcept
Definition: Momentum.h:56
mc_tvm::Momentum::momentum
const auto & momentum() const noexcept
Definition: Momentum.h:48
MC_TVM_DLLAPI
#define MC_TVM_DLLAPI
Definition: api.h:47
mc_tvm::Momentum::robot
const Robot & robot() const noexcept
Definition: Momentum.h:58
mc_tvm::Robot
Definition: Robot.h:48
mc_tvm
Definition: CollisionFunction.h:15
CoM.h
mc_tvm::Momentum::velocity
const auto & velocity() const noexcept
Definition: Momentum.h:50
mc_tvm::Momentum::normalAcceleration
const auto & normalAcceleration() const noexcept
Definition: Momentum.h:52
mc_tvm::Robot::robot
const mc_rbdyn::Robot & robot() const
Definition: Robot.h:76
mc_tvm::CoM
Definition: CoM.h:33
mc_tvm::Momentum::robot
Robot & robot() noexcept
Definition: Momentum.h:60