0
$\begingroup$

Rosanswers logo

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


Originally posted by hyan on ROS Answers with karma: 23 on 2018-10-01

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Bruno Lima with karma: 81 on 2018-10-01

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by hyan on 2018-10-01:
Thank you!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.