Actually use the autonomous chooser

This commit is contained in:
Adam Goldsmith 2016-03-09 19:11:28 -05:00
parent e57db04c97
commit a76d3359c2

View File

@ -69,8 +69,10 @@ private:
LiveWindow *lw = LiveWindow::GetInstance(); LiveWindow *lw = LiveWindow::GetInstance();
SendableChooser *chooser; SendableChooser *chooser;
const std::string autoNameDefault = "Default"; const std::string autoNameDefault = "1.7 Seconds (Slightly Longer)";
const std::string autoNameCustom = "My Auto"; const std::string autoNameShort = "1.5 Seconds (Short, good on the moat)";
const std::string autoNameOne = "1 Seconds";
const std::string autoNameDisable = "Disable Autonomous (set time to 0)";
std::string autoSelected; std::string autoSelected;
void LogCSVData() void LogCSVData()
@ -206,8 +208,11 @@ public:
void RobotInit() void RobotInit()
{ {
chooser = new SendableChooser(); chooser = new SendableChooser();
chooser->AddDefault(autoNameDefault, (void*)&autoNameDefault); chooser->AddDefault(autoNameDefault, (void*)&autoNameDefault);
chooser->AddObject(autoNameCustom, (void*)&autoNameCustom); chooser->AddObject(autoNameShort, (void*)&autoNameShort);
chooser->AddObject(autoNameOne, (void*)&autoNameOne);
chooser->AddObject(autoNameDisable, (void*)&autoNameDisable);
SmartDashboard::PutData("Auto Modes", chooser); SmartDashboard::PutData("Auto Modes", chooser);
shooter1.Enable(); shooter1.Enable();
shooter2.Enable(); shooter2.Enable();
@ -231,22 +236,19 @@ public:
//std::string autoSelected = SmartDashboard::GetString("Auto Selector", autoNameDefault); //std::string autoSelected = SmartDashboard::GetString("Auto Selector", autoNameDefault);
std::cout << "Auto selected: " << autoSelected << std::endl; std::cout << "Auto selected: " << autoSelected << std::endl;
if(autoSelected == autoNameCustom){
//Custom Auto goes here
} else {
//Default Auto goes here
auto_status = START; auto_status = START;
} }
}
void AutonomousPeriodic() void AutonomousPeriodic()
{ {
const float drivePower = 1; const float drivePower = 1;
const float driveTime = 3; //Seconds to drive forward float driveTime = 1.7;
LogCSVData(); LogCSVData();
if(autoSelected == autoNameCustom){ if (autoSelected == autoNameDisable) driveTime = 0;
//Custom Auto goes here else if (autoSelected == autoNameShort) driveTime = 1.5;
} else { else if (autoSelected == autoNameOne) driveTime = 1;
else driveTime = 1.7;
//Default Auto goes here //Default Auto goes here
switch (auto_status) switch (auto_status)
{ {
@ -276,7 +278,6 @@ public:
} }
} }
} }
}
void TeleopInit() void TeleopInit()
{ {