Quasics2019Code/HedyLamarr/src/main/cpp/Commands/FullElevatorControl.cpp
// Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run
void FullElevatorControl::Execute() {
  if(Robot::oi->isElevatorToggleDown() && !pressedLastTime){
    Robot::lifter->stop();
    Robot::elevator->stop();
    pressedLastTime = true;
    toggleCounter = (toggleCounter + 1) % 3;
  }
  else if(!Robot::oi->isElevatorToggleDown()){
    pressedLastTime = false;
  }
  if(toggleCounter == 0){
    adjustElevatorStage(*Robot::elevator);
    adjustElevatorStage(*Robot::lifter);
    Robot::SetLifterMode(Robot::eBoth);
  }
  else if(toggleCounter == 1){
    adjustElevatorStage(*Robot::lifter);
    Robot::SetLifterMode(Robot::eLifter);
  }
  else if(toggleCounter == 2){
    adjustElevatorStage(*Robot::elevator);
    Robot::SetLifterMode(Robot::eElevator);
  }
}
void FullElevatorControl :: Execute ( ) { if ( Robot :: oi -> isElevatorToggleDown ( ) && ! pressedLastTime ) { Robot :: lifter -> stop ( ) ; Robot :: elevator -> stop ( ) ; pressedLastTime = true ; toggleCounter = ( toggleCounter + 1 ) % 3 ; } else if ( ! Robot :: oi -> isElevatorToggleDown ( ) ) { pressedLastTime = false ; } if ( toggleCounter == 0 ) { adjustElevatorStage ( * Robot :: elevator ) ; adjustElevatorStage ( * Robot :: lifter ) ; Robot :: SetLifterMode ( Robot :: eBoth ) ; } else if ( toggleCounter == 1 ) { adjustElevatorStage ( * Robot :: lifter ) ; Robot :: SetLifterMode ( Robot :: eLifter ) ; } else if ( toggleCounter == 2 ) { adjustElevatorStage ( * Robot :: elevator ) ; Robot :: SetLifterMode ( Robot :: eElevator ) ; } }
Called repeatedly when this Command is scheduled to run
Called repeatedly when this Command is scheduled to run
//move both stages at once //move lifter only //move elevator only