0
$\begingroup$

Rosanswers logo

I'm working now with UR5. When I echo the states of joints I get this

galf@galf:~/Desktop/ur5/catkin_ws$ rostopic echo /ur5/joint_states -n1
header: 
  seq: 9465
  stamp: 
    secs: 94
    nsecs: 662000000
  frame_id: ''
name: [elbow_joint, shoulder_lift_joint, shoulder_pan_joint, wrist_1_joint, wrist_2_joint,
  wrist_3_joint]
position: [-3.1415916305807485, 0.30983008014827096, 1.9488655889645834, 3.1415983918040062, 1.845209559572325, -3.141592812638949]
velocity: [3.621569639258467e-06, -9.772236883207112e-06, 0.00011501897260136615, -2.0719156311055294e-07, 0.06444979561546602, -6.340667138213241e-08]
effort: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
---

Are the positions match the joints in the same order as they appear in the names? I'm asking this because when I retrieve the info for the command topic, I get

galf@galf:~/Desktop/ur5/catkin_ws$ rostopic pub /ur5/joints_group_velocity_controller/command std_msgs/Float64MultiArray "layout:
  dim:
  - label: ''
    size: 0
    stride: 0
  data_offset: 0
data:
- 0" 

So to command the joints, I need fill out data as data: [0,0,0,0,0,0] but I don't know the order of joints. How this works in ROS? Does data[0] represent elbow_joint?

The tree appears as shoulder_pan_joint > shoulder_lift_joint > elbow_joint > wrist_1_joint > wrist_2_joint > wrist_3_joint. I don't know why ROS puts them in alphabetical order.


Originally posted by CroCo on ROS Answers with karma: 155 on 2022-06-01

Post score: 0


Original comments

Comment by gvdhoorn on 2022-06-01:
I've updated the title to better reflect your question. "topic command" is too ambiguous.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

From this:

galf@galf:~/Desktop/ur5/catkin_ws$ rostopic pub /ur5/joints_group_velocity_controller/command std_msgs/Float64MultiArray ...

it would appear you're using a JointGroupVelocityController with your driver (note: this cannot be ur_driver, as that's not a ros_control compatible driver).

That controller requires a configuration stanza similar to this:

joint_group_vel_controller:
   type: velocity_controllers/JointGroupVelocityController
   joints:
     - shoulder_pan_joint
     - shoulder_lift_joint
     - elbow_joint
     - wrist_1_joint
     - wrist_2_joint
     - wrist_3_joint

The order in which you should provide the data to the joints_group_velocity_controller/command would be the same order as specified in the configuration stanza I've included here.

So to command the joints, I need fill out data as data: [0,0,0,0,0,0] but I don't know the order of joints. How this works in ROS? Does data[0] represent elbow_joint?

this is not really "in ROS". It's just a consequence of how the ros_control developers implemented their infrastructure.

The tree appears as shoulder_pan_joint > shoulder_lift_joint > elbow_joint > wrist_1_joint > wrist_2_joint > wrist_3_joint. I don't know why ROS puts them in alphabetical order.

For this, see #q356347, #q282097, #q221560 and #q351105.


Originally posted by gvdhoorn with karma: 86574 on 2022-06-01

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by CroCo on 2022-06-01:
this is exactly my ymal file in the same order you've posted it.

Comment by CroCo on 2022-06-01:
Could you please confirm if the names match the positions' indices in the command topic?

Comment by gvdhoorn on 2022-06-02:
I'm not sure what is unclear about this:

The order in which you should provide the data to the joints_group_velocity_controller/command would be the same order as specified in the configuration stanza I've included here.

Comment by CroCo on 2022-06-02:
@gvdhoorn, I'm talking about /joint_states.

Comment by gvdhoorn on 2022-06-02:
Your question is still a bit ambiguous (which "names" are you referring to in your comment), but: please see #q356347, #q282097, #q221560 and #q351105.

Summarising: no, they don't have to, they probably don't, and you shouldn't assume they do or will.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.