2
0
mirror of https://github.com/team2059/Dent synced 2024-12-18 20:52:29 -05:00

Added more autonomous modes (untested). Changed default autonomous timeout to 0.0s from 3.0s

This commit is contained in:
Austen Adler 2015-03-05 20:07:52 -05:00
parent 63e9adce86
commit 136a28994e
2 changed files with 36 additions and 13 deletions

View File

@ -24,7 +24,16 @@ Autonomous::Autonomous(int seq){
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, -0.8));
break;
case 2:
// Collect a tote, turn, drive to Auto Zone (TM)
// Lower BinElevator, collect bin, turn, drive to AutoZone (TM)
AddSequential(new BinLower(0.5));
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Bin Distance"), 0, 0.75));
AddSequential(new BinRaise(1.0));
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, -0.75));
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
break;
case 3:
// Collect a tote with BinElevator, turn, drive to Auto Zone (TM)
Wait(SmartDashboard::GetNumber("Auto Wait Time"));
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
AddSequential(new BinRaise(1.2));
@ -32,29 +41,41 @@ Autonomous::Autonomous(int seq){
AddSequential(new BinLower(1.0));
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
break;
case 3:
// Collect three totes, drive to Auto Zone (TM)
case 4:
// Collect one, two, or three totes, drive to Auto Zone (TM)
printf("Waiting: %f\n", SmartDashboard::GetNumber("Auto Wait Time"));
Wait(SmartDashboard::GetNumber("Auto Wait Time"));
printf("Done");
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), 0, 0.75));
AddSequential(new CollectTote());
AddSequential(new Raise());
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), 0, 0.75));
AddSequential(new CollectTote());
AddSequential(new Lower());
AddSequential(new Raise());
printf("Three totes?: %d\n", SmartDashboard::GetBoolean("Three totes"));
if(SmartDashboard::GetBoolean("Three totes")){
if(SmartDashboard::GetBoolean("Two totes")){
AddSequential(new Raise());
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), 0, 0.75));
AddSequential(new CollectTote());
AddSequential(new Lower());
AddSequential(new Raise());
if(SmartDashboard::GetBoolean("Three totes")){
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Tote Distance"), 0, 0.75));
AddSequential(new CollectTote());
AddSequential(new Lower());
AddSequential(new Raise());
}
}
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0, 0.75));
AddSequential(new ReleaseTote());
break;
case 5:
// Same as auto 4, but navigate around bins
//TODO: Implement this
break;
case 6:
// Collect 1 bin and 1 tote
//TODO: Implement this
break;
case 7:
// Same as auto 4 with (Three|Two) totes checked, collect bin, drive to Auto Zone (TM)
//TODO: Implement this
break;
default:
printf("Invalid seq: %d\n", seq);
break;

View File

@ -25,14 +25,16 @@ void DentRobot::RobotInit(){
// Autonomous
// Sequence of autonomous command
SmartDashboard::PutNumber("Auto Sequence", 2.0);
SmartDashboard::PutNumber("Auto Wait Time", 3.0);
SmartDashboard::PutNumber("Auto Wait Time", 0.0);
// If the robot will be picking up three totes in sequence 3
SmartDashboard::PutBoolean("Three totes", true);
SmartDashboard::PutBoolean("Two totes", true);
SmartDashboard::PutBoolean("Three totes", false);
// TODO: Calibrate the following two values
// Distance (in time) to auto zone
SmartDashboard::PutNumber("Auto Zone Distance", 2.8);
// Distance (in time) to auto tote (used in sequence 3)
SmartDashboard::PutNumber("Auto Tote Distance", 0.5);
SmartDashboard::PutNumber("Auto Bin Distance", 0.25);
SmartDashboard::PutNumber("TurnAmount", 2.0);
// Elevators