23 #include "urdf_parser/urdf_parser.h" 24 #include "urdf_model/model.h" 25 #include "urdf_model/joint.h" 27 #include <boost/assign/list_of.hpp> 28 #include <boost/foreach.hpp> 29 #include <boost/shared_ptr.hpp> 30 #include <boost/algorithm/string/predicate.hpp> 38 using boost::assign::list_of;
39 using urdf::ModelInterface;
45 "MFJ3")(
"MFJ4")(
"RFJ1")(
"RFJ2")(
"RFJ3")(
"RFJ4")(
"LFJ1")(
"LFJ2")(
"LFJ3")(
"LFJ4")(
"LFJ5")(
"THJ1")(
"THJ2")(
46 "THJ3")(
"THJ4")(
"THJ5")(
"WRJ1")(
"WRJ2");
62 std::map<std::string, std::string> mapping_map;
66 std::pair<std::string, std::string> pair;
70 if (pair.second.empty())
73 ROS_INFO_STREAM(
"detected hands are \n" <<
"hand serial:" << pair.first <<
" hand_id:" 74 << pair.second <<
" , replaced internally by: " << pair.first);
77 ROS_INFO_STREAM(
"detected hands are \n" <<
"hand serial:" << pair.first <<
" hand_id:" << pair.second);
92 std::pair<std::string, std::string> hand;
95 std::set<std::string> hand_joints;
99 BOOST_FOREACH(std::string default_joint_name,
joint_names_)
101 hand_joints.insert(hand.second + default_joint_name);
104 std::string robot_description;
109 std::set<std::string> joints_tmp;
110 std::pair<std::string, boost::shared_ptr<Joint> > joint;
111 BOOST_FOREACH(joint, hand_urdf->joints_)
113 if (Joint::FIXED != joint.second->type)
115 const std::string joint_name = joint.first;
116 bool found_prefix =
false;
117 std::pair<std::string, std::string> hand_prefix;
120 if (boost::starts_with(joint_name, hand_prefix.second))
130 else if (0 == joint_name.find(hand.second))
132 joints_tmp.insert(joint_name);
137 std::set_intersection(joints_tmp.begin(), joints_tmp.end(), hand_joints.begin(), hand_joints.end(),
143 ROS_WARN_STREAM(
"No robot_description found on parameter server. Joint names are loaded for 5 finger hand");
146 const std::string hand_mapping = hand.second;
147 BOOST_FOREACH(std::string default_joint_name,
joint_names_)
158 for (std::map<std::string, std::string>::const_iterator mapping_iter =
hand_config_.
mapping_.begin();
162 + mapping_iter->second +
"/" +
"calibration.yaml";
169 for (std::map<std::string, std::string>::const_iterator mapping_iter =
hand_config_.
mapping_.begin();
173 ethercat_path +
"/controls/" +
"friction_compensation.yaml";
175 ethercat_path +
"/controls/motors/" + mapping_iter->second +
"/motor_board_effort_controllers.yaml";
176 std::string host_path(ethercat_path +
"/controls/host/" + mapping_iter->second +
"/");
178 host_path +
"sr_edc_calibration_controllers.yaml");
180 host_path +
"sr_edc_joint_velocity_controllers_PWM.yaml");
182 host_path +
"sr_edc_effort_controllers_PWM.yaml");
184 host_path +
"sr_edc_joint_velocity_controllers.yaml");
186 host_path +
"sr_edc_effort_controllers.yaml");
189 host_path +
"sr_edc_mixed_position_velocity_joint_controllers_PWM.yaml");
191 host_path +
"sr_edc_joint_position_controllers_PWM.yaml");
193 host_path +
"sr_edc_mixed_position_velocity_joint_controllers.yaml");
195 host_path +
"sr_edc_joint_position_controllers.yaml");
void generate_joints_with_prefix()
void generate_hand_controller_tuning_path()
HandControllerTuning get_hand_controller_tuning()
std::map< std::string, std::string > mapping_
std::map< std::string, std::vector< std::string > > host_control_
static const std::vector< std::string > get_default_joints()
HandControllerTuning hand_controller_tuning_
void generate_calibration_path()
ROSCPP_DECL bool get(const std::string &key, std::string &s)
static const std::vector< std::string > joint_names_
HandConfig get_hand_parameters()
ROSCPP_DECL bool has(const std::string &key)
std::map< std::string, std::string > get_calibration_path()
#define ROS_WARN_STREAM(args)
#define ROS_DEBUG_STREAM(args)
std::map< std::string, std::vector< std::string > > get_joints()
ROSLIB_DECL std::string getPath(const std::string &package_name)
std::map< std::string, std::string > motor_control_
#define ROS_INFO_STREAM(args)
std::map< std::string, std::string > friction_compensation_
#define ROS_ERROR_STREAM(args)
std::map< std::string, std::string > calibration_path_
std::map< std::string, std::string > joint_prefix_
std::map< std::string, std::vector< std::string > > joints_