Ask Your Question

Revision history [back]

Cannot set joints of URDF from rostopic

I have a very simple problem which is to set the joint positions of my URDF hand by code, see the figure bellow. First I have been trying to do this via the terminal but without any sucess.

image description

Here are the steps I took:

1) check the topic info :

$rostopic info /joint_states

Type: sensor_msgs/JointState

Publishers: * /joint_state_publisher (128.178.145.74:38463/)

Subscribers: * /robot_state_publisher (128.178.145.74:51752/)

2) check what is being published

$rostopic echo /joint_states

header: seq: 1726 stamp: secs: 1426759384 nsecs: 71331024 frame_id: '' name: ['index_dof0_joint', 'index_dof1_joint', 'index_dof2_joint', 'index_dof3_joint', 'middle_dof0_joint', 'middle_dof1_joint', 'middle_dof2_joint', 'middle_dof3_joint', 'ring_dof0_joint', 'ring_dof1_joint', 'ring_dof2_joint', 'ring_dof3_joint', 'pinky_dof0_joint', 'pinky_dof1_joint', 'pinky_dof2_joint', 'pinky_dof3_joint', 'thumb_dof0_joint', 'thumb_dof1_joint', 'thumb_dof2_joint'] position: [0.0, 0.0, 2.7755575615628914e-17, 0.0, 0.0, 0.0, 2.7755575615628914e-17, 0.0, 0.0, 0.0, 2.7755575615628914e-17, 0.0, 0.0, 0.0, 2.7755575615628914e-17, 0.0, 0.0, 0.0, 0.0] velocity: [] effort: []

3) Now I want to change the joint position of index_dof0_joint

$rostopic pub /joint_states sensor_msgs/JointState "header: seq: 0 stamp: {secs: 0, nsecs: 0} frame_id: '' name: ['index_dof0_joint'] position: [0.2] velocity: [0] effort: [0]"

I have been stuck with the simple problem for too long. If the Joint State Publisher GUI can do it, it should be possible from the terminal and then later on from a ros publisher. Any Ideas on how I can get index_dof0_joint to move through rostopics and what I might be doing wrong ?

Thanks

Cannot set joints of URDF How to get robot_state_publisher to take the information from rostopicmy /joint_states topic.

I have a very simple problem which is to set the joint positions of my URDF hand by code, see the figure bellow. First I have been trying to do this via the terminal but without any sucess.success.

What have have done in code is to publish the joint positions to the topic /joint_states and not used the default joint_state_publisher node. But I have not been successful.

image description

Here are the steps I took:

1) check us my launch file:

<?xml version="1.0"?>
<launch>

   <arg name="gui" default="False" />
   <param name="robot_description" command="...'" />
   <param name="use_gui" value="$(arg gui)"/>

   <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"/>

   <!-- hand model -->
   <node name="hand_model" pkg="sensor_models" type="hand_node" />
   <node name="rviz" pkg="rviz" type="rviz"  required="true" />

</launch>

My hand node publishes the joint states on the topic /joint_states

$ rostopic info :

$rostopic info /joint_states

/joint_states Type: sensor_msgs/JointState

sensor_msgs/JointState Publishers: * /joint_state_publisher (128.178.145.74:38463/)

/hand_model (http://128.178.145.74:39519/) Subscribers: * /robot_state_publisher (128.178.145.74:51752/)

2) (http://128.178.145.74:36845/)

When I check what is the messages being published

$rostopic published rostopic echo /joint_states

header: /joint_states:

 seq: 1726
23721
  stamp: 
    secs: 1426759384
0
    nsecs: 71331024
0
  frame_id: ''
name: ['index_dof0_joint', ['index_dof0_joint', 'index_dof1_joint', 'index_dof2_joint', 'index_dof3_joint', 'middle_dof0_joint', 'middle_dof1_joint', 'middle_dof2_joint', 'middle_dof3_joint', 'ring_dof0_joint', 'ring_dof1_joint', 'ring_dof2_joint', 'ring_dof3_joint', 'pinky_dof0_joint', 'pinky_dof1_joint', 'pinky_dof2_joint', 'pinky_dof3_joint', 'thumb_dof0_joint', 'thumb_dof1_joint', 'thumb_dof2_joint']
position: [0.0, 0.0, 2.7755575615628914e-17, 0.0, 0.0, 0.0, 2.7755575615628914e-17, 0.0, 0.0, 0.0, 2.7755575615628914e-17, 0.0, 0.0, 0.0, 2.7755575615628914e-17, [0.47, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
velocity: []
effort: []

3) Now I want to change the joint position []

I have exactly the same information if I used:

 <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">

instead of index_dof0_joint

$rostopic pub /joint_states sensor_msgs/JointState "header: seq: 0 stamp: {secs: 0, nsecs: 0} frame_id: '' name: ['index_dof0_joint'] position: [0.2] velocity: [0] effort: [0]"

I have been stuck with the simple problem for too long. If the Joint State Publisher GUI can do it, publishing it should be possible from the terminal and then later on my hand_model node. This is what I get:

image description

I am unsure how to get robot_state_publisher to take the information from a ros publisher. the /joint_states topic. Any Ideas on how I can get index_dof0_joint to move through rostopics and what I might be doing wrong ideas ?

Thanks