View Single Post
  #3   Spotlight this post!  
Unread 30-03-2015, 12:24
MrRoboSteve MrRoboSteve is online now
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 578
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
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);
   }
}
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
Reply With Quote