From 47864e32e0a66de823af2c2a13d852e26a0c838d Mon Sep 17 00:00:00 2001 From: wim Date: Fri, 11 Dec 2009 17:16:24 +0000 Subject: [PATCH] add optional rising and falling attributes to the calibration element. Ticket #3141 --- urdf/include/urdf/joint.h | 2 +- urdf/src/joint.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/urdf/include/urdf/joint.h b/urdf/include/urdf/joint.h index cbe9f67..6151527 100644 --- a/urdf/include/urdf/joint.h +++ b/urdf/include/urdf/joint.h @@ -106,7 +106,7 @@ class JointCalibration { public: JointCalibration() { this->clear(); }; - double reference_position; + double reference_position, rising, falling; void clear() { diff --git a/urdf/src/joint.cpp b/urdf/src/joint.cpp index 345ad49..0f2fecc 100644 --- a/urdf/src/joint.cpp +++ b/urdf/src/joint.cpp @@ -175,6 +175,26 @@ bool JointCalibration::initXml(TiXmlElement* config) else this->reference_position = atof(reference_position_str); + // Get rising edge position + const char* rising_position_str = config->Attribute("rising"); + if (rising_position_str == NULL) + { + ROS_DEBUG("joint calibration: no rising, using default value"); + this->rising = 0; + } + else + this->rising = atof(rising_position_str); + + // Get falling edge position + const char* falling_position_str = config->Attribute("falling"); + if (falling_position_str == NULL) + { + ROS_DEBUG("joint calibration: no falling, using default value"); + this->falling = 0; + } + else + this->falling = atof(falling_position_str); + return true; }