|
Can't get motors to spin correct way.
We have successfully gotten our robot wheels (6 wheel tank drive, 2 motors on each side) to spin, however they are going the wrong way. We have tried inserting a negative in many places in our code, we have tried multiplying by -1 and nothing seems to work. With everything we tried, the wheels will still spin the wrong way (they will spin either way, but the joystick/spin is reversed). Here is that part of the code:
public void operatorControl() {
chassis.setSafetyEnabled(true);
while (isOperatorControl() && isEnabled()) {
Joystick1 = leftStick.getAxis(Joystick.AxisType.kY);
Joystick2 = rightStick.getAxis(Joystick.AxisType.kY);
Originally we had this, but changed it to the above:
Joystick1 = leftStick.getY();
Joystick2 = rightStick.getY();
//Left Side Motor Code, controlled by the left joystick(might need to switch direction)
if ((Joystick1 < 0.1)&&(Joystick1 > -0.1)) {
LeftMotors.set(0);
}
else {
LeftMotors.set (Joystick1);
}
//Right Side Motor Code, controlled by the right joystick(might need to switch direction)
if ((Joystick2 < 0.1)&&(Joystick2 > -0.1)) {
RightMotors.set(0);
}
else {
RightMotors.set(Joystick2);
}
}
}
|