PostureFunction.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/api.h>
8 
9 #include <mc_rbdyn/fwd.h>
10 
11 #include <tvm/function/IdentityFunction.h>
12 
13 namespace mc_tvm
14 {
15 
17 class MC_TVM_DLLAPI PostureFunction : public tvm::function::IdentityFunction
18 {
19 public:
20  SET_UPDATES(PostureFunction, Value, Velocity)
21 
22 
27  PostureFunction(const mc_rbdyn::Robot & robot);
28 
30  void reset();
31 
39  void posture(const std::string & j, const std::vector<double> & q);
40 
42  void posture(const std::vector<std::vector<double>> & p);
43 
45  const std::vector<std::vector<double>> & posture() const noexcept { return posture_; }
46 
48  inline const Eigen::VectorXd & refVel() const noexcept { return refVel_; }
49 
51  inline void refVel(const Eigen::VectorXd & vel) noexcept
52  {
53  assert(refVel_.size() == vel.size());
54  refVel_ = vel;
55  }
56 
58  inline const Eigen::VectorXd & refAccel() const noexcept { return refAccel_; }
59 
61  inline void refAccel(const Eigen::VectorXd & acc) noexcept
62  {
63  assert(refAccel_.size() == acc.size());
64  refAccel_ = acc;
65  normalAcceleration_ = -acc;
66  }
67 
68 protected:
69  void updateValue_() override;
70  void updateVelocity_() override;
71 
73 
75  std::vector<std::vector<double>> posture_;
76 
78  int j0_;
79 
81  Eigen::VectorXd refVel_;
82 
84  Eigen::VectorXd refAccel_;
85 };
86 
87 } // namespace mc_tvm
mc_tvm::PostureFunction::refVel
const Eigen::VectorXd & refVel() const noexcept
Definition: PostureFunction.h:48
MC_TVM_DLLAPI
#define MC_TVM_DLLAPI
Definition: api.h:47
mc_rbdyn::Robot
Definition: Robot.h:62
mc_tvm::PostureFunction::refAccel
void refAccel(const Eigen::VectorXd &acc) noexcept
Definition: PostureFunction.h:61
mc_tvm
Definition: CollisionFunction.h:15
mc_tvm::PostureFunction::refVel
void refVel(const Eigen::VectorXd &vel) noexcept
Definition: PostureFunction.h:51
mc_tvm::PostureFunction::j0_
int j0_
Definition: PostureFunction.h:78
mc_tvm::PostureFunction::refAccel
const Eigen::VectorXd & refAccel() const noexcept
Definition: PostureFunction.h:58
fwd.h
mc_tvm::PostureFunction::refVel_
Eigen::VectorXd refVel_
Definition: PostureFunction.h:81
mc_tvm::PostureFunction
Definition: PostureFunction.h:17
mc_tvm::PostureFunction::refAccel_
Eigen::VectorXd refAccel_
Definition: PostureFunction.h:84
api.h
mc_tvm::PostureFunction::posture
const std::vector< std::vector< double > > & posture() const noexcept
Definition: PostureFunction.h:45
mc_tvm::PostureFunction::robot_
const mc_rbdyn::Robot & robot_
Definition: PostureFunction.h:72
mc_tvm::PostureFunction::posture_
std::vector< std::vector< double > > posture_
Definition: PostureFunction.h:75