Quote:
Originally Posted by simon1636
So I updated my code, but nothing seems to be happening! Here's the updated version:
Code:
.
.
.
public void operatorControl() {
while (isOperatorControl() && isEnabled()) {
myDrive.mecanumDrive_Cartesian(moveStick.getY(), rotateStick.getX(), moveStick.getX(), 0);
if (rotateStick.getTrigger(GenericHID.Hand.kLeft) && isEnabled()) {
relay.set(Relay.Value.kOff);
relay.setDirection(Relay.Direction.kForward);
}
}
//mecanumDrive_Polar(moveStick.getY(), moveStick.getX(), rotateStick.getX());
Timer.delay(0.1);
}
}
.
.
.
|
I see two issues:
First, you called
relay.set(Relay.Value.kOff); This essentially disables the relay; it won't let either the forward or re reverse direction be enabled. The relay.set is usually called in the initialize method, unless the way in which it operates changes for different parts of the program.
Second, you don't have any way to turn the relay off. The if statement that wraps the relay.setDirection() should have an else case that does this.
Further, this if statement probably doesn't need the isEnabled() as part of the condition, as it was checked just a few microseconds earlier at the top of the while loop.
Edit: One more thing - didn't you mean to include the delay within the loop?