Closed JavaJeremy closed 7 years ago
While limiting the range of theta makes sense why should it be from 0
to 2pi
? Wouldn't a range from -pi
to +pi
be more intuitive?
@dirk-thomas isn't either method totally fine? In my experience both are used in everyday mathematics. The reason for this request is that the range is between [-_2_pi;+_2_pi] right now.
This is a demo application trying to show the most basic functionality in ROS. I am not sure if the interval of theta matters that much.
But if it should be changed to avoid allowing different values with the same semantic then I would suggest to normalize to [-pi, pi) since that is afaik the most common interval (others seem to have a similar opinion: e.g. http://answers.ros.org/question/61553/what-is-normalize/).
On Mon, Jun 27, 2016 at 11:16:29AM -0700, Dirk Thomas wrote:
This is a demo application trying to show the most basic functionality in ROS. I am not sure if the interval of theta matters that much.
It doesn't. But during an introduction @JavaJeremy got confused by this behavior and I proposed he should write a merge request. :-)
Personally, I think of [0;2pi) as more intuitive and even the link you cite acknowledges both intervals.
I just talked to him and he promised to adjust the interval. This code should do the trick (untested):
orient = orient + angvel * dt orient_ - 2_MPI * std::floor((orient + M_PI)/(2_M_PI)) @JavaJeremy: would you mind testing it and update the request?
@dirk-thomas I finally got around to adjust it, please merge.
Alright @dirk-thomas, I added a comment above the line that does the magic.
Thank you!
I just switched the target branch to lunar-devel
since that is now the default branch.
Range of
theta
now from 0 to 2PI not from -2PI to 2PI. No negative values when rotating clockwise now.Thanks for the help @v4hn!