Closed-loop proportional motion control algorithm.

Been trying to get this algorithm right. I read it in Siegwart & Nourbakhsh's Intro to Autonomous robotics.

It involves describing the position of a robot in polar coordinated (p, a, b) where p = straight line distance from robot's position (x,y in euclidean space), a = angle from Xr (robots frame of ref) to p and b angle of p to interial frame (assume interial frame and goal frame are same).

So it works great when the goal is infront of the robot (a = -pi/2 to pi/2) but it fails when the goal is behind. The alogorithm should have the robot go in reverse in that case (not turn around and go forward).

Heres what I got (written for octave, matlab compatable).

clear;

x = 0; y = 20; theta = pi/2; dT = 0.01; kp = 3; ka = 8; kb = -1.5;

t = 1; rho(t) = sqrt(x^2 + y^2); a = atan2(-y,-x); alpha(t) = -theta+a beta(t) = -theta-alpha(t)

if (alpha(t) > -pi/2 && alpha(t) 0.1 || abs(alpha(t)) > 0.1 || abs(beta(t)) > 0.1) && t < 300 )

#if (alpha(t) < -pi) # alpha(t) = alpha(t) + 2*pi; #elseif (alpha(t) > pi) # alpha(t) = alpha(t) - 2*pi; #endif

v = kp*rho(t) w = ka*alpha(t) + kb*beta(t)

rhod = -cos(alpha(t))*v*direction alphad = sin(alpha(t))/rho(t)*v*direction - w*direction betad = -sin(alpha(t))/rho(t)*v*direction

rho(t+1) = rho(t) + rhod*dT alpha(t+1) = alpha(t) + alphad*dT beta(t+1) = beta(t) + betad*dT

t = t + 1;

endwhile

polar(-beta+pi,rho)

Some things it states, alpha and beta should always be between -pi and pi. Alpha above blasts out, so what do you do? I implement a 'wrap around' which is commented out but that doesnt work.

Anyone familiar with this control scheme care to lend a hand!

Thanks, Chris

Reply to
Chris Fairles
Loading thread data ...

Reply to
Chris Fairles

Until you added this above line I was confused why it had -x and -y in

a = atan2(-y,-x);

But 0,0 is your origin, the point you're going back to, so the robots position is from the origin.

You know, in my navigation programming I had the robot turn around, so it was always traveling forward. Made for better application of any sensors also pointed forward.

You did notice, didn't you the direction detection:

if (alpha(t) > -pi/2 && alpha(t) 0.1 || abs(alpha(t)) > 0.1 || abs(beta(t)) > 0.1) && t < 300 ) ...etc.

so the direction never changes, should an overshoot occur or what not (more likely a real world problem than a simulation one).

Now about your "commented out" angle limiting code...

#if (alpha(t) < -pi) # alpha(t) = alpha(t) + 2*pi; #elseif (alpha(t) > pi) # alpha(t) = alpha(t) - 2*pi; #endif

you do not choose a unique value of +pi or -pi. Either can pass, adn they both represent the same angle. In fact. the code has a strong posibility when at the angle, of it being -pi one time, and +pi the next pass. You need to chose what the angle directly behind the robot is, whether -pi or +pi.

In the direction finding code, you used alpha(t) > -pi/2 which excluded -pi/2 from being a positive direction and alpha(t)

Reply to
Randy M. Dumse

This is correct, the robot should not have to 'turn around' from start to finish. If the goal is behind the robot, it should back up to the goal. This is just a simulation, point a to point b, in real world yes, path will change robot may turn around etc.

Sorry this is unclear, w = angular velocity of robot (theta-dot) in the inertial refernce frame. But the rotation is same in robot frame and intertial frame.

rho (p looks like rho, same thing :D) = sqrt((-x)^2 + (-y)^2) = straight line distance from robot to orgin alpha = -theta + arctan(-y / -x) = angle of robots frame to rho, the straight line to goal (want this to be zero so robot is heading straight for goal)

beta = -theta - alpha = angle of rho to inertial frame. want this to be whatever orientation the robot should end up in at the goal, in my case facing to the right (0 degrees).

Theta is the inital angle of the robots reference frame to the inertial reference frame.

Havent taken into account your suggestions yet, but thanks. I wish i could draw a diagram for you! would make it much easier to visualize. I haven't worked with polar coordinates in a long time which is what beta and rho are.

Reply to
Chris Fairles

Your basic problem is with the line, w = ka*alpha(t) + kb*beta(t) . alpha and beta must go to 0 for the proportionality concept to work. If you want to go to alpha = -pi, you have to have a term, ka*(alpha(t)+pi), which will go to 0 as alpha goes to -pi, but this still can run away.

In fact, I didn't find stability when I set theta=0 to get direction=1 using your code translated into C.

What kind of behavior is being sought?

Lew Mammel, Jr.

Reply to
Lewis Mammel

... if you make the appropriate change in the law of motion, having the robot go backwards is the same thing as starting it out pointed in the opposite direction and moving forwards, so the whole thing seems to be a formal exercise.

Reply to
Lewis Mammel

I was setting up theta incorrectly.

Of course, it's trying to approach the origin with beta = 0.

I found that with these changes : ( Note C language )

< if (alpha(t) > -pi/2 && alpha(t) if (alpha > -pi/2 && alpha delta = 0;

/* and */

< w = ka*alpha(t) + kb*beta(t) < < rhod = -cos(alpha(t))*v*direction < alphad = sin(alpha(t))/rho(t)*v*direction - w*direction < betad = -sin(alpha(t))/rho(t)*v*direction

... I get identical results for initial theta = pi/2 and theta = -pi/2, giving initial alpha = pi and 0, respectively :

( I converted angles to degrees for output )

t = 268, rho = 0.00711315, alpha = -177.738, beta = 5.77617 t = 268, rho = 0.00711315, alpha = 2.2619, beta = 5.77617

This is line with my comments in my "besides" post.

I think the proportional control of the steering is a little funky. It would make more sense just to set theta after each iteration, since this would just correspond to setting an initial heading and then adjusting it incrementally thereafter.

Setting an absolute rate of turn proportional to the angle magnitude factor doesn't correspond to any sort of engineering concept of steering that I can see.

Lew Mammel, Jr.

Reply to
Lewis Mammel

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.