New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tcp_no_delay to joint_states subscriber #80
Conversation
Thanks for the pull request @v-lopez! Would you mind providing a short example I can run that shows the improvement? I am a bit surprised setting |
Hi @sloretz I have pushed a branch that contains some logging to display the delays between each callback call. To test, checkout that branch: https://github.com/pal-robotics/robot_state_publisher/tree/tcp-no-delay-debugging Compile it and compile the tests. Launch test robot_description and rosbag play of /joint_states at 100Hz: You will see that a WARN log is printed each callback, something along these lines:
If you set the tcpNoDelay to false on https://github.com/pal-robotics/robot_state_publisher/blob/tcp-no-delay-debugging/src/joint_state_listener.cpp#L73
I don't know the actual rate of the rosbag, but you can see from the logs that with tcpNoDelay set to false, the messages typically arrive with 0.0000 or 0.04 second delay, when it's set to true, the rate is not so extreme. We are still working on indigo, so I can't provide you with real robot data from kinetic. |
Hi @v-lopez, Thanks for the instructions. I'm having trouble reproducing bundled joint state messages. Would you mind checking for mistakes in my setup? I'm testing using this launch file <?xml version="1.0"?>
<launch>
<param name="robot_description" textfile="$(find robot_state_publisher)/test/two_links_moving_joint.urdf" />
<node pkg="robot_state_publisher" name="robot_state_publisher" type="robot_state_publisher" output="screen"/>
<node pkg="joint_state_publisher" name="joint_state_publisher" type="joint_state_publisher">
<param name="rate" value="100"/>
</node>
</launch> I expanded the debugging output to print a mean and standard deviation once every 10 seconds. Here's the diff with
Then I ran both with and without With
With
Neither run looks like |
Sorry it took me a while to understand how this could work. When a subscriber and publisher connect the subscriber header has a field @clalancette If this looks OK to you, I would like to merge it and cherry-pick onto |
Thanks for the pull request @v-lopez ! |
* Add tcp_no_delay to joint_states subscriber * Describe how subscriber NODELAY gets to publishers
Hi @sloretz sorry I could not answer your comment until today. With the tests you mentioned, did you manage to see the std_dev variations in the end? |
Hi @v-lopez, I wasn't able to reproduce joint_state messages being combined in the same packet. However I did check the code path that |
Awesome, would it be possible to have a release on kinetic including these changes? |
@v-lopez FYI |
Setting no delay to true prevents that some joint_states messages are bundled and sent in pairs, reducing the period to which we receive new data to half and causing some tf joints to go at 25Hz instead of 50Hz.
This can be observed by running
rostopic hz /joint_states
: