MomentumFunction.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/Momentum.h>
8 
9 #include <mc_rbdyn/fwd.h>
10 
11 #include <tvm/function/abstract/Function.h>
12 
13 #include <SpaceVecAlg/SpaceVecAlg>
14 
15 namespace mc_tvm
16 {
17 
25 struct MC_TVM_DLLAPI MomentumFunction : tvm::function::abstract::Function
26 {
27  SET_UPDATES(MomentumFunction, Value, Velocity, Jacobian, NormalAcceleration, JDot)
28 
29 
33  MomentumFunction(const mc_rbdyn::Robot & robot);
34 
36  void reset();
37 
39  inline const sva::ForceVecd & momentum() const noexcept { return momentum_; }
40 
42  inline void momentum(const sva::ForceVecd & momentum) noexcept { momentum_ = momentum; }
43 
45  inline const Eigen::Vector6d & refVel() const noexcept { return refVel_; }
46 
48  inline void refVel(const Eigen::Vector6d & refVel) noexcept { refVel_ = refVel; }
49 
51  inline const Eigen::Vector6d & refAccel() const noexcept { return refAccel_; }
52 
54  inline void refAccel(const Eigen::Vector6d & refAccel) noexcept { refAccel_ = refAccel; }
55 
57  inline const mc_tvm::Momentum & algo() const noexcept { return momentumAlgo_; }
58 
59 private:
60  mc_tvm::Momentum & momentumAlgo_;
61  sva::ForceVecd momentum_;
62  Eigen::Vector6d refVel_;
63  Eigen::Vector6d refAccel_;
64 
65  void updateValue();
66  void updateVelocity();
67  void updateJacobian();
68  void updateNormalAcceleration();
69  void updateJDot();
70 };
71 
72 } // namespace mc_tvm
mc_tvm::Momentum
Definition: Momentum.h:26
mc_tvm::MomentumFunction::refAccel
void refAccel(const Eigen::Vector6d &refAccel) noexcept
Definition: MomentumFunction.h:54
MC_TVM_DLLAPI
#define MC_TVM_DLLAPI
Definition: api.h:47
mc_rbdyn::Robot
Definition: Robot.h:62
mc_tvm::MomentumFunction::refVel
void refVel(const Eigen::Vector6d &refVel) noexcept
Definition: MomentumFunction.h:48
mc_tvm
Definition: CollisionFunction.h:15
mc_tvm::MomentumFunction::algo
const mc_tvm::Momentum & algo() const noexcept
Definition: MomentumFunction.h:57
mc_tvm::MomentumFunction::momentum
const sva::ForceVecd & momentum() const noexcept
Definition: MomentumFunction.h:39
Momentum.h
mc_tvm::MomentumFunction::refVel
const Eigen::Vector6d & refVel() const noexcept
Definition: MomentumFunction.h:45
fwd.h
mc_tvm::MomentumFunction::refAccel
const Eigen::Vector6d & refAccel() const noexcept
Definition: MomentumFunction.h:51
mc_tvm::MomentumFunction
Definition: MomentumFunction.h:25
mc_tvm::MomentumFunction::momentum
void momentum(const sva::ForceVecd &momentum) noexcept
Definition: MomentumFunction.h:42