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

How to get robot_state_publisher to take the information from my /joint_states topic.

asked 2015-03-19 05:14:02 -0500

gpldecha gravatar image

updated 2015-03-19 09:30:01 -0500

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 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 us my launch file:

<?xml version="1.0"?>

   <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" />


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

$ rostopic info /joint_states 
Type: sensor_msgs/JointState

 * /hand_model (

 * /robot_state_publisher (

When I check the messages being published rostopic echo /joint_states:

 seq: 23721
    secs: 0
    nsecs: 0
  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.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: []

I have exactly the same information if I used:

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

instead of publishing it from 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 the /joint_states topic. Any ideas ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-03-19 10:04:13 -0500

gpldecha gravatar image

Solved the problem. I had to use the source_list parameter of the joint_state_publisher <rosparam param="source_list">["hand_model/joint_states"]</rosparam>. The following post helped me: Subscribe to new JointState messaes

<?xml version="1.0"?>

   <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
        <rosparam param="source_list">["hand_model/joint_states"]</rosparam>

   <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"/>
   <node name="hand_model" pkg="sensor_models" type="hand_node" output="screen"/>

   <node name="rviz" pkg="rviz" type="rviz"  required="true" />

edit flag offensive delete link more


Could you please specify the terminal command with rosparam that you used. I had the same issue, modified my .launch but I cannot yet solve the problem.

Appreciate your help

Abou-Hussein gravatar image Abou-Hussein  ( 2016-06-20 23:56:49 -0500 )edit

I used "roslaunch "file_name.launch" which is the standard way of calling a launch file.

gpldecha gravatar image gpldecha  ( 2016-06-21 01:46:46 -0500 )edit

Appreciate your quick response, it worker. Is there command to edit a certain joint value from the terminal instead of the GUI? I can't find any documentation on that

Abou-Hussein gravatar image Abou-Hussein  ( 2016-06-21 06:53:57 -0500 )edit

You can do it via command line, but you need a ros_control. I would recommend you follow a tutorial or ros_control if you are new to ros: ROS Control

gpldecha gravatar image gpldecha  ( 2016-06-21 07:15:02 -0500 )edit

Question Tools

1 follower


Asked: 2015-03-19 05:14:02 -0500

Seen: 4,422 times

Last updated: Mar 19 '15