ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Joint order in JointGroupVelocityController 'command' topic

asked 2022-06-01 07:47:31 -0500

CroCo gravatar image

updated 2022-06-01 13:35:28 -0500

gvdhoorn gravatar image

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.

edit retag flag offensive close merge delete

Comments

I've updated the title to better reflect your question. "topic command" is too ambiguous.

gvdhoorn gravatar image gvdhoorn  ( 2022-06-01 13:36:20 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2022-06-01 13:27:26 -0500

gvdhoorn gravatar image

updated 2022-06-01 13:32:24 -0500

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.

edit flag offensive delete link more

Comments

this is exactly my ymal file in the same order you've posted it.

CroCo gravatar image CroCo  ( 2022-06-01 17:06:11 -0500 )edit

Could you please confirm if the names match the positions' indices in the command topic?

CroCo gravatar image CroCo  ( 2022-06-01 17:11:23 -0500 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2022-06-02 01:41:54 -0500 )edit

@gvdhoorn, I'm talking about /joint_states.

CroCo gravatar image CroCo  ( 2022-06-02 06:42:33 -0500 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2022-06-02 06:45:57 -0500 )edit
0

answered 2022-06-01 10:34:12 -0500

ljaniec gravatar image

By checking the driver code in their repository:

https://github.com/ros-industrial/uni...

and

https://github.com/ros-industrial/uni...

it seems to be

JOINT_NAMES = ['shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint',
               'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']
edit flag offensive delete link more

Comments

thanks for the answer. But why I'm getting incorrect order?

CroCo gravatar image CroCo  ( 2022-06-01 11:03:06 -0500 )edit

Add more details about your setup, please - right now it's divination from a glass ball :) Can you link repository with packages you are using, maybe even the project? You can also have a different configuration than the default: https://github.com/ros-industrial/uni...

ljaniec gravatar image ljaniec  ( 2022-06-01 12:44:06 -0500 )edit
1

@ljaniec: @CroCo doesn't mention it, but I'm pretty sure (s)he's using UniversalRobots/Universal_Robots_ROS_Driver, not ur_driver.

You can't use code inur_driver to answer this question.

@CroCo will have to first clarify which driver (s)he is using.

gvdhoorn gravatar image gvdhoorn  ( 2022-06-01 13:24:06 -0500 )edit

@gvdhoorn, yes I'm not using ur_driver. Actually, currently I'm using Gazebo for simulation. The algorithm I'm working with requires the joints to accept velocity inputs that is why I've created my own yaml.

CroCo gravatar image CroCo  ( 2022-06-01 17:08:04 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-06-01 07:47:31 -0500

Seen: 198 times

Last updated: Jun 01 '22