29 #include <boost/lexical_cast.hpp> 40 const std::string& actuator_name,
41 const std::string& transmission_name,
46 const TiXmlElement* reduction_el = parent_el.FirstChildElement(
"mechanicalReduction");
51 ROS_ERROR_STREAM_NAMED(
"parser",
"Actuator '" << actuator_name <<
"' of transmission '" << transmission_name <<
52 "' does not specify the required <mechanicalReduction> element.");
56 ROS_DEBUG_STREAM_NAMED(
"parser",
"Actuator '" << actuator_name <<
"' of transmission '" << transmission_name <<
57 "' does not specify the optional <mechanicalReduction> element.");
63 try {reduction = boost::lexical_cast<
double>(reduction_el->GetText());}
64 catch (
const boost::bad_lexical_cast&)
66 ROS_ERROR_STREAM_NAMED(
"parser",
"Actuator '" << actuator_name <<
"' of transmission '" << transmission_name <<
67 "' specifies the <mechanicalReduction> element, but is not a number.");
75 const std::string& joint_name,
76 const std::string& transmission_name,
81 const TiXmlElement* reduction_el = parent_el.FirstChildElement(
"mechanicalReduction");
87 "' does not specify the required <mechanicalReduction> element.");
92 "' does not specify the optional <mechanicalReduction> element.");
98 try {reduction = boost::lexical_cast<
double>(reduction_el->GetText());}
99 catch (
const boost::bad_lexical_cast&)
102 "' specifies the <mechanicalReduction> element, but is not a number.");
110 const std::string& joint_name,
111 const std::string& transmission_name,
116 const TiXmlElement* offset_el = parent_el.FirstChildElement(
"offset");
122 "' does not specify the required <offset> element.");
127 "' does not specify the optional <offset> element.");
133 try {offset = boost::lexical_cast<
double>(offset_el->GetText());}
134 catch (
const boost::bad_lexical_cast&)
137 "' specifies the <offset> element, but is not a number.");
145 const std::string& actuator_name,
146 const std::string& transmission_name,
151 const TiXmlElement* role_el = parent_el.FirstChildElement(
"role");
156 ROS_ERROR_STREAM_NAMED(
"parser",
"Actuator '" << actuator_name <<
"' of transmission '" << transmission_name <<
157 "' does not specify the required <role> element.");
161 ROS_DEBUG_STREAM_NAMED(
"parser",
"Actuator '" << actuator_name <<
"' of transmission '" << transmission_name <<
162 "' does not specify the optional <offset> element.");
168 if (!role_el->GetText())
172 ROS_ERROR_STREAM_NAMED(
"parser",
"Actuator '" << actuator_name <<
"' of transmission '" << transmission_name <<
173 "' specifies an empty <role> element.");
177 ROS_DEBUG_STREAM_NAMED(
"parser",
"Actuator '" << actuator_name <<
"' of transmission '" << transmission_name <<
178 "' specifies an empty <role> element.");
182 role = role_el->GetText();
189 const std::string& joint_name,
190 const std::string& transmission_name,
195 const TiXmlElement* role_el = parent_el.FirstChildElement(
"role");
201 "' does not specify the required <role> element.");
206 "' does not specify the optional <offset> element.");
212 if (!role_el->GetText())
217 "' specifies an empty <role> element.");
222 "' specifies an empty <role> element.");
226 role = role_el->GetText();
#define ROS_DEBUG_STREAM_NAMED(name, args)
#define ROS_ERROR_STREAM_NAMED(name, args)
static ParseStatus getActuatorReduction(const TiXmlElement &parent_el, const std::string &actuator_name, const std::string &transmission_name, bool required, double &reduction)
static ParseStatus getActuatorRole(const TiXmlElement &parent_el, const std::string &actuator_name, const std::string &transmission_name, bool required, std::string &role)
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)
static ParseStatus getJointOffset(const TiXmlElement &parent_el, const std::string &joint_name, const std::string &transmission_name, bool required, double &offset)