Skip to content
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 case for rotating in place in odometry #75

Merged

Conversation

RBinsonB
Copy link
Contributor

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.

Odometry calculations were not taking in account the case of the robot rotating in place. This
would cause a division by zero and make the plugin return invalid data. This commit handles this
case by not using the arc method if the distance traveled by the robot is close to zero.
Only the displacement along X and the combined displacement were used to
calculate the angle between the X-axis and the robot drive direction.
This resulted in a positive angle whatever if the displacement along Y
was positive or negative. This commit addresses the issue by using both
displacements along X and Y to calculate the angle.
@StefanFabian
Copy link
Member

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

@StefanFabian StefanFabian merged commit 6f48c85 into tu-darmstadt-ros-pkg:kinetic-devel Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants