|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: PID & One Second Delay Between Auto and TeleOp
Quote:
|
|
#2
|
||||
|
||||
|
Re: PID & One Second Delay Between Auto and TeleOp
Quote:
|
|
#3
|
|||
|
|||
|
Re: PID & One Second Delay Between Auto and TeleOp
I think this is closer to what you want. The logic is simpler if you move the timer check into disabledPeriodic(). The result of timer.getFPGATimestamp() is probably not what you want.
Code:
bool teleopAfterAutonomous = false;
autonomousInit() {
teleopAfterAutonomous = true;
}
disabledInit(){
disabledTimer.Reset();
disabledTimer.Start();
}
disabledPeriodic(){
if (disabledTimer.Get() > 1) {
// If we're disabled for more than one second, assume that we are not in a match
// Might be necessary to bump 1 above to a somewhat higher value.
teleopAfterAutonomous = false;
}
}
teleopInit(){
if(teleopAfterAutonomous || DriverStation.getInstance().isFMSAttached()){
shoulder.set(shoulderDocked);
elbow.set(elbowDocked);
}
}
|
|
#4
|
||||
|
||||
|
Re: PID & One Second Delay Between Auto and TeleOp
Thank you, I think this should work!
Quote:
|
|
#5
|
||||
|
||||
|
Re: PID & One Second Delay Between Auto and TeleOp
Quote:
Code:
teleopInit(){
if(teleopAfterAutonomous || DriverStation.getInstance().isFMSAttached()){
shoulder.set(shoulderDocked);
elbow.set(elbowDocked);
teleopAfterAutonomous = false;
}
}
|
|
#6
|
|||||
|
|||||
|
Re: PID & One Second Delay Between Auto and TeleOp
Quote:
|
|
#7
|
|||
|
|||
|
Re: PID & One Second Delay Between Auto and TeleOp
WillNess, I think your change is a good one.
In my code, I assumed that you'd have at least a second of disabled between your practice runs. That delay causes teleopAfterAutonomous to become false. Your change resets things immediately. |
|
#8
|
||||
|
||||
|
Re: PID & One Second Delay Between Auto and TeleOp
Yes I don't think I'll ever be starting the robot within 1 second of code uploading or rebooting.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|