Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Holonomic Drive Mathmatics Discussion (http://www.chiefdelphi.com/forums/showthread.php?t=36205)

robotaddict 15-03-2005 00:17

Holonomic Drive Mathmatics Discussion
 
Have we all heard of holomonic drives here? If not let me expound... A holomonic drive uses things called "omniwheels" which are sort of like normal wheels, but with rollers mounted along the wheel which allow it to move perpendicular to the plane of the wheel. If you mount four of these with one pair perpendicular to the other. This allows motion in any direction from any starting position.

Now comes the interesting part, how on earth do you control this darn thing?! Sure you can move in any direction, but this would confuse any mortal driver. So I had the "brilliant" idea of using a gyro to give the robot absolute direction, that is when you push the stick away and it goes away, and vice versa, but in uncomplicating the drivers' job I have complicated my own. Now not only must the joystick inputs be scaled and realigned, but now they must be modified by the gyro's output, too. Oi. So here are some rudimentary equations...

true y input = (cos(angle from origin) * original y input) + (sin(angle from origin + 90) * original x input)

true x input = (cos(angle from origin + 90) * original x input) + (sin(angle from origin) * original y input)

You can see my dillema, especially after you add the z axis, though it should be a good deal simpler... PLEASE ADVISE! :ahh:

The Lucas 15-03-2005 01:25

Re: Holomonic Drive mathmatics discussion
 
I developed a simple kiwi drive (wheels mounted at 45 degree angles) code for a prototype; let’s see if I remember it correctly. I used code very similar to the default 1 joystick code for translational (no spinning) movement. You can put your angle adjusted p1_x and p1_y axis into the translational code. Obviously, the motors have to be linked diagonally.

LF/---\RF
....| |
LR\---/RR

LF - left front motor
LR - left rear motor
RF - right front motor
RR - right rear motor

Code:

RF = LR = Limit_Mix(2000 + p1_y + p1_x - 127);
LF = RR = Limit_Mix(2000 + p1_y - p1_x + 127);

Now for spin:
Still it is pretty simple and much like the default code. You need a spin joystick (p2_x). Now left and right sides are pretty much linked.

Code:

RF = Limit_Mix(2000 + RF + p2_x - 127);
RR = Limit_Mix(2000 + RR + p2_x - 127);
LF = Limit_Mix(2000 + LF - p2_x + 127);
LR = Limit_Mix(2000 + LR - p2_x + 127);

As I remember, this works pretty well. Now just keep track of your gyro. Watch out for drift over time, as the error compounds. I would put some filter caps in the gyro to reduce the error. Also make sure your motors are all running in the same direction. GOOD LUCK!

Don Wright 15-03-2005 06:26

Re: Holomonic Drive mathmatics discussion
 
Another thought I had when thinking about controlling this type of drive system using a gyro to note rotation would be a button on the OI to "Reset" the gyro to zero or something if it got out of whack.

You drive the robot so it faces the correct rotation for zero, for example, and the hit the "Reset" button and it knows that is supposed to be zero again.

Also, I was thinking that if you just used a pot for rotation and a joystick for movement, and instead of using gyros for absolute movement, you still have a front, you could do really cool thinks like effortlessly drive in a perfect circle. You would just turn the pot to rotate a little, and then drive left or right. As the robot drives left or right, it will rotate and cause you to drive in a circle. Thought that might be kind've cool. We would also have a foot switch or something to "Disable Rotation" so you could quickly stop the rotation and drive normally.

Good luck.

Adam Y. 15-03-2005 08:07

Re: Holomonic Drive mathmatics discussion
 
Quote:

You can see my dillema, especially after you add the z axis, though it should be a good deal simpler... PLEASE ADVISE!
Why do you need to be able to control the robot in the z axis? If x and y are on the ground then that would the z axis pointing up in the air.

seanwitte 15-03-2005 09:27

Re: Holomonic Drive mathmatics discussion
 
A pretty good decription is available in the article titled "Closed Loop Motion Control for Mobile Robots" by Rich LeGrand. You can buy it for $1.50 here:

http://www.circuitcellar.com/magazine/169toc.htm

Includes all of the kinematics equations you need for a four-wheel holonomic robot.

Rick TYler 15-03-2005 10:10

Re: Holomonic Drive mathmatics discussion
 
Quote:

Originally Posted by Adam Y.
Why do you need to be able to control the robot in the z axis? If x and y are on the ground then that would the z axis pointing up in the air.

I believe John meant x and y to be movement in the horizontal plane and z to be rotation of orientation. Unless he wanted the robot to fly, which, knowing John, might be his intention...

Andrew Rudolph 15-03-2005 20:29

Re: Holomonic Drive mathmatics discussion
 
Im not the programmer for our team, but we have had holonomic robots the last 2 years. We have found the best way is to have one joystick sort of the strafe joystick. push the stick forward and it makes the bot drive to the front, and pretty much it goes where ever you move the stick. Then another stick the controls the rotation. We have been devolping a system using a gyro to help correct for slippage. SPAM had a system last year that they could push the stick away from the driver and tbe bot would go away from you.

KTorak 15-03-2005 20:38

Re: Holomonic Drive mathmatics discussion
 
wow. I wanted to know how teams did this as I saw a few at GLR with 4 omni wheels that rotated...We used them on the front of the robot and 2 drive wheels in the back and it works out well..except omni wheels crack and break after rough use (competition)...so to anyone who uses them, watch them closely for cracking and sperating...and good luck :D

EricS-Team180 15-03-2005 22:28

Re: Holomonic Drive mathmatics discussion
 
Quote:

Originally Posted by Andrew Rudolph
SPAM had a system last year that they could push the stick away from the driver and tbe bot would go away from you.

yep...
That was what we called "steadySPAM", here's how it worked:

steadySPAM:
Given the joystick X and Y,
1) find the joystick angle of rotation, theta
2) find the joystick magnitude

Given the robot angular orientation psi, subtract it from theta.

From this new theta' and the magnitude,
find a new joystick X and Y

Use the new joystick X and Y to determine the inputs
for the motors.

so:
...given joyx, joyy and robot angular orientation wrt the field, theta.

1) First, I'd flip the joystick x-axis, since it hurts my head to have values
increasing to the left, then, move the origin to 0,0:

joyy1 = joyy-127
joyx1 = (255-joyxx)-127

Next, get the joystick angle of rotation:
note: ...must trap divide by zero
if joyy = 127 and joyx = 127, then
joytheta = 0 // neutral
else if joyy = 127, then
if joyx <= 127, then
joytheta = 90 // right
else
joytheta = -90 // left
else
joytheta = arctan(joyx1/joyy1)

and the magnitude:
joyspeed = sqrt(joyy1*joyy1 + joyx1*joyx1)

You can get the robot psi by using a yaw rate sensor and integrating. We defined theta and psi similar to, but not quite like a compass. Straight up field is 0deg. Rotating to the right the angle changes from 0 to 180 deg. Rotating to the left the angle changes from 0 to -180deg.

Subtract psi from theta,
joytheta' = joytheta - psi

The new joystick x and y are:
joyx' = 255 - (joyspeed*sin(joytheta')+127)
joyy' = joyspeed*cos(joytheta')+127

(Use these to calculate the motor outputs. You can use the default code mixing equation, but we included an additional 45deg rotation on top of that.)

However, using robotaddicts equations, you can do something similar and avoid an arctan and a square root:

...given joyx, joyy and robot angular orientation wrt the field, theta.

1) First, adjust the joystick axes:

joyy1 = joyy-127
joyx1 = (255-joyxx)-127

2) Next rotate the joystick axes into the orientation of the robot.

joyy2 = joyy1*cos(theta) + joyx1*sin(theta)
joyx2 = joyx1*cos(theta) - joyy1*sin(theta)

Now, get back to a typical joystick set of axes:

joyy' = joyy2+127
joyx' = 255- (joyx2+127)


This took care of translation. For rotation, we had a separate stick and applied it similar to "The Lucas"

Thanks,
Eric

probizzle 15-03-2005 22:38

Re: Holomonic Drive mathmatics discussion
 
One quick comment that I would have is to also make a back-up drive system, which drives whatso-ever direction from the point of view of the robot. Your drivers I hope played enough video games to get this figured out (easily).

Just in case....
(and because your drivers actually might like this better, and because your absolute positioning system is going to drift, and it will be a hassle for drivers to figure out when to reset. etc.)

seanwitte 16-03-2005 09:17

Re: Holomonic Drive mathmatics discussion
 
Quote:

Originally Posted by probizzle
One quick comment that I would have is to also make a back-up drive system, which drives whatso-ever direction from the point of view of the robot. Your drivers I hope played enough video games to get this figured out (easily).

Just in case....
(and because your drivers actually might like this better, and because your absolute positioning system is going to drift, and it will be a hassle for drivers to figure out when to reset. etc.)

By using the driver's reference frame instead of the robots (move the joystick forward and the robot drives away from you, no matter which direction its facing) allows you to translate AND rotate at the same time. The other holonomic implementations don't allow you to have this "frisbee" motion. All you need is a pot or a set of buttons to adjust the robot's perceived heading if it drifts. It has the added bonus of making it easier to use the gyro as feedback to cancel unwanted rotation.

Donut 16-03-2005 20:06

Re: Holomonic Drive mathmatics discussion
 
This drive system is so weird to program. We tried it with a normal robot this year, but didn't have enough time to finish. If you write your own code for finding the magnitude and direction of the joystick, avoid using arctan and square root functions at all costs (or make your own versions of them). We wrote our own square root function, but found out a little too late that an arctan2() call chews up 12% of your code space.

EricS-Team180 17-03-2005 08:34

Re: Holomonic Drive mathmatics discussion
 
Quote:

Originally Posted by Donut
If you write your own code for finding the magnitude and direction of the joystick, avoid using arctan and square root functions at all costs...

We decided at the outset to use integer math, so I don't have any data on using floating point. Your experience, however, is insightful. We wrote table lookups for sine/cosine and arctan, and, like you, wrote an integer square root. We had no timing problems with the main loop.

Eric

gc02 17-03-2005 10:28

Re: Holomonic Drive mathmatics discussion
 
Quote:

Originally Posted by robotaddict
You can see my dillema, especially after you add the z axis, though it should be a good deal simpler... PLEASE ADVISE! :ahh:

Here's the equations for a three wheel holonomic base. Since you're using 4 wheels that are aligned on primary axises, you should be able to simplify it somewhat.

I tried simulating a 3 wheel holonomic base, and it was virtually (no pun intended) uncontrollable without some sort of PID. I guess 4 wheels shouldn't be quite as bad though.

The Lucas 17-03-2005 13:08

Re: Holomonic Drive mathmatics discussion
 
Quote:

Originally Posted by gc02
[url=http://www-2.cs.cmu.edu/~reshko/PILOT/physics.html]I tried simulating a 3 wheel holonomic base, and it was virtually (no pun intended) uncontrollable without some sort of PID. I guess 4 wheels shouldn't be quite as bad though.

I think Wildstang built a 3 wheel holonomic back in 2001 or 2002. They didn't use it in competition, they just distributed a really cool video (as Raul and those guys tend to do). If they got that thing to work on one of those old PBASIC Stamps, so it shouldn’t require to much processing. Of course they wrote StangPS on a Stamp, so it might require a lot of processing.


All times are GMT -5. The time now is 07:46.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi