# Omnidrive Programming

Our team is thinking about using an omnidrive this year. No one on our programming team has really done this before, so if anyone has any quick pointers or suggestions or advice, it’d be greatly appreciated.

Which type of omnidrive? That term could refer to an omniwheel design, mecanum design, or crab-steering design (in addition to some other, unlikely things…).

Aren’t you about a month early for making such decisions?

Anyway, the way I’d go about it is to do it in two steps. First, turn operator inputs into a conceptual trio of values: forward/backward velocity, left/right velocity, and rotation rate. The way you do that depends on what OI controls you use. Then, compute the individual motor speeds from the intermediate values. That conversion depends on what kind of wheels you use and how they’re mounted.

Mount the four wheels so that the axles are all perpendicular. Label them North, South, East, and West clockwise. The following formulas will drive the wheels, where x, y, and r are in the range -127 to 127.

x = (signed int)p1_x - 127;
y = (signed int)p1_y - 127;
r = (signed int)p2_x - 127;

North = x - r;
South = -x - r;
East = -y - r;
West = y - r;

A joystick connected to port 1 will control forward/backward and strafe left/right. The joystick on port 2 will control the rotation clockwise/anti-clockwise.

This previous post may be useful to you:

Holonomic Wheel Math

…and if you search, you will find others as well

Eric

Well, I don’t know about an actual omni-drive that uses omni-wheels (since an omni-wheel can only be powered in one direction of motion but move in two it gets confusing I suppose), but my team was designing a ball drive - a drive that has a ball at each corner that can move in two directions (left/right or up/down). Code can be found in this thread: