/// <summary> /// Runs the auto handler. /// </summary> protected override void Main() { Right1.SetEncoderPostition(0); // Reset the encoder position to 0. Left1.SetEncoderPostition(0); // Reset the eoncoder position to 0. // Runs the selected autonomous. //AutoHandler.RunAuto(Handler.AutoPosition.Disabled); // Both down. 0b00 if (DriveStick_Left.GetAxis(WPILib.Joystick.AxisType.Z) < 0.5 && DriveStick_Right.GetAxis(WPILib.Joystick.AxisType.Z) < 0.5) { SmartConsole.PrintInfo("Currently running disabled autonomous on the " + DriverStation.Instance.GetAlliance() + " alliance."); AutoHandler.RunAuto(Handler.AutoPosition.Disabled); } // Left stick down, right stick up. 0b01 else if (DriveStick_Left.GetAxis(WPILib.Joystick.AxisType.Z) < 0.5 && DriveStick_Right.GetAxis(WPILib.Joystick.AxisType.Z) > 0.5) { SmartConsole.PrintInfo("Currently running position 1 autonomous on the " + DriverStation.Instance.GetAlliance() + " alliance."); AutoHandler.RunAuto(Handler.AutoPosition.Position1); } // Left stick up, right stick down. 0b10 else if (DriveStick_Left.GetAxis(WPILib.Joystick.AxisType.Z) > 0.5 && DriveStick_Right.GetAxis(WPILib.Joystick.AxisType.Z) < 0.5) { SmartConsole.PrintInfo("Currently running position 2 autonomous on the " + DriverStation.Instance.GetAlliance() + " alliance."); AutoHandler.RunAuto(Handler.AutoPosition.Position2); /*DriveTrain.Move(.65, .70); * * Snooze(2500); * * DriveTrain.StopMotor(); * * GearSlot.Set(true); * * while (true) Snooze(1);*/ } // Left stick up, right stick up. 0b11 else if (DriveStick_Left.GetAxis(WPILib.Joystick.AxisType.Z) > 0.5 && DriveStick_Right.GetAxis(WPILib.Joystick.AxisType.Z) > 0.5) { SmartConsole.PrintInfo("Currently running position 3 autonomous on the " + DriverStation.Instance.GetAlliance() + " alliance."); AutoHandler.RunAuto(Handler.AutoPosition.Position3); } }
protected override void Main() { #if DEBUG SmartConsole.PrintWarning("Robot running in debug mode."); #endif Handler.AutoPosition position = Handler.AutoPosition.Disabled; while (true) { // Both down. 0b00 if (DriveStick_Left.GetAxis(WPILib.Joystick.AxisType.Z) < 0.5 && DriveStick_Right.GetAxis(WPILib.Joystick.AxisType.Z) < 0.5) { if (!a0) { SmartConsole.PrintInfo("Currently running disabled autonomous on the " + DriverStation.Instance.GetAlliance() + " alliance."); position = Handler.AutoPosition.Disabled; //AutoHandler.RunAuto(Handler.AutoPosition.Disabled); a0 = true; a1 = false; a2 = false; a3 = false; } } // Left stick down, right stick up. 0b01 else if (DriveStick_Left.GetAxis(WPILib.Joystick.AxisType.Z) < 0.5 && DriveStick_Right.GetAxis(WPILib.Joystick.AxisType.Z) > 0.5) { if (!a1) { SmartConsole.PrintInfo("Currently running side gear (positon 1) autonomous on the " + DriverStation.Instance.GetAlliance() + " alliance."); position = Handler.AutoPosition.Position1; //AutoHandler.RunAuto(Handler.AutoPosition.Position1); a0 = false; a1 = true; a2 = false; a3 = false; } } // Left stick up, right stick down. 0b10 else if (DriveStick_Left.GetAxis(WPILib.Joystick.AxisType.Z) > 0.5 && DriveStick_Right.GetAxis(WPILib.Joystick.AxisType.Z) < 0.5) { if (!a2) { SmartConsole.PrintInfo("Currently running center gear (positon 2) autonomous on the " + DriverStation.Instance.GetAlliance() + " alliance."); position = Handler.AutoPosition.Position2; //AutoHandler.RunAuto(Handler.AutoPosition.Position2); a0 = false; a1 = false; a2 = true; a3 = false; } } // Left stick up, right stick up. 0b11 else if (DriveStick_Left.GetAxis(WPILib.Joystick.AxisType.Z) > 0.5 && DriveStick_Right.GetAxis(WPILib.Joystick.AxisType.Z) > 0.5 && position != Handler.AutoPosition.Position3) { if (!a3) { SmartConsole.PrintInfo("Currently running position 3 autonomous on the " + DriverStation.Instance.GetAlliance() + " alliance."); position = Handler.AutoPosition.Position3; //AutoHandler.RunAuto(Handler.AutoPosition.Position3); a0 = false; a1 = false; a2 = false; a3 = true; } } } }