X drive

So i have way too much free time, so I used i to build an X drive from IQ parts. Everything works fine. Forward, backward, sideways and diagonal. But, my turning is weird. My front left motor spins in the opposite direction, not allowing proper turning. I have forward/backwards/sideways on the left joystick and turning on the right joystick. What exactly do I have wrong here?

Code:

#pragma config(Motor, motor2, FL, tmotorVexIQ, PIDControl, encoder)
#pragma config(Motor, motor6, FR, tmotorVexIQ, PIDControl, encoder)
#pragma config(Motor, motor7, BL, tmotorVexIQ, PIDControl, encoder)
#pragma config(Motor, motor12, BR, tmotorVexIQ, PIDControl, reversed, encoder)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

task main()
{
repeat(forever)

{
	setMotorSpeed(BL, getJoystickValue(ChA) + getJoystickValue(ChC) - getJoystickValue(ChB));
setMotorSpeed(FL, getJoystickValue(ChA) - getJoystickValue(ChC) + getJoystickValue(ChB));
setMotorSpeed(BR, getJoystickValue(ChB) - getJoystickValue(ChC) + getJoystickValue(ChA));
setMotorSpeed(FR, getJoystickValue(ChB) + getJoystickValue(ChC) - getJoystickValue(ChA));
}

}

This is most likely where it goes wrong. Either having that reversed or one of the other motors not reversed, depending on how you place them, could cause one to go backwards. Hope this helps. :slight_smile:

2 Likes