| 
    XBotInterface
    2.4.1
    
   XBotInterface provides a generic API to model and control a robot. 
   | 
 
 
 
 
Go to the documentation of this file.
   14 #ifndef __X_BOT_CORE_MODEL_HPP__ 
   15 #define __X_BOT_CORE_MODEL_HPP__ 
   19 #include <srdfdom_advr/model.h> 
   20 #include <urdf_parser/urdf_parser.h> 
   21 #include <kdl_parser/kdl_parser.hpp> 
   28 #include <yaml-cpp/yaml.h> 
   30 #define CHAIN_PER_GROUP 1 
   45     std::string urdf_string, srdf_string, joint_map_string;
 
   46     std::string srdf_path;
 
   47     urdf::ModelInterfaceSharedPtr urdf_model;
 
   55     std::map<std::string, std::vector<int>> robot;
 
   61     std::map<std::string, std::vector<std::string>> robot_string;
 
   67     std::map<std::string, int> ft_sensors;
 
   73     std::map<std::string, int> imu_sensors;
 
   79     std::map<std::string, int> hands;
 
   97     std::vector<std::string> chain_names;
 
  100     std::vector<std::string> ordered_chain_names;
 
  103     std::vector<std::string> legs_names;
 
  106     std::vector<std::string> arms_names;
 
  109     std::vector<std::string> disabled_joint_names;
 
  112     std::map<std::string, std::vector<std::string>> enabled_joints_in_chains;
 
  115     std::map<std::string, std::vector<std::string>> disabled_joints_in_chains;
 
  125     urdf::ModelInterfaceSharedPtr loadURDF(
const std::string& filename);
 
  144     bool get_joints_in_chain( std::string base_link, 
 
  145                               std::string tip_link,
 
  146                               std::vector<std::string>& enabled_joints_in_chain,
 
  147                               std::vector<std::string>& disabled_joints_in_chain);
 
  151     void parseJointMap(
const YAML::Node& joint_map);
 
  194         return ordered_chain_names;
 
  205     bool init(
const std::string& urdf_filename, 
const std::string& srdf_filename,
 
  206               const std::string& joint_map_config);
 
  218               const std::string& joint_map_config);
 
  227     bool init(
const std::string& urdf_filename, 
const std::string& srdf_filename);
 
  237     virtual std::map<std::string, std::vector<int>> 
get_robot(
void) 
final 
  259         return rid2joint.find(rId) != rid2joint.end() ? rid2joint[rId] : 
""; 
 
  264         return joint2rid.find(joint_name) != joint2rid.end() ? joint2rid[joint_name] : 0;
 
  364 #endif //__X_BOT_CORE_MODEL_HPP__ 
  
std::map< std::string, int > Joint2RidMap
Definition: XBotCoreModel.h:38
 
~XBotCoreModel()
Definition: XBotCoreModel.h:358
 
void generate_robot(void)
dynamically generate the robot as a map {chain_name} -> {vector of enabled joints}
Definition: XBotCoreModel.cpp:416
 
const std::string & get_srdf_string() const
Get the robot SRDF as a string.
Definition: XBotCoreModel.cpp:491
 
bool init_from_string(const std::string &urdf, const std::string &srdf, const std::string &joint_map_config)
initialization function for the model: it loads the URDF and parses the SRDF
Definition: XBotCoreModel.cpp:296
 
XBotCoreModel(void)
Definition: XBotCoreModel.h:155
 
const std::vector< std::string > & get_ordered_chain_names(void) const
getter for the alphabetically ordered chain names vector
Definition: XBotCoreModel.h:192
 
bool get_disabled_joints_in_chain(std::string chain_name, std::vector< std::string > &disabled_joints) const
getter for the disabled joints vector in the chain
Definition: XBotCoreModel.cpp:255
 
virtual std::map< std::string, int > get_ft_sensors(void) final
Definition: XBotCoreModel.h:242
 
virtual std::map< std::string, int > get_hands() final
Definition: XBotCoreModel.h:252
 
bool get_enabled_joints_in_chain(std::string chain_name, std::vector< std::string > &enabled_joints) const
getter for the enabled joints vector in the chain
Definition: XBotCoreModel.cpp:242
 
const std::vector< std::string > & get_legs_chain() const
Get the legs chain names ordered as in the SRDF.
Definition: XBotCoreModel.cpp:501
 
TBD.
Definition: IXBotModel.h:29
 
virtual std::map< std::string, std::vector< int > > get_robot(void) final
Definition: XBotCoreModel.h:237
 
bool check_joint_limits() const
Definition: XBotCoreModel.cpp:511
 
virtual std::string rid2Joint(int rId) final
Definition: XBotCoreModel.h:257
 
virtual int joint2Rid(std::string joint_name) final
Definition: XBotCoreModel.h:262
 
int get_joint_num() const
get the number of joint in the robot
Definition: XBotCoreModel.cpp:486
 
Definition: XBotCoreModel.h:40
 
std::map< int, std::string > Rid2JointMap
Definition: XBotCoreModel.h:37
 
bool init(const std::string &urdf_filename, const std::string &srdf_filename, const std::string &joint_map_config)
initialization function for the model: it loads the URDF and parses the SRDF
Definition: XBotCoreModel.cpp:339
 
const std::vector< std::string > & get_chain_names(void) const
getter for the chain names vector
Definition: XBotCoreModel.h:182
 
const std::string & get_urdf_string() const
Get the robot URDF as a string.
Definition: XBotCoreModel.cpp:496
 
void get_enabled_joint_names(std::vector< std::string > &joint_names) const
get the vector of the enabled joint names of the whole robot
Definition: XBotCoreModel.cpp:464
 
bool get_enabled_joint_ids_in_chain(std::string chain_name, std::vector< int > &joint_ids) const
get the vector of the joint ids of the requested chain
Definition: XBotCoreModel.cpp:442
 
const std::vector< std::string > & get_arms_chain() const
Get the arms chain names ordered as in the SRDF.
Definition: XBotCoreModel.cpp:506
 
void get_enabled_joint_ids(std::vector< int > &joint_ids) const
get the vector of the enabled joint ids of the whole robot
Definition: XBotCoreModel.cpp:455
 
urdf::ModelInterfaceSharedPtr get_urdf_model(void) const
getter for the URDF ModelInterface
Definition: XBotCoreModel.h:162
 
virtual std::map< std::string, int > get_imu_sensors() final
Definition: XBotCoreModel.h:247
 
Definition: IXBotModel.h:20
 
KDL::Tree get_robot_tree(void)
getter for the KDL robot tree
Definition: XBotCoreModel.h:172