50 std::vector<double> act_reduction;
54 std::vector<double> jnt_reduction;
55 std::vector<double> jnt_offset;
74 demangledTypeName<DifferentialTransmission>()<<
"'. " << ex.
what());
80 std::vector<double>& actuator_reduction)
82 const std::string ACTUATOR1_ROLE =
"actuator1";
83 const std::string ACTUATOR2_ROLE =
"actuator2";
85 std::vector<TiXmlElement> act_elements(2,
"");
86 std::vector<std::string> act_names(2);
87 std::vector<std::string> act_roles(2);
89 for (
unsigned int i = 0; i < 2; ++i)
92 act_names[i] = transmission_info.
actuators_[i].name_;
98 std::string& act_role = act_roles[i];
101 transmission_info.
name_,
104 if (act_role_status !=
SUCCESS) {
return false;}
107 if (ACTUATOR1_ROLE != act_role && ACTUATOR2_ROLE != act_role)
110 "' does not specify a valid <role> element. Got '" << act_role <<
"', expected '" <<
111 ACTUATOR1_ROLE <<
"' or '" << ACTUATOR2_ROLE <<
"'.");
117 if (act_roles[0] == act_roles[1])
120 "' of transmission '" << transmission_info.
name_ <<
121 "' must have different roles. Both specify '" << act_roles[0] <<
"'.");
126 std::vector<unsigned int> id_map(2);
127 if (ACTUATOR1_ROLE == act_roles[0])
140 actuator_reduction.resize(2);
141 for (
unsigned int i = 0; i < 2; ++i)
143 const unsigned int id = id_map[i];
146 transmission_info.
name_,
148 actuator_reduction[i]);
149 if (reduction_status !=
SUCCESS) {
return false;}
156 std::vector<double>& joint_reduction,
157 std::vector<double>& joint_offset)
159 const std::string JOINT1_ROLE =
"joint1";
160 const std::string JOINT2_ROLE =
"joint2";
162 std::vector<TiXmlElement> jnt_elements(2,
"");
163 std::vector<std::string> jnt_names(2);
164 std::vector<std::string> jnt_roles(2);
166 for (
unsigned int i = 0; i < 2; ++i)
169 jnt_names[i] = transmission_info.
joints_[i].name_;
175 std::string& jnt_role = jnt_roles[i];
178 transmission_info.
name_,
181 if (jnt_role_status !=
SUCCESS) {
return false;}
184 if (JOINT1_ROLE != jnt_role && JOINT2_ROLE != jnt_role)
187 "' does not specify a valid <role> element. Got '" << jnt_role <<
"', expected '" <<
188 JOINT1_ROLE <<
"' or '" << JOINT2_ROLE <<
"'.");
194 if (jnt_roles[0] == jnt_roles[1])
197 "' of transmission '" << transmission_info.
name_ <<
198 "' must have different roles. Both specify '" << jnt_roles[0] <<
"'.");
203 std::vector<unsigned int> id_map(2);
204 if (JOINT1_ROLE == jnt_roles[0])
217 joint_reduction.resize(2, 1.0);
218 joint_offset.resize(2, 0.0);
219 for (
unsigned int i = 0; i < 2; ++i)
221 const unsigned int id = id_map[i];
227 transmission_info.
name_,
230 if (reduction_status ==
BAD_TYPE) {
return false;}
236 transmission_info.
name_,
239 if (offset_status ==
BAD_TYPE) {
return false;}
virtual const char * what() const
static TiXmlElement loadXmlElement(const std::string &element_str)
#define ROS_ERROR_STREAM_NAMED(name, args)
Abstract interface for loading transmission instances from configuration data.
static bool getJointConfig(const TransmissionInfo &transmission_info, std::vector< double > &joint_reduction, std::vector< double > &joint_offset)
Class for loading a differential transmission instance from configuration data.
Contains semantic info about a given transmission loaded from XML (URDF)
boost::shared_ptr< Transmission > TransmissionSharedPtr
std::string demangledTypeName()
static ParseStatus getActuatorReduction(const TiXmlElement &parent_el, const std::string &actuator_name, const std::string &transmission_name, bool required, double &reduction)
TransmissionSharedPtr load(const TransmissionInfo &transmission_info)
static ParseStatus getActuatorRole(const TiXmlElement &parent_el, const std::string &actuator_name, const std::string &transmission_name, bool required, std::string &role)
static bool checkActuatorDimension(const TransmissionInfo &transmission_info, const unsigned int expected_dim)
static ParseStatus getJointRole(const TiXmlElement &parent_el, const std::string &joint_name, const std::string &transmission_name, bool required, std::string &role)
static ParseStatus getJointReduction(const TiXmlElement &parent_el, const std::string &joint_name, const std::string &transmission_name, bool required, double &reduction)
std::vector< ActuatorInfo > actuators_
PLUGINLIB_EXPORT_CLASS(transmission_interface::BiDirectionalEffortJointInterfaceProvider, transmission_interface::RequisiteProvider)
static ParseStatus getJointOffset(const TiXmlElement &parent_el, const std::string &joint_name, const std::string &transmission_name, bool required, double &offset)
static bool getActuatorConfig(const TransmissionInfo &transmission_info, std::vector< double > &actuator_reduction)
std::vector< JointInfo > joints_
Implementation of a differential transmission.
static bool checkJointDimension(const TransmissionInfo &transmission_info, const unsigned int expected_dim)