ros / ros_tutorials

Code used in tutorials found on ROS wiki
http://wiki.ros.org/ros_tutorials
805 stars 540 forks source link

Angle wrapping in draw_square.cpp #43

Closed jarvisschultz closed 6 years ago

jarvisschultz commented 6 years ago

Now that this commit has been merged, the turtlesim is guaranteed for its pose to always be in [-pi, pi). However, when checking if the turtle has reached its goal, a simple fabs is used. This results in the turtle never being able to complete its square as reported in this answers.ros.org question.

A very easy fix was to include angles as a dependency and then use angles::shortest_angular_distance. If we are okay with modifying dependencies for this package, then I'd happily open a PR from my fork. We could, of course, also write a similar function inline if we didn't want to modify dependencies.

dirk-thomas commented 6 years ago

angles is not part of the ROS core metapackage and therefore ros_tutorials can't use it.

Please consider to propose a patch to the tutorial code which implements a similar function to perform the correct check.

dirk-thomas commented 6 years ago

Addressed by #46.