# Programming Andy Mark Killough Omni Directional Drive/ C++?

Hey everyone,

How would I use windriver to program the Killough Omni Directional Drive? Is there a present function for a four wheel Omni directional drive already? I know there is a function for Tank Drive and Arcade drive; is there something similar for Killough?

If not, do you know any manuals or do you have any suggestions? ::rtm::

Thank you very much!

I can’t tell you anything C++ specific, but I can tell you fairly generic things I learned in LabVIEW.

There might be a Holonomic Drive or Mecanum Drive class. If so, that is what you want. I know it exists in LabVIEW, but I do not know about C++.

If there is not, you can write a function or class to utilize four motor controllers in a holonomic arrangement and a vector from the joystick.

http://www.chiefdelphi.com/media/papers/1836

It is all in the math if you are just looking for open loop control. Now if you want field oriented control or feedback that is a different story

look at the mecanum example, it is very similar to the holonomic calculations

good luck

-JSK

If you just want some practical help for writing your own mecanum code… you can write your own code, which uses -1 to +1 joystick output values, as follows:

Let x, y, and z be the rev/fwd, slide left/right, and spin CCW/CW joystick commands, respectively, which each vary from -1 to +1.

So:

x= -1 corresponds to full speed reverse, x= +1 corresponds to full speed forward,

y= -1 corresponds to full speed slide left, y= +1 corresponds to full speed slide right,

z= -1 corresponds to full speed spin CCW, z= +1 corresponds to full speed spin CW

If your joystick outputs don’t look like the above (eg the signs are reversed), simply convert them.

Let w1, w2, w3, and w4 be the commands to send to each of the 4 wheels, where w1 is front left, w2 is front right, w3 is rear left, w4 is rear right, as viewed from the top.

set the four wheel speed commands as follows:

w1 = x + y + z

w2 = x - y - z

w3 = x - y + z

w4 = x + y - z

You’re almost done. All that remains is to normalize the above commands so that their range is -1 to +1. Proceed as follows:

• look at the magnitude (absolute value) of each of the four commands, and select the MAXIMUM. for sake of discussion, call this maximum value Wmax
• if Wmax is less than or equal to 1, no scaling is required. Just use the four w commands as-is
• if Wmax is greater than 1, then divide EACH of the four w values by Wmax.

That’s all there is to it. Send each w command to the corresponding wheel.

One note of caution: make sure the polarity of the motors on each side of the bot is wired correctly (each wheel must be spinning in the “forward” direction when it gets a +1 command). The easiest way to observe this is to elevate the bot and push the joystick forward; all four wheels should be spinning forward.

Here’s a way to program tank drive on mecanum bot so that you can tune the joystick sensitivity to all three motions (fwd/rev, turn, stafe) independently:

Let X1 and Y1 represent the joystick outputs for the driver’s left-hand joystick;

Let Y2 represent the joystick outputs for the driver’s right-hand joystick (X2 is not used).

Y1 and Y2 control the bot like a standard tank drive for fwd/rev and spinning. X1 provides the strafe command.

When each joystick is pushed forward, its Y output should be positive. When the joystick is pushed to the right, its X output should be positive. If not, add code to invert the sign if necessary.

Let Kf, Kt, and Ks be the tuning parameters (0 to +1) for the forward/reverse, turn, and strafe motions, respectively.

Let W1, W2, W3, and W4 be the front left, front right, rear left, and rear right wheels, respectively. (“left” and “right” in this context means “port” and “starboard”, respectively)

Calculate the following:

Yf = (Y1 + Y2)/2

Yt = (Y1 - Y2)/2

Now calculate the four wheel speed commands:

W1 = KfYf + KtYt + Ks*X1

W2 = KfYf - KtYt - Ks*X1

W3 = KfYf + KtYt - Ks*X1

W4 = KfYf - KtYt + Ks*X1

Now normalize the wheel speed commands:

Let Wmax be the maximum absolute of the four wheel speed commands. If Wmax is greater than 1, then divide each of the four wheel speed commands by Wmax.

Finally, send each of the four normalized wheel speed commands to the respective wheels.

Adjust the values of Kf, Kt, and Ks (over the range 0 to +1) to adjust the joystick sensitivity for the forward/reverse, turn, and strafe motions, respectively.

If you want to understand the theory of mecanum kinematics and forces, take a look at these papers:

Inverse and Forward Kinematic Equations for 4-wheel mecanum vehicle:

http://www.chiefdelphi.com/media/papers/2390

Force vector analysis of 4-wheel mecanum vehicle:

http://www.chiefdelphi.com/media/papers/2385

Rebecca, don’t let the word “mecanum” fool you into ignoring the advice.

Stephen didn’t quite say it strongly enough: both mecanum and Killough are holonomic drivebases. The analysis and programming are the same for mecanum and for the AndyMark product you’re asking about.

(I myself usually reserve the name “Killough” for a holonomic platform using a specific kind of dual wheel, though many people will apply it to omniwheel platforms as well.)

Wow, Thank you all- apalrd, Stephen Kowski, Ether, Alan Anderson - SO much! =D It’s really appreciated!