8 #ifndef __sot_core_robot_utils_H__ 9 #define __sot_core_robot_utils_H__ 17 #include <pinocchio/fwd.hpp> 19 #include <boost/assign.hpp> 20 #include <boost/property_tree/ptree.hpp> 22 #include <dynamic-graph/linear-algebra.h> 23 #include <dynamic-graph/logger.h> 24 #include <dynamic-graph/signal-helper.h> 48 const std::vector<std::string> &get_mimic_joints();
51 void go_through(boost::property_tree::ptree &pt,
int level,
int stage);
54 boost::property_tree::ptree tree_;
55 std::vector<std::string> mimic_joints_;
56 std::string current_joint_name_;
57 void go_through_full();
64 ForceLimits() : upper(Vector6d::Zero()), lower(Vector6d::Zero()) {}
66 ForceLimits(
const Eigen::VectorXd &l,
const Eigen::VectorXd &u)
67 : upper(u), lower(l) {}
69 void display(std::ostream &os)
const;
78 m_Force_Id_Right_Foot;
80 void set_name_to_force_id(
const std::string &name,
const Index &force_id);
82 void set_force_id_to_limits(
const Index &force_id,
83 const dynamicgraph::Vector &lf,
84 const dynamicgraph::Vector &uf);
86 void create_force_id_to_name_map();
88 Index get_id_from_name(
const std::string &name);
90 const std::string &get_name_from_id(Index idx);
91 std::string cp_get_name_from_id(Index idx);
93 const ForceLimits &get_limits_from_id(Index force_id);
112 void display(std::ostream &out)
const;
125 void display(std::ostream &os)
const;
131 void display(std::ostream &os)
const;
168 void create_id_to_name_map();
179 const Index &get_id_from_name(
const std::string &name);
187 const std::string &get_name_from_id(Index
id);
191 void set_name_to_id(
const std::string &jointName,
const Index &jointId);
194 void set_urdf_to_sot(
const std::vector<Index> &urdf_to_sot);
195 void set_urdf_to_sot(
const dynamicgraph::Vector &urdf_to_sot);
198 void set_joint_limits_for_id(
const Index &idx,
const double &lq,
222 const JointLimits &get_joint_limits_from_id(Index
id);
227 void sendMsg(
const std::string &msg, MsgType t = MSG_TYPE_INFO,
230 const std::string &lineId =
"");
238 void display(std::ostream &os)
const;
245 template <
typename Type>
247 const Type ¶meter_value) {
249 typedef boost::property_tree::ptree::path_type path;
250 path apath(parameter_name,
'/');
251 property_tree_.put<Type>(apath, parameter_value);
252 }
catch (
const boost::property_tree::ptree_error &e) {
253 std::ostringstream oss;
254 oss <<
"Robot utils: parameter path is invalid " <<
'\n' 255 <<
" for set_parameter(" << parameter_name <<
")\n" 256 << e.what() << std::endl;
257 sendMsg(oss.str(), MSG_TYPE_ERROR);
268 template <
typename Type>
271 boost::property_tree::ptree::path_type apath(parameter_name,
'/');
272 const Type &res = property_tree_.get<Type>(apath);
275 }
catch (
const boost::property_tree::ptree_error &e) {
276 std::ostringstream oss;
277 oss <<
"Robot utils: parameter path is invalid " <<
'\n' 278 <<
" for get_parameter(" << parameter_name <<
")\n" 279 << e.what() << std::endl;
280 sendMsg(oss.str(), MSG_TYPE_ERROR);
286 boost::property_tree::ptree &get_property_tree();
312 #endif // sot_torque_control_common_h_ JointLimits(double l, double u)
Definition: robot-utils.hh:36
Definition: robot-utils.hh:72
std::map< Index, JointLimits > m_limits_map
The joint limits map.
Definition: robot-utils.hh:160
const Eigen::Ref< const Eigen::VectorXd > & ConstRefVector
Definition: matrix-geometry.hh:69
Index m_Force_Id_Right_Hand
Definition: robot-utils.hh:77
Definition: robot-utils.hh:134
ForceUtil m_force_util
Forces data.
Definition: robot-utils.hh:139
void set_force_id_right_hand(Index anId)
Definition: robot-utils.hh:102
bool base_se3_to_sot(ConstRefVector pos, ConstRefMatrix R, RefVector q_sot)
Eigen::VectorXd::Index Index
Definition: robot-utils.hh:39
Definition: robot-utils.hh:128
RobotUtilShrPtr createRobotUtil(std::string &robotName)
double lower
Definition: robot-utils.hh:32
std::string m_Left_Hand_Frame_Name
Definition: robot-utils.hh:129
void set_parameter(const std::string ¶meter_name, const Type ¶meter_value)
Set a parameter of type string. If parameter_name already exists the value is overwritten. If not it is inserted.
Definition: robot-utils.hh:246
Eigen::VectorXd upper
Definition: robot-utils.hh:61
void set_force_id_right_foot(Index anId)
Definition: robot-utils.hh:110
std::map< std::string, Index > m_name_to_force_id
Definition: robot-utils.hh:74
dynamicgraph::Vector m_dgv_urdf_to_sot
Definition: robot-utils.hh:173
Index get_force_id_right_foot()
Definition: robot-utils.hh:108
#define SOT_CORE_EXPORT
Definition: api.hh:20
void set_force_id_left_foot(Index anId)
Definition: robot-utils.hh:106
JointLimits()
Definition: robot-utils.hh:34
ForceLimits()
Definition: robot-utils.hh:64
void setLoggerVerbosityLevel(LoggerVerbosity lv)
Specify the verbosity level of the logger.
Definition: robot-utils.hh:233
const Eigen::Ref< const Eigen::MatrixXd > ConstRefMatrix
Definition: matrix-geometry.hh:71
std::string m_imu_joint_name
The name of the joint IMU is attached to.
Definition: robot-utils.hh:163
std::map< Index, ForceLimits > m_force_id_to_limits
Definition: robot-utils.hh:73
std::shared_ptr< std::vector< std::string > > getListOfRobots()
Eigen::VectorXd lower
Definition: robot-utils.hh:62
Definition: robot-utils.hh:60
std::shared_ptr< RobotUtil > RobotUtilShrPtr
Accessors - This should be changed to RobotUtilPtrShared.
Definition: robot-utils.hh:299
ForceLimits(const Eigen::VectorXd &l, const Eigen::VectorXd &u)
Definition: robot-utils.hh:66
double upper
Definition: robot-utils.hh:31
std::size_t m_nbJoints
Nb of Dofs for the robot.
Definition: robot-utils.hh:151
void set_force_id_left_hand(Index anId)
Definition: robot-utils.hh:98
RobotUtilShrPtr RefVoidRobotUtil()
LoggerVerbosity getLoggerVerbosityLevel()
Get the logger's verbosity level.
Definition: robot-utils.hh:236
Index get_force_id_right_hand()
Definition: robot-utils.hh:100
std::vector< Index > m_urdf_to_sot
Map from the urdf index to the SoT index.
Definition: robot-utils.hh:148
std::string m_Right_Hand_Frame_Name
Definition: robot-utils.hh:130
RobotUtilShrPtr getRobotUtil(std::string &robotName)
FootUtil m_foot_util
Foot information.
Definition: robot-utils.hh:142
boost::property_tree::ptree property_tree_
Property tree.
Definition: robot-utils.hh:295
Index get_force_id_left_hand()
Definition: robot-utils.hh:96
std::map< std::string, std::string > parameters_strings_
Map of the parameters: map of strings.
Definition: robot-utils.hh:292
std::map< std::string, Index > m_name_to_id
Map from the name to the id.
Definition: robot-utils.hh:154
Type get_parameter(const std::string ¶meter_name)
Get a parameter of type string. If parameter_name already exists the value is overwritten. If not it is inserted.
Definition: robot-utils.hh:269
HandUtil m_hand_util
Hand information.
Definition: robot-utils.hh:145
Eigen::Ref< Eigen::VectorXd > RefVector
Definition: matrix-geometry.hh:68
Logger logger_
Definition: robot-utils.hh:289
std::map< Index, std::string > m_force_id_to_name
Definition: robot-utils.hh:75
Index get_force_id_left_foot()
Definition: robot-utils.hh:104
Definition: robot-utils.hh:30
bool isNameInRobotUtil(std::string &robotName)
std::map< Index, std::string > m_id_to_name
The map between id and name.
Definition: robot-utils.hh:157
Definition: abstract-sot-external-interface.hh:17
std::string m_urdf_filename
URDF file path.
Definition: robot-utils.hh:171