wbc
RobotModelConfig.hpp
Go to the documentation of this file.
1#ifndef ROBOTMODELCONFIG_HPP
2#define ROBOTMODELCONFIG_HPP
3
4#include <base/samples/RigidBodyStateSE3.hpp>
5#include <base/NamedVector.hpp>
6
7namespace wbc{
8
10public:
12
13 }
15
16 }
17 ActiveContact(int active, double mu, double wx, double wy) : active(active), mu(mu), wx(wx), wy(wy){
18
19 }
20 int active;
21 double mu;
22 double wx;
23 double wy;
24};
25
26class ActiveContacts : public base::NamedVector<ActiveContact>{
27public:
29 uint nac = 0;
30 for(auto e : elements){
31 if(e.active) nac++;
32 }
33 return nac;
34 }
35};
36
41public:
43 floating_base = false;
44 type = "pinocchio";
45 }
46 RobotModelConfig(const std::string& file_or_string,
47 const bool floating_base = false,
49 const std::string& submechanism_file = "") :
52 type("pinocchio"),
55
56 }
57 void validate(){
58 if(file_or_string.empty())
59 throw std::runtime_error("Invalid Robot model config. File path or string must not be empty!");
60 if(type == "hyrodyn" && submechanism_file.empty())
61 throw std::runtime_error("Invalid Robot model config. If you choose 'hyrodyn' as type, submechanism_file must not be empty!");
62 if(floating_base && contact_points.empty())
63 throw std::runtime_error("Invalid Robot model config. If floating_base is set to true, contact_points must not be empty!");
64 }
65
67 std::string file_or_string;
69 std::string submechanism_file;
71 std::string type;
78
79 std::vector<std::string> joint_blacklist;
80};
81
82}
83#endif // ROBOTMODELCONFIG_HPP
Definition RobotModelConfig.hpp:9
double wx
Definition RobotModelConfig.hpp:22
ActiveContact(int active, double mu, double wx, double wy)
Definition RobotModelConfig.hpp:17
ActiveContact(int active, double mu)
Definition RobotModelConfig.hpp:14
double mu
Definition RobotModelConfig.hpp:21
double wy
Definition RobotModelConfig.hpp:23
ActiveContact()
Definition RobotModelConfig.hpp:11
int active
Definition RobotModelConfig.hpp:20
Definition RobotModelConfig.hpp:26
uint getNumberOfActiveContacts() const
Definition RobotModelConfig.hpp:28
Definition ContactsAccelerationConstraint.cpp:3
Robot Model configuration class.
Definition RobotModelConfig.hpp:40
bool floating_base
Definition RobotModelConfig.hpp:75
std::vector< std::string > joint_blacklist
Definition RobotModelConfig.hpp:79
RobotModelConfig(const std::string &file_or_string, const bool floating_base=false, const ActiveContacts &contact_points=ActiveContacts(), const std::string &submechanism_file="")
Definition RobotModelConfig.hpp:46
RobotModelConfig()
Definition RobotModelConfig.hpp:42
ActiveContacts contact_points
Definition RobotModelConfig.hpp:77
std::string submechanism_file
Definition RobotModelConfig.hpp:69
void validate()
Definition RobotModelConfig.hpp:57
std::string type
Definition RobotModelConfig.hpp:71
std::string file_or_string
Definition RobotModelConfig.hpp:67