How to solve delay in tf broadcast by robot_pose_ekf?
I'm getting a weird problem that appeared suddenly even though no code was changed. I'm using robot_pose_ekf to get /odom->/base_footprint. It listens to only the wheel encoder odometry topic. robot_state_publisher broadcasts the rest of the robot transforms.
The problem that I noticed is the laser readings tend to follow the rotating robot base frame for a few milliseconds, before snapping back to the correct position with respect to the odom frame (fixed frame).
I've tried to recalibrate the robot's odometry but there is nothing wrong with the current parameters. There's also nothing obviously wrong with the laser readings (they read correct ranges).
So far I've traced a possible cause being the robot_pose_ekf broadcasting the /odom->/base_footprint transform with a slight delay. This is one of the output from tf_monitor:
RESULTS: for all Frames
Frames:
Frame: /base_footprint published by /robot_pose_ekf Average Delay: 0.026657 Max Delay: 0.256319
Frame: /base_link published by /robot_state_publisher Average Delay: -0.4933 Max Delay: 0
Frame: /front_wheel_link published by /robot_state_publisher Average Delay: -0.493298 Max Delay: 0
Frame: /gyro_link published by /robot_state_publisher Average Delay: -0.493296 Max Delay: 0
Frame: /laser published by /robot_state_publisher Average Delay: -0.493295 Max Delay: 0
Frame: /layer2_link published by /robot_state_publisher Average Delay: -0.493293 Max Delay: 0
Frame: /left_wheel_link published by /robot_state_publisher Average Delay: -0.195695 Max Delay: 0
Frame: /right_wheel_link published by /robot_state_publisher Average Delay: -0.195693 Max Delay: 0
Frame: /wheel_axis_link published by /robot_state_publisher Average Delay: -0.493292 Max Delay: 0
All Broadcasters:
Node: /robot_pose_ekf 15.0581 Hz, Average Delay: 0.026657 Max Delay: 0.256319
Node: /robot_state_publisher 22.4744 Hz, Average Delay: -0.294113 Max Delay: 0
The max delay as seen, is over 200ms. The question is, how do I fix this? I've tried to change the publish rate of the odometry, the robot_pose_ekf and the robot_state_publisher, but nothing seems to help. In fact, the average delay increases as the robot moves more.
Any ideas where I should be tweaking?
possibly related question: http://answers.ros.org/question/36232/clear-obstacles-resulting-from-skewed-laserscan/#36256
I'd also worry about all the other max delays being zero. It's impossible to have an average delay of something and a max delay of zero. But I also notice that all the state_publisher delays are negative. Are you per chance running the EKF at a faster rate than the state_publisher?
The max delays being zero is an artifact of the initialization of the max at zero. Where all the values are negative.