joint_state_publisher doesn't fully update source_list with use_gui=true [closed]
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