TVM  0.9.4
DynamicFunction.h
Go to the documentation of this file.
1 
3 #pragma once
4 
5 #include <tvm/api.h>
6 
7 #include <tvm/Robot.h>
8 
10 
11 #include <tvm/robot/enums.h>
14 
15 #include <RBDyn/FD.h>
16 
17 namespace tvm
18 {
19 
20 class ControlProblem;
21 
22 namespace robot
23 {
24 
25 namespace internal
26 {
27 
46 {
47 public:
49  DISABLE_OUTPUTS(Output::JDot)
50  SET_UPDATES(DynamicFunction, Jacobian, B)
51 
52 
54 
70  bool addContact(ContactPtr contact, bool linearize, double mu, unsigned int nrGen);
71 
77  void removeContact(const Contact::Id & id);
78 
84  sva::ForceVecd contactForce(const Contact::Id & id) const;
85 
92  void addPositiveLambdaToProblem(ControlProblem & problem);
93 
94 protected:
95  void updateb();
96 
97  RobotPtr robot_;
98 
101  {
104 
107 
115  std::vector<tvm::VariablePtr> forces_;
116 
118  std::function<sva::ForceVecd(const ForceContact &)> force_;
119 
121  Eigen::MatrixXd force_jac_;
122  Eigen::MatrixXd full_jac_;
123 
125  std::function<void(ForceContact &, DynamicFunction &)> updateJacobians_;
126  };
127  std::vector<ForceContact> contacts_;
128 
130 
131  void addContact_(const Contact::View & contact, bool linearize, double mu, unsigned int nrGen, double dir);
132 
133  std::vector<ForceContact>::iterator getContact(const Contact::Id & id);
134  std::vector<ForceContact>::const_iterator getContact(const Contact::Id & id) const;
135 };
136 
137 } // namespace internal
138 
139 } // namespace robot
140 
141 } // namespace tvm
#define SET_UPDATES(SelfT,...)
Definition: AbstractNode.h:138
#define DISABLE_OUTPUTS(...)
Definition: Outputs.h:118
#define TVM_DLLAPI
Definition: api.h:35
Definition: ControlProblem.h:33
Definition: LinearFunction.h:62
Definition: Contact.h:28
Definition: DynamicFunction.h:46
std::vector< ForceContact >::const_iterator getContact(const Contact::Id &id) const
std::vector< ForceContact > contacts_
Definition: DynamicFunction.h:127
std::vector< ForceContact >::iterator getContact(const Contact::Id &id)
void addContact_(const Contact::View &contact, bool linearize, double mu, unsigned int nrGen, double dir)
std::shared_ptr< Contact > ContactPtr
Definition: Contact.h:130
Definition: Clock.h:12
std::shared_ptr< Robot > RobotPtr
Definition: defs.h:62
Definition: Contact.h:32
Definition: Contact.h:60
std::function< sva::ForceVecd(const ForceContact &)> force_
Definition: DynamicFunction.h:118
bool linearized_
Definition: DynamicFunction.h:106
std::vector< tvm::VariablePtr > forces_
Definition: DynamicFunction.h:115
Contact::Id id_
Definition: DynamicFunction.h:103
std::function< void(ForceContact &, DynamicFunction &)> updateJacobians_
Definition: DynamicFunction.h:125
Eigen::MatrixXd force_jac_
Definition: DynamicFunction.h:121
Eigen::MatrixXd full_jac_
Definition: DynamicFunction.h:122