JointsSelectorFunction.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/abstract/Function.h>
12 
13 namespace mc_tvm
14 {
15 
16 // FIXME Needs to implement active DoF selection
17 
19 class MC_TVM_DLLAPI JointsSelectorFunction : public tvm::function::abstract::Function
20 {
21 public:
22  SET_UPDATES(JointsSelectorFunction, Jacobian, JDot)
23 
24  using Function = tvm::function::abstract::Function;
25 
37  static std::unique_ptr<JointsSelectorFunction> ActiveJoints(Function * f,
38  const mc_rbdyn::Robot & robot,
39  const std::vector<std::string> & activeJoints);
40 
52  static std::unique_ptr<JointsSelectorFunction> InactiveJoints(Function * f,
53  const mc_rbdyn::Robot & robot,
54  const std::vector<std::string> & inactiveJoints);
55 
56  inline const Eigen::VectorXd & value() const override { return f_->value(); }
57 
58  inline const Eigen::VectorXd & velocity() const override { return f_->velocity(); }
59 
60  inline const Eigen::VectorXd & normalAcceleration() const override { return f_->normalAcceleration(); }
61 
62 protected:
76  JointsSelectorFunction(Function * f,
77  tvm::VariablePtr variable,
78  const std::vector<std::pair<Eigen::DenseIndex, Eigen::DenseIndex>> & activeIndex);
79 
80 protected:
81  void updateJacobian();
82  void updateJDot();
83 
85  tvm::VariablePtr variable_;
86  std::vector<std::pair<Eigen::DenseIndex, Eigen::DenseIndex>> activeIndex_;
87 };
88 
89 } // namespace mc_tvm
mc_tvm::JointsSelectorFunction::variable_
tvm::VariablePtr variable_
Definition: JointsSelectorFunction.h:85
mc_tvm::JointsSelectorFunction::activeIndex_
std::vector< std::pair< Eigen::DenseIndex, Eigen::DenseIndex > > activeIndex_
Definition: JointsSelectorFunction.h:86
MC_TVM_DLLAPI
#define MC_TVM_DLLAPI
Definition: api.h:47
mc_tvm::Robot
Definition: Robot.h:48
mc_tvm
Definition: CollisionFunction.h:15
mc_tvm::JointsSelectorFunction
Definition: JointsSelectorFunction.h:19
mc_tvm::JointsSelectorFunction::normalAcceleration
const Eigen::VectorXd & normalAcceleration() const override
Definition: JointsSelectorFunction.h:60
fwd.h
mc_tvm::JointsSelectorFunction::velocity
const Eigen::VectorXd & velocity() const override
Definition: JointsSelectorFunction.h:58
mc_tvm::JointsSelectorFunction::f_
Function * f_
Definition: JointsSelectorFunction.h:84
mc_tvm::JointsSelectorFunction::value
const Eigen::VectorXd & value() const override
Definition: JointsSelectorFunction.h:56
std
Definition: Contact.h:66
api.h
mc_rbdyn
Definition: generic_gripper.h:14
mc_tvm::JointsSelectorFunction::Function
tvm::function::abstract::Function Function
Definition: JointsSelectorFunction.h:24