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

joint_state_publisher doesn't fully update source_list with use_gui=true [closed]

asked 2018-10-01 07:53:22 -0500

hyan gravatar image

I want to implement my own IK algorithm, so I add a source into the source_list parameter of joint_state_publisher node in the following test.launch file, in my hexapod package:

<launch>
<arg name="model" default="$(find hexapod)/urdf/hexapod2.xacro"/>
<arg name="gui" default="true"/>

<param name="robot_description" command="$(find xacro)/xacro --inorder $(arg model)" />

<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" >
    <rosparam param="source_list">["ik_joint_states"]</rosparam>
    <param name="use_gui" value="$(arg gui)"/>
</node>

</launch>

and

roslaunch hexapod test.launch

When I am done IK calculation, I want to publish the joint positions to topic "/ik_joint_states" and I expect joint_state_publisher will update. After the launch file is launched, in a second terminal I typed the command to monitor all joint positions of my robot (they are initially all zeros):

rostopic echo /joint_states

in a third terminal I publish faked joint positions to topic "/ik_joint_states", pretending I have calculated these joint positions:

rostopic pub -1 /ik_joint_states sensor_msgs/JointState "header:
seq: 0
stamp: {secs: 0, nsecs: 0}
frame_id: ''
name: ['leftFrontLeg_J01', 'leftFrontLeg_J12', 'leftFrontLeg_J23']
position: [1, 2, 3]
velocity: [] 
effort: []"

Strange thing happend, only one joint position got updated, as I can see from the second terminal. If I enter the above command again, another joint position got updated, so I will have to enter the command 3 times to get all 3 joint positions updated.

Then I read the source code of joint_state_publisher, I don't see any bug with the none-GUI part, so I relaunch the launch file with gui:=false

roslaunch hexapod test.launch gui:=false

and now the problem is gone, I enter the command once to get all 3 joint positions updated, which is what I expected. Is there a bug in joint_state_publisher with gui on? or have I done something wrong?

I am using ros kinetic on ubuntu 16.04.5

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by hyan
close date 2018-10-01 21:56:22.716568

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-10-01 21:06:22 -0500

Bruno Lima gravatar image

updated 2018-10-01 21:10:41 -0500

Hi,

At first I thought your issue was due to the lack of zeros at velocity and effort message fields for each joint. I tested adding them to the message, but the issue was still there, exactly as you explained.

My best guess is that joint_state_publisher was developed expecting you to choose one (and only) input source for your angles. The package documentation suggests (but does not confirm) it:

There are four possible sources for the value of each JointState:  
 1. Values directly input through the GUI
 2. JointState messages that the node subscribes to 
 3. The value of another joint
 4. The default value

It makes sense after all. Unless the sliders from the GUI autoupdate their values, there would be two different set of values competing against each other:

  • the one from the topic described in source_list;
  • and the one from the GUI.

Which one should the joints assume in dispute cases? Maybe the simple assumption was best suited at the time.

P.S.: The issue you described was marked as a bug in this Github issue.

edit flag offensive delete link more

Comments

Thank you!

hyan gravatar image hyan  ( 2018-10-01 21:54:56 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-10-01 07:49:40 -0500

Seen: 1,572 times

Last updated: Oct 01 '18