Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a method to retrieve maximal velocity of a transmission joint #9

Open
wants to merge 2 commits into
base: kinetic-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions include/urdf_geometry_parser/urdf_geometry_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class UrdfGeometryParser {
* \return true if the radius was found; false otherwise
*/
bool getJointRadius(const std::string& joint_name,
double& radius);
double& radius);

/**
* \brief Get joint steering limit from the URDF
Expand All @@ -87,8 +87,21 @@ class UrdfGeometryParser {
*/
bool getJointSteeringLimits(const std::string& joint_name,
double& steering_limit);
private:
std::string base_link_;


/**
* \brief Get joint angular speed limit from the URDF
* \param joint_name Name of the joint
* \param angular_speed_limit [rad/s]
* \return true if the angular speed limit was found; false otherwise
*/

bool getJointAngularSpeedLimit(const std::string& joint_name,
double & angular_speed_limit);


private:
std::string base_link_;

urdf::ModelInterfaceSharedPtr model_;
};
Expand Down
18 changes: 18 additions & 0 deletions src/urdf_geometry_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,22 @@ namespace urdf_geometry_parser{
}
return false;
}

bool UrdfGeometryParser::getJointAngularSpeedLimit(const std::string& joint_name,
double & angular_speed_limit)
{
if(model_)
{
urdf::JointConstSharedPtr joint(model_->getJoint(joint_name));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the requested joint name is not available within the model, this method fails.

(please double check this, I'm from mobile at the moment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump

if(joint->type == urdf::Joint::CONTINUOUS)
Copy link
Contributor

@mathias-luedtke mathias-luedtke Oct 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revolute joints have velocity limits, too...

{
angular_speed_limit = fabs(joint->limits->velocity);
ROS_DEBUG_STREAM("Joint "<<joint_name<<" speed limit is "<<angular_speed_limit*180.0/M_PI<<" in degrees");
return true;
}
ROS_ERROR_STREAM("Couldn't get joint "<<joint_name<<" angular speed limit, is it of type CONTINOUS ?");
}
return false;
}

}