Go to the documentation of this file.
22 #include <RBDyn/parsers/common.h>
24 #include <sch/S_Object/S_Object.h>
56 struct VisualMap :
public std::map<std::string, std::vector<rbd::parsers::Visual>>
66 using std::map<std::string, std::vector<rbd::parsers::Visual>>::operator=;
71 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
82 using bounds_t = std::vector<std::map<std::string, std::vector<double>>>;
100 using jerkBounds_t = std::vector<std::map<std::string, std::vector<double>>>;
118 static constexpr
double DEFAULT_PERCENT_VMAX = 0.25;
124 static constexpr
unsigned int DEFAULT_OVER_COMMAND_LIMIT_ITER_N = 5;
130 double actualCommandDiffTrigger = DEFAULT_ACTUAL_COMMAND_DIFF_TRIGGER,
131 double releaseSafetyOffset = DEFAULT_RELEASE_OFFSET,
132 unsigned int overCommandLimitIterN = DEFAULT_OVER_COMMAND_LIMIT_ITER_N)
133 : percentVMax(percentVMax), actualCommandDiffTrigger(actualCommandDiffTrigger),
134 releaseSafetyOffset(releaseSafetyOffset), overCommandLimitIterN(overCommandLimitIterN)
154 Gripper(
const std::string & name,
const std::vector<std::string> & joints,
bool reverse_limits);
157 Gripper(
const std::string & name,
158 const std::vector<std::string> & joints,
163 Gripper(
const std::string & name,
164 const std::vector<std::string> & joints,
167 const std::vector<Mimic> & mimics);
178 inline const Safety *
safety()
const {
return hasSafety_ ? &safety_ :
nullptr; }
181 inline const std::vector<Mimic> *
mimics()
const {
return hasMimics_ ? &mimics_ :
nullptr; }
185 bool hasSafety_ =
false;
189 bool hasMimics_ =
false;
191 std::vector<Mimic> mimics_;
193 Gripper(
const std::string & name,
194 const std::vector<std::string> & joints,
196 const Safety * safety,
197 const std::vector<Mimic> * mimics);
211 FrameDescription(
const std::string & n,
const std::string & p,
const sva::PTransformd & pt,
bool baked =
false)
212 : name(n), parent(p), X_p_f(pt), baked(baked)
242 :
RobotModule(path, name, path +
"/urdf/" + name +
".urdf")
258 RobotModule(
const std::string & path,
const std::string & name,
const std::string & urdf_path)
259 : path(path), name(name), urdf_path(urdf_path), rsdf_dir(path +
"/rsdf/" + name), calib_dir(path +
"/calib/" + name),
260 _real_urdf(urdf_path)
265 RobotModule(
const std::string & name,
const rbd::parsers::ParserResult & res);
276 void init(
const rbd::parsers::ParserResult & res);
289 const std::vector<std::map<std::string, std::vector<double>>> &
bounds()
const {
return _bounds; }
302 return _accelerationBounds;
314 const std::vector<std::map<std::string, std::vector<double>>> &
jerkBounds()
const {
return _jerkBounds; }
327 return _torqueDerivativeBounds;
340 const std::map<std::string, std::vector<double>> &
stance()
const {
return _stance; }
355 const std::map<std::string, std::pair<std::string, std::string>> &
convexHull()
const {
return _convexHull; }
370 const std::map<std::string, std::pair<std::string, S_ObjectPtr>> &
collisionObjects()
const
372 return _collisionObjects;
386 const std::map<std::string, std::pair<std::string, std::string>> &
stpbvHull()
const {
return _stpbvHull; }
394 const std::map<std::string, sva::PTransformd> &
collisionTransforms()
const {
return _collisionTransforms; }
400 const std::vector<Flexibility> &
flexibility()
const {
return _flexibility; }
406 const std::vector<ForceSensor> &
forceSensors()
const {
return _forceSensors; }
418 const std::vector<JointSensor> &
jointSensors()
const {
return _jointSensors; }
449 const std::vector<Gripper> &
grippers()
const {
return _grippers; }
475 return _lipmStabilizerConfig;
485 void boundsFromURDF(
const rbd::parsers::Limits & limits);
494 void expand_stance();
502 void make_default_ref_joint_order();
511 inline const std::vector<std::string> &
parameters()
const {
return _parameters; }
550 inline const std::vector<FrameDescription> &
frames() const noexcept {
return _frames; }
578 std::map<std::string, std::vector<double>>
_stance;
580 std::map<std::string, std::pair<std::string, std::string>>
_convexHull;
584 std::map<std::string, std::pair<std::string, std::string>>
_stpbvHull;
612 std::array<double, 7> _default_attitude = {{1., 0., 0., 0., 0., 0., 0.}};
663 auto compareMimics = [&]()
665 auto lmimics = lhs.
mimics();
666 auto rmimics = rhs.
mimics();
667 if(lmimics ==
nullptr && rmimics ==
nullptr) {
return true; }
668 if(lmimics ==
nullptr || rmimics ==
nullptr) {
return false; }
669 return *lmimics == *rmimics;
671 auto compareSafety = [&]()
673 auto lsafety = lhs.
safety();
674 auto rsafety = rhs.
safety();
675 if(lsafety ==
nullptr && rsafety ==
nullptr) {
return true; }
676 if(lsafety ==
nullptr || rsafety ==
nullptr) {
return false; }
677 return *lsafety == *rsafety;
686 # define ROBOT_MODULE_API __declspec(dllexport)
689 # define ROBOT_MODULE_API __attribute__((visibility("default")))
691 # define ROBOT_MODULE_API
std::map< std::string, std::vector< double > > _stance
Definition: RobotModule.h:578
std::vector< mc_rbdyn::Collision > _commonSelfCollisions
Definition: RobotModule.h:604
Simplify access to values hold within a JSON file.
Definition: Configuration.h:165
std::string name
Definition: RobotModule.h:217
std::map< std::string, std::pair< std::string, std::string > > _convexHull
Definition: RobotModule.h:580
std::vector< JointSensor > _jointSensors
Definition: RobotModule.h:598
unsigned int overCommandLimitIterN
Definition: RobotModule.h:150
std::vector< std::string > _parameters
Definition: RobotModule.h:616
accelerationBounds_t _accelerationBounds
Definition: RobotModule.h:572
std::vector< Gripper > _grippers
Definition: RobotModule.h:606
Definition: RobotModule.h:112
Configuration for mc_rbdyn::RobotConverter.
Definition: RobotConverterConfig.h:15
MC_RBDYN_DLLAPI DevicePtrVector & operator=(const DevicePtrVector &v)
MC_RBDYN_DLLAPI bool check_module_compatibility(const RobotModule &lhs, const RobotModule &rhs)
std::shared_ptr< sch::S_Object > S_ObjectPtr
Definition: RobotModule.h:35
std::vector< std::string > _ref_joint_order
Definition: RobotModule.h:610
const std::map< std::string, std::pair< std::string, std::string > > & convexHull() const
Definition: RobotModule.h:355
std::string _real_urdf
Definition: RobotModule.h:622
Definition: RobotModule.h:41
RobotConverterConfig controlToCanonicalConfig
Definition: RobotModule.h:524
Safety(double percentVMax, double actualCommandDiffTrigger=DEFAULT_ACTUAL_COMMAND_DIFF_TRIGGER, double releaseSafetyOffset=DEFAULT_RELEASE_OFFSET, unsigned int overCommandLimitIterN=DEFAULT_OVER_COMMAND_LIMIT_ITER_N)
Definition: RobotModule.h:129
VisualMap & operator=(const VisualMap &v)=default
const std::map< std::string, std::vector< double > > & stance() const
Definition: RobotModule.h:340
std::vector< std::string > _canonicalParameters
Definition: RobotModule.h:618
Springs _springs
Definition: RobotModule.h:600
std::vector< CompoundJointConstraintDescription, Eigen::aligned_allocator< CompoundJointConstraintDescription > > CompoundJointConstraintDescriptionVector
Definition: CompoundJointConstraintDescription.h:33
const std::vector< mc_rbdyn::Collision > & commonSelfCollisions() const
Definition: RobotModule.h:443
std::vector< RobotModule, Eigen::aligned_allocator< RobotModule > > RobotModuleVector
Definition: RobotModule.h:638
Gripper::Safety _gripperSafety
Definition: RobotModule.h:608
std::vector< std::map< std::string, std::vector< double > >> torqueDerivativeBounds_t
Definition: RobotModule.h:109
std::vector< std::string > joints
Definition: RobotModule.h:172
torqueDerivativeBounds_t _torqueDerivativeBounds
Definition: RobotModule.h:576
const std::vector< JointSensor > & jointSensors() const
Definition: RobotModule.h:418
const std::vector< std::string > & canonicalParameters() const
Definition: RobotModule.h:514
const CompoundJointConstraintDescriptionVector & compoundJoints() const
Definition: RobotModule.h:508
FrameDescription(const std::string &n, const std::string &p, const sva::PTransformd &pt, bool baked=false)
Definition: RobotModule.h:211
std::vector< std::map< std::string, std::vector< double > >> accelerationBounds_t
Definition: RobotModule.h:91
const Safety * safety() const
Definition: RobotModule.h:178
const std::map< std::string, sva::PTransformd > & collisionTransforms() const
Definition: RobotModule.h:394
jerkBounds_t _jerkBounds
Definition: RobotModule.h:574
const std::vector< std::string > & parameters() const
Definition: RobotModule.h:511
const std::vector< FrameDescription > & frames() const noexcept
Definition: RobotModule.h:550
DevicePtrVector()=default
const std::vector< std::map< std::string, std::vector< double > > > & torqueDerivativeBounds() const
Definition: RobotModule.h:325
const std::vector< Gripper > & grippers() const
Definition: RobotModule.h:449
std::map< std::string, std::pair< std::string, S_ObjectPtr > > _collisionObjects
Definition: RobotModule.h:582
std::string name
Definition: RobotModule.h:556
const BodySensorVector & bodySensors() const
Definition: RobotModule.h:412
rbd::MultiBody mb
Definition: RobotModule.h:564
Definition: RobotModule.h:69
const DevicePtrVector & devices() const
Definition: RobotModule.h:547
std::vector< FrameDescription > _frames
Definition: RobotModule.h:626
MC_RBDYN_DLLAPI RobotModule::bounds_t urdf_limits_to_bounds(const rbd::parsers::Limits &limits)
Converts limits provided by RBDyn parsers to bounds.
Safety()
Definition: RobotModule.h:127
const std::vector< Mimic > * mimics() const
Definition: RobotModule.h:181
CompoundJointConstraintDescriptionVector _compoundJoints
Definition: RobotModule.h:614
rbd::MultiBodyConfig mbc
Definition: RobotModule.h:566
sva::PTransformd X_p_f
Definition: RobotModule.h:221
const Springs & springs() const
Definition: RobotModule.h:424
mc_rbdyn::lipm_stabilizer::StabilizerConfiguration _lipmStabilizerConfig
Definition: RobotModule.h:620
double releaseSafetyOffset
Definition: RobotModule.h:148
bounds_t _bounds
Definition: RobotModule.h:570
std::map< std::string, std::pair< std::string, std::string > > _stpbvHull
Definition: RobotModule.h:584
DevicePtrVector _devices
Definition: RobotModule.h:624
const std::vector< mc_rbdyn::Collision > & minimalSelfCollisions() const
Definition: RobotModule.h:433
#define MC_RBDYN_DLLAPI
Definition: api.h:50
Definition: RobotModule.h:56
const std::vector< std::map< std::string, std::vector< double > > > & jerkBounds() const
Definition: RobotModule.h:314
bool operator==(const mc_rbdyn::BodySensor &lhs, const mc_rbdyn::BodySensor &rhs)
Definition: BodySensor.h:147
double actualCommandDiffTrigger
Definition: RobotModule.h:146
std::map< std::string, sva::PTransformd > _collisionTransforms
Definition: RobotModule.h:590
std::vector< mc_rbdyn::Collision > _minimalSelfCollisions
Definition: RobotModule.h:602
std::string path
Definition: RobotModule.h:554
std::string urdf_path
Definition: RobotModule.h:558
const std::vector< Flexibility > & flexibility() const
Definition: RobotModule.h:400
std::string name
Definition: RobotModule.h:170
Definition: RobotModule.h:115
RobotModule(const std::string &path, const std::string &name, const std::string &urdf_path)
Definition: RobotModule.h:258
std::vector< std::map< std::string, std::vector< double > >> jerkBounds_t
Definition: RobotModule.h:100
const Gripper::Safety & gripperSafety() const
Definition: RobotModule.h:457
std::vector< BodySensor, Eigen::aligned_allocator< BodySensor > > BodySensorVector
Definition: BodySensor.h:145
const std::map< std::string, std::pair< std::string, std::string > > & stpbvHull() const
Definition: RobotModule.h:386
VisualMap _collision
Definition: RobotModule.h:588
Configuration of the LIPMStabilizer. This configuration is meant to be overriden from the RobotModule...
Definition: StabilizerConfiguration.h:434
std::shared_ptr< RobotModule > RobotModulePtr
Definition: RobotModule.h:629
constexpr double toRad(const double degrees)
Converts degrees to radians.
Definition: constants.h:39
const mc_rbdyn::lipm_stabilizer::StabilizerConfiguration & defaultLIPMStabilizerConfiguration() const
Definition: RobotModule.h:473
const std::vector< ForceSensor > & forceSensors() const
Definition: RobotModule.h:406
Definition: generic_gripper.h:14
const std::array< double, 7 > & default_attitude() const
Definition: RobotModule.h:470
VisualMap _visual
Definition: RobotModule.h:586
const std::vector< std::string > & ref_joint_order() const
Definition: RobotModule.h:464
std::string parent
Definition: RobotModule.h:219
const std::vector< std::map< std::string, std::vector< double > > > & accelerationBounds() const
Definition: RobotModule.h:300
std::vector< ForceSensor > _forceSensors
Definition: RobotModule.h:594
std::string real_urdf() const
Definition: RobotModule.h:544
const std::map< std::string, std::pair< std::string, S_ObjectPtr > > & collisionObjects() const
Definition: RobotModule.h:370
std::vector< Flexibility > _flexibility
Definition: RobotModule.h:592
RobotModule(const std::string &path, const std::string &name)
Definition: RobotModule.h:241
bool reverse_limits
Definition: RobotModule.h:174
std::string rsdf_dir
Definition: RobotModule.h:560
double percentVMax
Definition: RobotModule.h:144
const std::vector< std::map< std::string, std::vector< double > > > & bounds() const
Definition: RobotModule.h:289
std::string calib_dir
Definition: RobotModule.h:562
Definition: RobotModule.h:208
BodySensorVector _bodySensors
Definition: RobotModule.h:596
rbd::MultiBodyGraph mbg
Definition: RobotModule.h:568
std::vector< std::map< std::string, std::vector< double > >> bounds_t
Definition: RobotModule.h:82