ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Yaw problem in my wall following algorithm

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

leivas_gabriel gravatar image

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

ngrennan gravatar image

Hi,

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
0

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

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

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

error=mod(slope-yaw+2*PI,2*PI)-PI
edit flag offensive delete link more

Question Tools

1 follower

Stats

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

Seen: 720 times

Last updated: Oct 02 '12