How to get robot_state_publisher to take the information from my /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 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.
Here 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 /joint_states
Type: sensor_msgs/JointState
Publishers:
* /hand_model (http://128.178.145.74:39519/)
Subscribers:
* /robot_state_publisher (http://128.178.145.74:36845/)
When I check the messages being published rostopic echo /joint_states:
seq: 23721
stamp:
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:
I am unsure how to get robot_state_publisher to take the information from the /joint_states topic. Any ideas ?