Quote:
Originally Posted by miw14
Hmm... I think I may have figured out the problem. Would I also need to have the setSafetyEnabled method with the shooter object and the driver object?
I feel like that is the problem. When I changed the timer delays between on shooter and off shooter, it had not effect. I wonder if the setSafetyEnabled method has anything to do with that.
|
Ideally you wouldn't disable the safety enable. Now, given that you're at comp, i'm not going to suggest enabling it at this point. However, we can rearrange your code to ensure that the drive is updated enough.
Time is in milliseconds. Unlike other programming platforms, the crio really does not like long delays. Thus it's better for you to manage time, and adjust your motor outputs based on time.
Code:
public void autonomous() {
myDrive.setSafetyEnabled(false);
long startTime = System.currentTimeMillis();
while(isAutonomous() && isEnabled()){
long timePassed = System.currentTimeMillis() - startTime;
if(timePassed < 3500){
myDrive.drive(-.5, 0.0);
}else if (timePassed < 5000){
myDrive.stopMotor();
}else if (timePassed < 8500){
startRaisingLauncher();
}else{
stopMovingLauncher();
//stopAll();
}
Timer.delay(0.01);
}
stopAll();
}