mec wheels

can anyone tell me how to program mec wheels so that when I push both joystick up the robot will go forward , both down the robot goes backwards, 1 up and one down it spins, push the righe one to right it moves to right and push the left one it goes left

This post should help: http://www.robotc.net/blog/2011/11/22/vex-mecanum-drive-using-robotc/

jbflot having trouble getting to robotc.net any suggestions?

Below is a segment from the blog post that contains the relevant code information; as long as you have the wheels configured correctly (they should form an ‘X’ pattern when looking down at the robot) the code should work.

"To give the wheels a test run, we built the robot below. Notice that if you’re looking down on the robot, the spokes or rollers of the wheels should point inward to create an X. If you’re looking at the bottom of the robot, they should point out to create a baseball diamond. There are two sets of two wheels - all four are not identical.

When you decide to incorporate your own mecanum drive system, be sure to follow the X/diamond rule or your robot will not behave as expected. Also know that equal weight distribution and consistent build quality are far more important when working with a mecanum drive. Remember that the robot moves based on adding and/or cancelling out the different force vectors produced by the four individual motors – if one or two motors can’t match the others the entire motion of the robot will be thrown off.

A fairly simple program can be written to test the mecanum drive system. This program will use the left joystick on the remote control to move the robot forward-backward and right-left. The X axis on the right joystick will control the rotation of the robot.

#pragma config(Motor, port2, frontRight, tmotorNormal, openLoop)
#pragma config(Motor, port3, backRight, tmotorNormal, openLoop)
#pragma config(Motor, port4, frontLeft, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port5, backLeft, tmotorNormal, openLoop, reversed)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

/*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++
Mecanum Drive - Basic

  • This program allows you to remotely control a robot with mecanum wheels.
  • The left joystick Y-axis controls the robot’s forward and backward movement.
  • The left joystick X-axis controls the robot’s left and right movement.
  • The right joystick X-axis controls the robot’s rotation.
  •      [Name]              [Type]                [Description]
    

Motor Port 2 frontRight VEX Motor Front Right motor
Motor Port 3 backRight VEX Motor Back Right motor
Motor Port 4 frontLeft VEX Motor Front Left motor
Motor Port 5 backLeft VEX Motor Back Left motor
--------------------------------------------------------------------------------------------------*/

task main()
{
//Loop Forever
while(1 == 1)
{
//Remote Control Commands
motor[frontRight] = vexRT[Ch3] - vexRT[Ch1] - vexRT[Ch4];
motor[backRight] = vexRT[Ch3] - vexRT[Ch1] + vexRT[Ch4];
motor[frontLeft] = vexRT[Ch3] + vexRT[Ch1] + vexRT[Ch4];
motor[backLeft] = vexRT[Ch3] + vexRT[Ch1] - vexRT[Ch4];
}
}

The program above, however, isn’t perfect. If the joysticks don’t center perfectly at zero, or if the driver unintentionally moves the joysticks along multiple axis, the movement of the robot will be thrown off. With a few variables and a little bit of logic, we can ignore these erroneous values and provide smoother control of the robot:

#pragma config(Motor, port2, frontRight, tmotorNormal, openLoop)
#pragma config(Motor, port3, backRight, tmotorNormal, openLoop)
#pragma config(Motor, port4, frontLeft, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port5, backLeft, tmotorNormal, openLoop, reversed)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

/*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++
Mecanum Drive with Deadzone Thresholds

  • This program allows you to remotely control a robot with mecanum wheels.
  • The left joystick Y-axis controls the robot’s forward and backward movement.
  • The left joystick X-axis controls the robot’s left and right movement.
  • The right joystick X-axis controls the robot’s rotation.
  • This program incorportes a threshold/deadzone that allows very low Joystick values to be ignored.
    This allows the robot to ignore values from the Joysticks when they fail to center at 0,
    and provides a margin of error for the driver when they only want the robot to move in one axis.
  •      [Name]              [Type]                [Description]
    

Motor Port 2 frontRight VEX Motor Front Right motor
Motor Port 3 backRight VEX Motor Back Right motor
Motor Port 4 frontLeft VEX Motor Front Left motor
Motor Port 5 backLeft VEX Motor Back Left motor
--------------------------------------------------------------------------------------------------*/

task main()
{
//Create “deadzone” variables. Adjust threshold value to increase/decrease deadzone
int X2 = 0, Y1 = 0, X1 = 0, threshold = 15;

//Loop Forever
while(1 == 1)
{
//Create “deadzone” for Y1/Ch3
if(abs(vexRT[Ch3]) > threshold)
Y1 = vexRT[Ch3];
else
Y1 = 0;
//Create “deadzone” for X1/Ch4
if(abs(vexRT[Ch4]) > threshold)
X1 = vexRT[Ch4];
else
X1 = 0;
//Create “deadzone” for X2/Ch1
if(abs(vexRT[Ch1]) > threshold)
X2 = vexRT[Ch1];
else
X2 = 0;

//Remote Control Commands
motor[frontRight] = Y1 - X2 - X1;
motor[backRight] = Y1 - X2 + X1;
motor[frontLeft] = Y1 + X2 + X1;
motor[backLeft] = Y1 + X2 - X1;
}
}"**