ros-controls / ros_controllers

Generic robotic controllers to accompany ros_control
http://wiki.ros.org/ros_control
BSD 3-Clause "New" or "Revised" License
547 stars 524 forks source link

update old pos before publishing odom #599

Open 1hada opened 2 years ago

1hada commented 2 years ago

The PR solves a bug where the joint state positions used by odometry are non-zero by the time a controller starts.

We have found that as our hardware interface begins, and the peripheral devices initialize, the first joint states read by the controller are nonzero.

Fixing the bug from within the odometry class is more robust than implementing a position offset in the hardware interface. The reason it’s more robust is because :

example :

  • robot initialization
  • controller stops it solves an edge case where the controller and it’s odometry instance are destroyed, the destruction results in a similar scenario as the robot initialization where a non-zero old position is essential to maintaining reasonable velocity values / converging to the more accurate velocity values faster.

The PR maintains undefined behavior if the hardware interface shuts down and thus creates a large change in odometry based on a hardware failure, such a case would have still existed with out the fix.