|
Re: Omnidrive Programming
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.
|