Ask Your Question

Yaw problem in my wall following algorithm

asked 2012-10-02 14:40:35 -0500

leivas_gabriel gravatar image

updated 2014-04-20 14:09:41 -0500

ngrennan gravatar image


I'm trying to create a wall following algorithm, but I'm having some problem. Essentially my code use laser to extract a line and calculate the slope (locally to the robot, so from 0 to 2*pi) but to make the control I need the robot yaw (0 to 3.14 and -3.14 to 0) so when I have a negative yaw for example -1.59 and a slope of 1.61 my error that is error=(slope-yaw). Causes the robot turn to the wrong direction :(

Somebody already have the same problem with angles in ROS ?

Gabriel Oliveira

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-10-02 16:02:22 -0500

updated 2012-10-02 19:02:39 -0500

If you're using an error in an angle to feed a controller you generally need to wrap the error to be between -pi and pi as well. The way I normally do this is with the mod function in whatever language you're using. For example, the following will give an error that is always between -pi and pi

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-10-02 14:40:35 -0500

Seen: 553 times

Last updated: Oct 02 '12