joint_states topic name field sorted alphabetically

asked 2015-11-26 02:54:00 -0500

Ane gravatar image

updated 2016-10-24 09:11:01 -0500

ngrennan gravatar image

I'm using joint_state_controller to publish the joint_states topics. My robot is composed by a crane and an arm. The origin of the chain is the crane_bridge_joint and joint_states topic is:

name: [ 'arm_1_joint', 'arm_2_joint', 'arm_3_joint', 'arm_4_joint', 'arm_5_joint', 'arm_6_joint', 'crane_bridge_joint', 'crane_arm_joint']
position: [0.03484964823276627, 3.1446214877979326, 0.11884834747659312, 0.056190650599306835, -0.9346745113914041, 3.128057174527214, 3.290371433787131, -0.0005012796984654981]

However if I change the names of the joints the topic look like this:

name: ['crane_bridge_joint', 'crane_hercules_joint', 'hercules_1_joint', 'hercules_2_joint', 'hercules_3_joint', 'hercules_4_joint', 'hercules_5_joint', 'hercules_6_joint']
position: [3.290371433787131, -0.0005012796984654981, 0.03484964823276627, 3.1446214877979326, 0.11884834747659312, 0.056190650599306835, -0.9346745113914041, 3.128057174527214]

I thought that the the publication of the joint_state was based on the robot joints chain (the first joint the base_link and the last one, the tip_link) but I have realized that the joints are sorted alphabetically. Is there any way to avoid this order?

Thanks in advance,

Ane

edit retag flag offensive close merge delete

Comments

Afaict there is no code in the joint_state_controller that sorts joint names that way (or in any way, really). It should just use whatever order it receives. Can you verify and possibly post some example JointState messages?

gvdhoorn gravatar image gvdhoorn  ( 2015-11-26 08:26:41 -0500 )edit

Also, the order should be irrelevant as long as name[0] corresponds to position[0] and so forth. May I ask what you are trying to achieve and why this matters?

Chrissi gravatar image Chrissi  ( 2015-11-27 08:57:16 -0500 )edit

To add on previous comments, what do you mean by 'if I change the names of the joints in the topic'?.

Adolfo Rodriguez T gravatar image Adolfo Rodriguez T  ( 2015-12-04 02:10:48 -0500 )edit