universal robot publishes joint_states in wrong order
Hi
I am simulating a UR3e with universal_robot in gazebo. I changed in the file universal_robot/ur_gazebo/arm_controller_ur3.yaml the arm_controller to effort_controllers/JointTrajectoryController and the joint_group_position_controller to effort_controllers/JointGroupPositionController so that the joint torques are published in the rostopic /joint_states (see here). When I rostopic echo /joint_states
then I get messages like this:
header:
seq: 1417
stamp:
secs: 28
nsecs: 436000000
frame_id: ''
name: [elbow_joint, shoulder_lift_joint, shoulder_pan_joint, wrist_1_joint, wrist_2_joint,
wrist_3_joint]
position: [-1.0557658919163337, 1.0575053468152493, -0.02113558608100874, -1.822583166115745, -0.10412660222769787, 1.801825136192468]
velocity: [0.06788605457138291, -0.03376755104159887, -0.0035151515981181034, 0.0949115070348448, 1.8808924155717315, -0.01988477359094043]
effort: [9.819053646461384, 21.306304838637402, 6.095654368698433, 0.3193635097687775, -54.0, 2.8906661096243624]
But when you look at the order of the joint names, you can see that they are in the wrong order (elbow_joint an dshoulder_pan_joint should be switched). I am not sure if just the names are switched or the data as well. Can somebody tell me where the publisher for this is defined so I can check?
it's probably completely clear to you, but we have no idea which packages you are using, or what you are referring to with
arm_controller
andjoint_group_position_controller
.Please include links to any packages you are using, and links to specific files you are referring to in your future questions, as without such information, it is very difficult to help you.
Please also note your question is a duplicate of #q282097, #q221560 and somewhat #q351105.
Sorry, was a bit in a rush. Edited it.
Weird these didn't show up in my search. Thanks for the hint
Hi ! I have the exact same issue. It took me some time to find the issue. Im using, UR5 + gazebo 9 + ROS Melodic. I'm using
effort_controllers/JointEffortController
for every joint. Then I useKDL::ChainIdSolver_RNE::CartToJnt
to calculate the joint torque and then publishe these torques on myeffort_controllers/JointEffortController
topics.But I see the
/joint_states
name are in not the same order as it should be for me.I used following remap to read the
/joint_states
in my subscriber callback,int map_joint_states[] = {2, 1, 0, 3, 4, 5}