46 if (!doc.Parse(urdf.c_str()) && doc.Error())
48 ROS_ERROR(
"Can't parse transmissions. Invalid robot description.");
53 TiXmlElement *root = doc.RootElement();
56 TiXmlElement *trans_it =
nullptr;
57 for (trans_it = root->FirstChildElement(
"transmission"); trans_it;
58 trans_it = trans_it->NextSiblingElement(
"transmission"))
63 if(trans_it->Attribute(
"name"))
65 transmission.
name_ = trans_it->Attribute(
"name");
66 if (transmission.
name_.empty())
79 TiXmlElement *type_child = trans_it->FirstChildElement(
"type");
83 << transmission.
name_ <<
"'.");
86 if (!type_child->GetText())
89 << transmission.
name_ <<
"'.");
92 transmission.
type_ = type_child->GetText();
98 << transmission.
name_ <<
"'.");
106 << transmission.
name_ <<
"'.");
111 transmissions.push_back(transmission);
115 if( transmissions.empty() )
126 TiXmlElement *joint_it =
nullptr;
127 for (joint_it = trans_it->FirstChildElement(
"joint"); joint_it;
128 joint_it = joint_it->NextSiblingElement(
"joint"))
134 if(joint_it->Attribute(
"name"))
136 joint.
name_ = joint_it->Attribute(
"name");
137 if (joint.
name_.empty())
149 TiXmlElement *role_it = joint_it->FirstChildElement(
"role");
152 joint.
role_ = role_it->GetText() ? role_it->GetText() : std::string();
156 TiXmlElement *hw_iface_it =
nullptr;
157 for (hw_iface_it = joint_it->FirstChildElement(
"hardwareInterface"); hw_iface_it;
158 hw_iface_it = hw_iface_it->NextSiblingElement(
"hardwareInterface"))
160 if(!hw_iface_it) {
continue;}
161 if (!hw_iface_it->GetText())
164 << joint.
name_ <<
"'.");
167 const std::string hw_iface_name = hw_iface_it->GetText();
173 << joint.
name_ <<
"'.");
178 std::stringstream ss;
183 joints.push_back(joint);
198 TiXmlElement *actuator_it =
nullptr;
199 for (actuator_it = trans_it->FirstChildElement(
"actuator"); actuator_it;
200 actuator_it = actuator_it->NextSiblingElement(
"actuator"))
206 if(actuator_it->Attribute(
"name"))
208 actuator.
name_ = actuator_it->Attribute(
"name");
209 if (actuator.
name_.empty())
222 TiXmlElement *hw_iface_it =
nullptr;
223 for (hw_iface_it = actuator_it->FirstChildElement(
"hardwareInterface"); hw_iface_it;
224 hw_iface_it = hw_iface_it->NextSiblingElement(
"hardwareInterface"))
226 if(!hw_iface_it) {
continue;}
227 if (!hw_iface_it->GetText())
230 << actuator.
name_ <<
"'.");
233 const std::string hw_iface_name = hw_iface_it->GetText();
239 << actuator.
name_ <<
"'.");
244 std::stringstream ss;
249 actuators.push_back(actuator);
252 if(actuators.empty())