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 jointstatepublisher 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 robotstatepublisher to take the information from the /joint_states topic. Any ideas ?
Asked by gpldecha on 2015-03-19 05:14:02 UTC
Answers
Solved the problem. I had to use the source_list parameter of the joint_state_publisher
<?xml version="1.0"?>
<launch>
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
<rosparam param="source_list">["hand_model/joint_states"]</rosparam>
</node>
<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" />
</launch>
Asked by gpldecha on 2015-03-19 10:04:13 UTC
Comments
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
Asked by Abou-Hussein on 2016-06-20 23:56:49 UTC
I used "roslaunch "file_name.launch" which is the standard way of calling a launch file.
Asked by gpldecha on 2016-06-21 01:46:46 UTC
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
Asked by Abou-Hussein on 2016-06-21 06:53:57 UTC
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
Asked by gpldecha on 2016-06-21 07:15:02 UTC
Comments