Getting joint names

762 views
Skip to first unread message

Tiago Pimentel

unread,
Jun 19, 2013, 11:33:04 AM6/19/13
to moveit...@googlegroups.com
Good morning everyone,

I was creating a interface program to communicate MoveIt with my robotic arm, but I don't know how to dynamically get the joint_names in my program, unless I manually open the urdf or controller file and read it from there.
Is there any service call or message I can listen to for this infromation? Or does anyone know how to do it?

I need this information to be able to publish to feedback_states the joint states.
Another question is, is this the right way to publish joint states back to MoveIt? Or is there another better topic for this?

Thank you,
Tiago Pimentel

Ioan Sucan

unread,
Jun 19, 2013, 12:12:27 PM6/19/13
to Tiago Pimentel, moveit-users
Hello Tiago,

If you use the C++ interfaces, getting access to a state, or the robot model gives you that info.
The python package for move_group has a get_joints() function.
Which API are you using?

Ioan

Tiago Pimentel

unread,
Jun 19, 2013, 12:56:29 PM6/19/13
to moveit...@googlegroups.com
I'm using the C++ one.

Acorn Pooley

unread,
Jun 19, 2013, 1:00:44 PM6/19/13
to Tiago Pimentel, moveit-users
Once you have a RobotModel you can use getJointModels() or getJointModelNames().
The kinematics tutorial shows how to get a RobotModel

This should do it

robot_model_loader::RDFLoader robot_model_loader("robot_description"); 
robot_model::RobotModelPtr robot_model = robot_model_loader.getModel();
const std::vector<std::string>& names = robot_model->getJointModelNames();

Tiago Pimentel

unread,
Jun 20, 2013, 4:07:27 PM6/20/13
to moveit...@googlegroups.com
Hey,

Thanks for all the help!
I tried it and gave me the following error:

error: ‘RDFLoader’ is not a member of ‘robot_model_loader’

I added these lines of code:


    robot_model_loader::RDFLoader robot_model_loader("robot_description"); 
    robot_model::RobotModelPtr kinematic_model = robot_model_loader.getModel();
    ROS_INFO("Model frame: %s", kinematic_model->getModelFrame().c_str());

and this libraries:

// MoveIt!
#include <moveit/robot_model_loader/robot_model_loader.h>
#include <moveit/robot_model/robot_model.h>
#include <moveit/robot_state/robot_state.h>
#include <moveit/robot_state/joint_state_group.h>

Do you have any idea what's going wrong?

Thank you,
Tiago Pimentel




On Wednesday, June 19, 2013 10:33:04 AM UTC-5, Tiago Pimentel wrote:

Tiago Pimentel

unread,
Jun 20, 2013, 4:33:31 PM6/20/13
to moveit...@googlegroups.com
Good afternoon again,

I went into their code and think I have figured it out. The line:


    robot_model_loader::RDFLoader robot_model_loader("robot_description"); 

Should actually be:

    robot_model_loader::RobotModelLoader robot_model_loader("robot_description");

Who should I warn about this? Is it Ioan? I think this line in the wiki is wrong.

Thank you for the help,

Tiago Pimentel


On Wednesday, June 19, 2013 10:33:04 AM UTC-5, Tiago Pimentel wrote:

Ioan Sucan

unread,
Jun 20, 2013, 5:20:41 PM6/20/13
to Tiago Pimentel, moveit-users
Thank you Tiago,

The wiki has been fixed.

Ioan

Patrick Goebel

unread,
Feb 5, 2014, 10:46:14 AM2/5/14
to moveit...@googlegroups.com
I see that the get_joints() Python function appears to return *all* the joints making up the move_group including fixed joints.  Is there a way to get just the non-fixed joint names?  For example, if I have a 6-dof arm with revolute joints representing the servos, I was hoping to get back just the joint names of the 6 revolute joints.  This would allow one to match up joint names with the joint values returned by get_current_joint_values().

--patrick

Sachin Chitta

unread,
Feb 7, 2014, 1:36:00 PM2/7/14
to Patrick Goebel, moveit-users
Pull requests are in to moveit_ros and moveit_commander to add this to move_group_interface api.

Sachin

Patrick Goebel

unread,
Feb 7, 2014, 2:09:50 PM2/7/14
to Sachin Chitta, moveit-users
Awesome--many thanks!

--patrick
Reply all
Reply to author
Forward
0 new messages