void Autonomous(void) { dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "2013 Test Fix"); dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, "Autonomous Mode"); dsLCD->UpdateLCD(); }
RobotDemo(void): myRobot(LEFT_DRIVE_PWM, RIGHT_DRIVE_PWM), // these must be initialized in the same order stick(1), // as they are declared above. stick2(2), gamepad(3), collectorMotor(PICKUP_PWM), indexerMotor(INDEX_PWM), shooterMotor(SHOOTER_PWM), armMotor (ARM_PWM), shifter(SHIFTER_A,SHIFTER_B), greenClaw(CLAW_1_LOCKED, CLAW_1_UNLOCKED), yellowClaw(CLAW_2_LOCKED, CLAW_2_UNLOCKED), potentiometer(ARM_ROTATION_POT), indexSwitch(INDEXER_SW), compressor(COMPRESSOR_PRESSURE_SW, COMPRESSOR_SPIKE) { m_collectorMotorRunning = false; m_shooterMotorRunning = false; dsLCD = DriverStationLCD::GetInstance(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "2013 " NAME); dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, __DATE__ " "__TIME__); dsLCD->UpdateLCD(); myRobot.SetExpiration(0.1); shifter.Set(DoubleSolenoid::kReverse); }
void output (void) { REDRUM; if (IsAutonomous()) driverOut->PrintfLine(DriverStationLCD::kUser_Line1, "blaarag"); else if (IsOperatorControl()) { REDRUM; } outputCounter++; if (outputCounter % 30 == 0){ REDRUM; driverOut->PrintfLine(DriverStationLCD::kUser_Line2, "Top Shooter RPM: %f",(float)LTop.GetSpeed()); driverOut->PrintfLine(DriverStationLCD::kUser_Line3, "Bot Shooter RPM: %f",(float)LBot.GetSpeed()); // driverOut->PrintfLine(DriverStationLCD::kUser_Line6, "Pilot Z-Axis: %f",pilot.GetZ()); } if (outputCounter % 60 == 0){ REDRUM; driverOut->PrintfLine(DriverStationLCD::kUser_Line4, "Top CANJag Temp: %f Celcius",LTop.GetTemperature()*(9/5) + 32); driverOut->PrintfLine(DriverStationLCD::kUser_Line5, "Bot CANJag Temp: %f Celcius",LBot.GetTemperature()*(9/5) + 32); outputCounter = 1; } driverOut->UpdateLCD(); }//nom nom nom
void AutonomousStateMachine() { pneumaticsControl->initialize(); shooterControl->initializeAuto(); driveControl.initializeAuto(); enum AutoState { AutoDrive, AutoSetup, AutoShoot }; AutoState autoState; autoState = AutoDrive; bool feederState = false; bool hasFired = false; Timer feeder; while (IsAutonomous() && IsEnabled()) { GetWatchdog().Feed(); switch (autoState) {//Start of Case Machine case AutoDrive://Drives the robot to set Destination bool atDestination = driveControl.autoPIDDrive2(); if (atDestination) {//If at Destination, Transition to Shooting Setup autoState = AutoSetup; } break; case AutoSetup://Starts the ballgrabber motors to place the ball and extends ballgrabber if (!pneumaticsControl->ballGrabberIsExtended()) {//extends ballgrabber if not already extended pneumaticsControl->ballGrabberExtend(); } if (!feederState) {//Started the feeder timer once feederState = true; feeder.Start(); autoState = AutoShoot; } break; case AutoShoot://Shoots the ball if (feeder.Get() < 2.0) {//Runs ballgrabber for 2.0 Seconds at most shooterControl->feed(true); } else if (feeder.Get() >= 2.0) {//Transition to Shooting shooterControl->feed(false); feeder.Stop(); } if (pneumaticsControl->ballGrabberIsExtended() && !hasFired) { shooterControl->autoShoot(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "The robot is(should be) shooting"); if (shooterControl->doneAutoFire()) {//Returns true only after shoot is done firing hasFired = true; } } else if (hasFired) {//runs only after shoot is done dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "AutoMode Finished"); } break; } dsLCD->UpdateLCD(); } }
void OperatorControl() { // Loop counter to ensure that the program is running (debug helper // that can be removed when things get more stable) int sanity, bigSanity = 0; gamepad.Update(); while (IsOperatorControl() && IsEnabled()) { controls = Controls::GetInstance(); controls->SetSpeed(LEFT_DRIVE_PWM, -1.0 * gamepad.GetRightY()); controls->SetSpeed(RIGHT_DRIVE_PWM, -1.0 * gamepad.GetRightY()); gamepad.Update(); dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "2013 Test Fix"); dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, "Teleop Mode"); dsLCD->PrintfLine(DriverStationLCD::kUser_Line6, "bigSanity: %d", sanity); dsLCD->UpdateLCD(); sanity++; if (0 == sanity % 20) { bigSanity++; } Wait(0.05); // wait for a motor update time } }
void Drive (float speed, int dist) { leftDriveEncoder.Reset(); leftDriveEncoder.Start(); int reading = 0; dist = abs(dist); // The encoder.Reset() method seems not to set Get() values back to zero, // so we use a variable to capture the initial value. dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, "initial=%d\n", leftDriveEncoder.Get()); dsLCD->UpdateLCD(); // Start moving the robot robotDrive.Drive(speed, 0.0); while ((IsAutonomous()) && (reading <= dist)) { reading = abs(leftDriveEncoder.Get()); dsLCD->PrintfLine(DriverStationLCD::kUser_Line3, "reading=%d\n", reading); dsLCD->UpdateLCD(); } robotDrive.Drive(0.0, 0.0); leftDriveEncoder.Stop(); }
/** * Runs the motors with arcade steering. */ void OperatorControl(void) { while (IsOperatorControl()) { dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, "Voltage: %f", signal.GetVoltage()); dsLCD->PrintfLine(DriverStationLCD::kUser_Line3, "CVoltage: %f", signalControlVoltage.GetVoltage()); dsLCD->UpdateLCD(); Wait(0.005); // wait for a motor update time } }
void DriveThenShootAuto() { //initizlizes all parts of robot pneumaticsControl->initialize(); shooterControl->initializeAuto(); driveControl.initializeAuto(); bool destinationPrevious = false; bool autoShot = false; //true if autoShoot //creates a timer for the ball grabber motors Timer feeding; bool started = false; while (IsAutonomous() && IsEnabled()) { GetWatchdog().Feed(); //drives forward to shooting point bool atDestination = destinationPrevious || driveControl.autoPIDDrive2(); //autoDrive returns true when robot reached it's goal if (atDestination) { // The robot has reached the destination on the floor and is now ready to open and shoot if (!started) { started = true; destinationPrevious = true; //starts feeding-timer controls feeder motors so the ball doesn't get stuck feeding.Start(); } pneumaticsControl->ballGrabberExtend(); //waits for feeding to be done if (feeding.Get() < 2.0) {//3.0 was shooterControl->feed(true); } else if (feeding.Get() >= 2.0) { // 3.0 was shooterControl->feed(false); feeding.Stop(); } if (pneumaticsControl->ballGrabberIsExtended() && !autoShot) { shooterControl->autoShoot(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "The robot is(should be) shooting"); if (shooterControl->doneAutoFire()) {//works only after shoot is done firing autoShot = true; } } else if (autoShot) {//runs only after shoot is done dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "AutoMode Finished"); } } dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, "Feeder Time: %f", feeding.Get()); dsLCD->UpdateLCD(); } }
//should move this to helper function void robot::feed() { DriverStationLCD *lcd = DriverStationLCD::GetInstance(); lcd->Clear(); float th = gyro.getangle(); a = qmod(th * dt + a, -180, 180); lcd->PrintfLine(DriverStationLCD::kUser_Line1, "BUILD: %i", BUILD); lcd->PrintfLine(DriverStationLCD::kUser_Line2, "%f", gyrob.GetAngle()); lcd->PrintfLine(DriverStationLCD::kUser_Line3, "%f", arma.GetVoltage()); lcd->PrintfLine(DriverStationLCD::kUser_Line4, "%f", armb.GetVoltage()); //lcd->PrintfLine(DriverStationLCD::kUser_Line5, "%f", aa); lcd->UpdateLCD(); }
void TeleopPeriodic(void) { // increment the number of teleop periodic loops completed m_telePeriodicLoops++; static AutoDrive *autoDrive = NULL; bool autoButton = DriveStick->GetButton(Joystick::kTriggerButton); if (autoButton) { if (autoDrive == NULL) autoDrive = new AutoDrive(m_Configuration->GetValue( m_Constant[ cAutoDrive]) * 100); autoDrive->Periodic(MyRobot, ds); ds->PrintfLine (DriverStationLCD::kUser_Line5, "autoDrive on"); } else { ds->PrintfLine (DriverStationLCD::kUser_Line5, "autoDrive off"); if (autoDrive != NULL) { MyRobot.ResetCounters(); delete autoDrive; autoDrive = NULL; } if( !m_Configuration) { printf( "Configuration Initialize"); InitializeConfiguration(); } m_Configuration->Execute( DriveStick->GetRawButton( 2), DriveStick->GetZ(), ds); if(DriveStick->GetRawButton( 3)) { ds->PrintfLine(DriverStationLCD::kUser_Line6, "Calculating distance..."); Vision *vision = new Vision(); double distance = vision->TakeDistancePicture( ds, m_Configuration->GetValue( m_Constant[ cHBottom]), m_Configuration->GetValue( m_Constant[ cHTop]), m_Configuration->GetValue( m_Constant[ cSBottom]), m_Configuration->GetValue( m_Constant[ cSTop]), m_Configuration->GetValue( m_Constant[ cVBottom]), m_Configuration->GetValue( m_Constant[ cVTop])); if( distance < 0.000001) ds->PrintfLine(DriverStationLCD::kUser_Line6, "No target found"); else ds->PrintfLine(DriverStationLCD::kUser_Line6, "distance to target: %lf",distance); delete vision; } // Real teleop mode: use the JoySticks to drive MyRobot.DriveRobot(DriveStick->GetY(),(DriveStick->GetX()), ds); } ds->UpdateLCD(); } // TeleopPeriodic(void)
void OperatorControl(void) { XboxController *xbox = XboxController::getInstance(); bool isEndGame = false; GetWatchdog().SetEnabled(true); _driveControl.initialize(); //_poleVaultControl.initialize(); shooterControl.InitializeOperator(); while (IsEnabled() && IsOperatorControl()) { GetWatchdog().Feed(); dsLCD->Clear(); if (xbox->isEndGame()) { isEndGame = !isEndGame; } if (!isEndGame) { shooterControl.Run(); //_poleVaultControl.act(); _driveControl.act(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "Normal"); led0->Set((shooterControl.getLED1())?Relay::kOn: Relay::kOff); led1->Set((shooterControl.getLED2())?Relay::kOn: Relay::kOff); } else { shooterControl.RunEndGame(); //_poleVaultControl.actEndGame(); _driveControl.actEndGame(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "End Game"); flashCount--; if (flashCount<=0){ isFlashing = !isFlashing; flashCount=FLASHTIME; } led0->Set((isFlashing)?Relay::kOn: Relay::kOff); led1->Set((isFlashing)?Relay::kOn: Relay::kOff); } // dsLCD->PrintfLine(DriverStationLCD::kUser_Line6, "Flash: %i", flashCount); dsLCD->UpdateLCD(); Wait(WAIT_TIME); // wait for a motor update time } GetWatchdog().SetEnabled(false); }
void TeleopPeriodic(void) { //Drive code leftFrontDrive->Set(-1 * leftStick->GetY()); rightFrontDrive->Set(rightStick->GetY()); leftRearDrive->Set(-1 * leftStick->GetY()); rightRearDrive->Set(rightStick->GetY()); //airCompressor->Start(); // Simple Button Drive Forward if(rightStick->GetRawButton(3)) { leftFrontDrive->Set(-1); rightFrontDrive->Set(1); leftRearDrive->Set(-1); rightRearDrive->Set(1); } // Simple Button Drive Backwards if(rightStick->GetRawButton(2)) { leftFrontDrive->Set(1); rightFrontDrive->Set(-1); leftRearDrive->Set(1); rightRearDrive->Set(-1); } // Code to print to the user messages box in the Driver Station LCD->PrintfLine(DriverStationLCD::kUser_Line1, "Hello World"); LCD->Printf(DriverStationLCD::kUser_Line2,1,"Y Left: %f", leftStick->GetY()); LCD->Printf(DriverStationLCD::kUser_Line3,1,"Y Right: %f", rightStick->GetY()); LCD->UpdateLCD(); Wait(0.2); }
RobotDemo(void): gamepad(3) { dsLCD = DriverStationLCD::GetInstance(); // Output the program name and build date/time in the hope that this will help // us catch cases where we are downloading a program other than the one // we think we are downloading. Keep in mind that if this source file // does not change (and you don't do a complete rebuild) the timestamp // will not change. dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "2013 Test Menu"); dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, __DATE__ " "__TIME__); dsLCD->UpdateLCD(); }
void LcdDisplaySubsystem::UpdateLines() { DriverStationLCD *lcd = DriverStationLCD::GetInstance(); lcd->PrintfLine(DriverStationLCD::kUser_Line1, "Tilt angle: %f", CommandBase::shooterTiltSubsystem->GetAngle()); lcd->UpdateLCD(); }
// Runs during test mode // Test // * void Test() { shifters.Set(DoubleSolenoid::kForward); leftDriveEncoder.Start(); leftDriveEncoder.Reset(); int start = leftDriveEncoder.Get(); while (IsTest()) { if (rightStick.GetRawButton(7)) { robotDrive.ArcadeDrive(rightStick.GetY(), -rightStick.GetX()); } else { robotDrive.ArcadeDrive(rightStick.GetY()/2, -rightStick.GetX()/2); } if (gamepad.GetEvent(4) == kEventClosed) { start = leftDriveEncoder.Get(); } dsLCD->PrintfLine(DriverStationLCD::kUser_Line3, "lde: %d", leftDriveEncoder.Get() - start); dsLCD->UpdateLCD(); gamepad.Update(); } }
void AutonomousPeriodic(void) { m_autoPeriodicLoops++; #if 0 static int Clock=0; bool correct = DriveStick->GetButton(Joystick::kTriggerButton); bool Reset = DriveStick->GetButton (Joystick::kTopButton); ds->PrintfLine(DriverStationLCD::kUser_Line1, "%s %s", correct ? "correct on" : "correct off", Reset ? "Reset": "No Reset"); //ds->PrintfLine(DriverStationLCD::kUser_Line6, "%d %c %c", Clock, correct? "C" : "c", Reset? "R" : "r"); if (Reset) Clock=0, MyRobot.ResetCounters(); else { ++Clock; if(Clock<=100) MyRobot.DriveRobot(1.0,0.0, ds, correct); // drive forward else if (Clock<=200) MyRobot.DriveRobot(-1.0,0.0, ds, correct); // stop else if (Clock<=250) MyRobot.DriveRobot(-1.0,0.0, ds, correct); // drive back halfway else if (Clock<=300) MyRobot.DriveRobot(1.0,0.0, ds, correct); // stop else { // Real teleop mode: use the JoySticks to drive MyRobot.DriveRobot(DriveStick->GetY(),(DriveStick->GetX()), ds); } } #endif }
void Machine :: TeleopInit() { DriverStationLCD *lcd = DriverStationLCD::GetInstance(); lcd->PrintfLine(DriverStationLCD::kUser_Line2, "Ben is here"); lcd->UpdateLCD(); drive.enableVoltageControl(); //drive.enableSpeedControl(); }
RobotDemo(void) : signal(3), signalControlVoltage(7) { dsLCD = DriverStationLCD::GetInstance(); dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "SonarTest"); dsLCD->UpdateLCD(); }
void Zed::updateDriverStation() { DriverStationLCD* lcd = DriverStationLCD::GetInstance(); lcd->Clear(); lcd->PrintfLine(DriverStationLCD::kUser_Line1, 0, "Shooter Speed: %f", shooterSpeed); lcd->UpdateLCD(); }
void Run(CompressorInputs input) { //cout << input.enable; //compressor->Set(Relay::kOn); //compressor->Set(input.enable ? Relay::kOn : Relay::kOff); //cout << compressor->GetPressureSwitchValue(); lcd->PrintfLine(DriverStationLCD::kUser_Line5, "Pressure Switch: %x", compressor->GetPressureSwitchValue()); }
FRC2994_2014(): leftFrontDrive(LEFT_FRONT_DRIVE_PWM), leftRearDrive(LEFT_REAR_DRIVE_PWM), rightFrontDrive(RIGHT_FRONT_DRIVE_PWM), rightRearDrive(RIGHT_REAR_DRIVE_PWM), robotDrive(&leftFrontDrive, &leftRearDrive, &rightFrontDrive, &rightRearDrive), rightStick(RIGHT_DRIVE_STICK) { // Print an I'M ALIVE message before anything else. NOTHING ABOVE THIS LINE. dsLCD = DriverStationLCD::GetInstance(); dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, ROBOT_NAME); dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, __DATE__ " " __TIME__); dsLCD->UpdateLCD(); robotDrive.SetExpiration(0.1); }
Hohenheim(void) { driverStation = DriverStation::GetInstance(); dsLCD = DriverStationLCD::GetInstance(); pneumaticsControl = PneumaticsControl::getInstance(); shooterControl = ShooterControl::getInstance(); dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "Hohenheim 2014 V 3.1"); dsLCD->UpdateLCD(); GetWatchdog().SetEnabled(false); }
RobotDemo(void): myRobot(1, 2), // these must be initialized in the same order stick(1) // as they are declared above. { dsLCD = DriverStationLCD::GetInstance(); dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "XboxController2"); dsLCD->UpdateLCD(); myRobot.SetExpiration(0.1); }
RobotDemo(void): leftDriveMotor(LEFT_DRIVE_PWM), rightDriveMotor(RIGHT_DRIVE_PWM), myRobot(&leftDriveMotor, &rightDriveMotor), // these must be initialized in the same order stick(1), // as they are declared above. stick2(2), gamepad(3), collectorMotor(PICKUP_PWM), indexerMotor(INDEX_PWM), shooterMotor(SHOOTER_PWM), armMotor (ARM_PWM), leftDriveEncoder(LEFT_DRIVE_ENC_A, LEFT_DRIVE_ENC_B), shifter(SHIFTER_A,SHIFTER_B), greenClaw(CLAW_1_LOCKED, CLAW_1_UNLOCKED), yellowClaw(CLAW_2_LOCKED, CLAW_2_UNLOCKED), potentiometer(ARM_ROTATION_POT), indexSwitch(INDEXER_SW), greenClawLockSwitch(CLAW_1_LOCK_SENSOR), yellowClawLockSwitch(CLAW_2_LOCK_SENSOR), compressor(COMPRESSOR_PRESSURE_SW, COMPRESSOR_SPIKE), jogTimer(), shooterTimer() { m_collectorMotorRunning = false; m_shooterMotorRunning = false; m_jogTimerRunning = false; m_shiftCount = MAX_SHIFTS; dsLCD = DriverStationLCD::GetInstance(); dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "2013 " NAME); dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, __DATE__ " "__TIME__); dsLCD->UpdateLCD(); myRobot.SetExpiration(0.1); shifter.Set(DoubleSolenoid::kReverse); leftDriveEncoder.SetDistancePerPulse(DRIVE_ENCODER_DISTANCE_PER_PULSE); leftDriveEncoder.SetMaxPeriod(1.0); leftDriveEncoder.SetReverseDirection(true); // change to true if necessary leftDriveEncoder.Start(); }
void DataSending::UpdateUserLCD(){ char line1[200]; char line2[200]; char line3[200]; char line4[200]; string setting = "Shifter is "+GetGearSetting(); strcpy(line1,setting.c_str()); if((bool)RobotMap::launcherCompressor->GetPressureSwitchValue())sprintf(line2,"Sufficent Pressure"); else sprintf(line2,"Insufficient Pressure"); if(((batteryCurrent->GetVoltage()-2.5)*AMPS_CONSTANT)<150)sprintf(line3,"Don't drop the clutch!"); else sprintf(line3,"You droped the clutch!"); sprintf(line4, "Battery Current is %f Amps",((batteryCurrent->GetVoltage()-2.5)*AMPS_CONSTANT)); DriverStationLCD *lcd = DriverStationLCD::GetInstance(); lcd->PrintfLine(DriverStationLCD::kUser_Line1, "%s",line1); lcd->PrintfLine(DriverStationLCD::kUser_Line2, "%s",line2); lcd->PrintfLine(DriverStationLCD::kUser_Line3, "%s",line3); lcd->PrintfLine(DriverStationLCD::kUser_Line4, "%s",line4); lcd->UpdateLCD(); }
// Code to be run during the remaining 2:20 of the match (after Autonomous()) // // OperatorControl // * Calls all the above methods void OperatorControl() { // SAFETY AND SANITY - SET ALL TO ZERO intake.Set(0.0); rightWinch.Set(0.0); leftWinch.Set(0.0); arm.Set(DoubleSolenoid::kReverse); /* TODO: Investigate. At least year's (GTR East) competition, we reached the conclusion that disabling this was * the only way we could get out robot code to work (reliably). Should this be set to false? */ robotDrive.SetSafetyEnabled(false); Timer clock; int sanity = 0; int bigSanity = 0; loading = false; loaded = winchSwitch.Get(); RegisterButtons(); gamepad.Update(); leftStick.Update(); compressor.Start(); while (IsOperatorControl() && IsEnabled()) { clock.Start(); HandleDriverInputs(); HandleShooter(); HandleArm(); // HandleEject(); while (!clock.HasPeriodPassed(LOOP_PERIOD)); // add an IsEnabled??? clock.Reset(); sanity++; if (sanity >= 100) { bigSanity++; sanity = 0; dsLCD->PrintfLine(DriverStationLCD::kUser_Line4, "%d", bigSanity); } gamepad.Update(); leftStick.Update(); dsLCD->UpdateLCD(); } // SAFETY AND SANITY - SET ALL TO ZERO intake.Set(0.0); rightWinch.Set(0.0); leftWinch.Set(0.0); }
void DashBoardInput() { int i = 0; GetWatchdog().SetEnabled(true); while (IsAutonomous() && IsEnabled()) { i++; GetWatchdog().Feed(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "%f, %i", driverStation->GetAnalogIn(1), i); dsLCD->UpdateLCD(); } }
FRC2994_2014(): leftFrontDrive(LEFT_FRONT_DRIVE_PWM), leftRearDrive(LEFT_REAR_DRIVE_PWM), rightFrontDrive(RIGHT_FRONT_DRIVE_PWM), rightRearDrive(RIGHT_REAR_DRIVE_PWM), leftCenterDrive(CENTER_LEFT_DRIVE_PWM), rightCenterDrive(CENTER_RIGHT_DRIVE_PWM), intake(INTAKE_MOTOR_PWM), rightWinch(RIGHT_WINCH_MOTOR_PWM), leftWinch(LEFT_WINCH_MOTOR_PWM), robotDrive(leftFrontDrive, leftRearDrive, leftCenterDrive, rightCenterDrive, rightFrontDrive, rightRearDrive), rightStick(RIGHT_DRIVE_STICK), leftStick(LEFT_DRIVE_STICK), gamepad(GAMEPAD_PORT), shifters(SHIFTER_A, SHIFTER_B), arm(ARM_A, ARM_B), eject(EJECT_A, EJECT_B), winchSwitch(WINCH_SWITCH), leftDriveEncoder(LEFT_ENCODER_A, LEFT_ENCODER_B), rightDriveEncoder(RIGHT_ENCODER_A, RIGHT_ENCODER_B), compressor(COMPRESSOR_PRESSURE_SW, COMPRESSOR_SPIKE), // Robot starts off in a loaded state so a ball can be fit in loaded(true), loading(false), armDown(false) { // Print an I'M ALIVE message before anything else. NOTHING ABOVE THIS LINE. dsLCD = DriverStationLCD::GetInstance(); dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, ROBOT_NAME); dsLCD->PrintfLine(DriverStationLCD::kUser_Line3, __DATE__ " " __TIME__); dsLCD->UpdateLCD(); ds = DriverStation::GetInstance(); // Set the experation to 1.5 times the loop speed. robotDrive.SetExpiration(LOOP_PERIOD*1.5); leftDriveEncoder.SetReverseDirection(true); }
void OperatorControl(void) { // Loop counter to ensure that the program us running (debug helper // that can be removed when things get more stable) int sanity, bigSanity = 0; while (IsOperatorControl() && IsEnabled()) { dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "2013 Test Fix"); dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, "Teleop Mode"); dsLCD->PrintfLine(DriverStationLCD::kUser_Line6, "bigSanity: %d", sanity); dsLCD->UpdateLCD(); sanity++; if (0 == sanity % 20) { bigSanity++; } Wait(1.0); // wait for a motor update time } }
SebastianRobot(void) { dsLCD = DriverStationLCD::GetInstance(); dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "Sebastian V24.2"); dsLCD->UpdateLCD(); GetWatchdog().SetEnabled(false); led0 = new Relay(2); led1 = new Relay(3); flashCount = 0; led0->Set(Relay::kOff); led1->Set(Relay::kOff); isFlashing=false; }