tu-darmstadt-ros-pkg / hector_gazebo

hector_gazebo provides packages related to the simulation of robots using gazebo (gazebo plugins, world files etc.).
http://www.ros.org/wiki/hector_gazebo
181 stars 155 forks source link

Add case for rotating in place in odometry #75

Closed RBinsonB closed 3 years ago

RBinsonB commented 3 years ago

My previous PR #71 added support for holonomic vehicles by taking in account the Y axis. I realized that there is a possibility for a bug when the traveled distance distChange is equal to zero, as the angleDriveDirection would become invalid because of a division by zero.

const double angleDriveDirection = std::acos(distX / distChange);

This was not happening when I tested PR #71 because of Gazebo noise/imprecision, but I think it would be good of addressing it for the sake of robustness.

StefanFabian commented 3 years ago

Thank you for the update! That is indeed something that should be addressed even though it will only happen if distChange is exactly zero.