2018/testing-code/MecanumStrafeTest.c
// Given a holonomic, 4-wheel Mecanum drive and three joystick values, this
// function moves the robot in the desired direction.
//
// To strafe left and right, simply provide a value for leftRight (and maybe
// forwardBack) without providing a value for the turning channel.
//
// Remember that this function provides instantaneous motion, and must be
// called in a loop to take place continuously.
//
// Arguments:
// - leftRight: The value sent by the left-right joystick channel (-127 for
//   full leftward motion and 127 for full rightward motion.)
//
//   This is usualy Ch3 on the left joystick.
//
// - forwardBack: The value sent by the forward-back joystick channel (-127
//   for full leftward motion and 127 for full rightward motion.)
//
//   This is usually Ch4 on the left joystick.
//
// - turn: The value sent by the turning joystick channel (-127 to turn left
//   at full speed and 127 to turn right at full speed.)
//
//   This is usually Ch1 on the right joystick.

Given a holonomic, 4-wheel Mecanum drive and three joystick values, this
function moves the robot in the desired direction.

To strafe left and right, simply provide a value for leftRight (and maybe
forwardBack) without providing a value for the turning channel.

Remember that this function provides instantaneous motion, and must be
called in a loop to take place continuously.

The value sent by the left-right joystick channel (-127 for
full leftward motion and 127 for full rightward motion.)

This is usualy Ch3 on the left joystick.

The value sent by the forward-back joystick channel (-127
for full leftward motion and 127 for full rightward motion.)

This is usually Ch4 on the left joystick.

The value sent by the turning joystick channel (-127 to turn left
at full speed and 127 to turn right at full speed.)

This is usually Ch1 on the right joystick.
Given a holonomic 4 - wheel Mecanum drive and three joystick values this function moves the robot in the desired direction . To strafe left and right simply provide a value for leftRight ( and maybe forwardBack ) without providing a value for the turning channel . Remember that this function provides instantaneous motion and must be called in a loop to take place continuously . The value sent by the left - right joystick channel ( - 127 for full leftward motion and 127 for full rightward motion . ) This is usualy Ch3 on the left joystick . The value sent by the forward - back joystick channel ( - 127 for full leftward motion and 127 for full rightward motion . ) This is usually Ch4 on the left joystick . The value sent by the turning joystick channel ( - 127 to turn left at full speed and 127 to turn right at full speed . ) This is usually Ch1 on the right joystick .
void mecanumDrive(int leftRight, int forwardBack, int turn) {
	if (leftRight < -127) {
		leftRight = -127;
	}
	if (leftRight > 127) {
		leftRight = 127;
	}
	if (forwardBack < -127) {
		forwardBack = -127;
	}
	if (forwardBack > 127) {
		forwardBack = 127;
	}
	if (turn < -127) {
		turn = -127;
	}
	if (turn > 127) {
		turn = 127;
	}
	motor[frontRight] = forwardBack - turn - leftRight;
	motor[backRight] =  forwardBack - turn + leftRight;
	motor[frontLeft] = forwardBack + turn + leftRight;
	motor[backLeft] =  forwardBack + turn - leftRight;
}
void mecanumDrive ( int leftRight , int forwardBack , int turn ) { if ( leftRight < -127 ) { leftRight = -127 ; } if ( leftRight > 127 ) { leftRight = 127 ; } if ( forwardBack < -127 ) { forwardBack = -127 ; } if ( forwardBack > 127 ) { forwardBack = 127 ; } if ( turn < -127 ) { turn = -127 ; } if ( turn > 127 ) { turn = 127 ; } motor [ frontRight ] = forwardBack - turn - leftRight ; motor [ backRight ] = forwardBack - turn + leftRight ; motor [ frontLeft ] = forwardBack + turn + leftRight ; motor [ backLeft ] = forwardBack + turn - leftRight ; }
Given a holonomic, 4-wheel Mecanum drive and three joystick values, this
function moves the robot in the desired direction.
Given a holonomic 4 - wheel Mecanum drive and three joystick values this function moves the robot in the desired direction .