2015-02-06 13:45:01 -05:00
|
|
|
#include "Autonomous.h"
|
|
|
|
#include "Commands/CommandGroup.h"
|
|
|
|
#include "../../DentRobot.h"
|
2015-02-07 12:50:36 -05:00
|
|
|
#include "../Elevator/Raise.h"
|
2015-02-08 16:51:35 -05:00
|
|
|
#include "../Elevator/Lower.h"
|
2015-02-27 06:47:10 -05:00
|
|
|
#include "../BinElevator/BinRaise.h"
|
|
|
|
#include "../BinElevator/BinLower.h"
|
2015-02-08 16:51:35 -05:00
|
|
|
#include "AutoDrive.h"
|
|
|
|
#include "Turn.h"
|
2015-02-13 19:40:23 -05:00
|
|
|
#include "../Collector/RollIn.h"
|
2015-10-10 02:51:23 -04:00
|
|
|
#include "../Collector/RollOut.h"
|
2015-02-24 12:02:30 -05:00
|
|
|
#include "CollectTote.h"
|
2015-02-24 15:03:59 -05:00
|
|
|
#include "ReleaseTote.h"
|
2015-07-31 12:52:15 -04:00
|
|
|
Autonomous::Autonomous(int seq) {
|
2015-03-17 16:33:25 -04:00
|
|
|
Wait(SmartDashboard::GetNumber("Auto Wait Time"));
|
2015-07-31 12:52:15 -04:00
|
|
|
switch(seq) {
|
2015-02-13 17:34:38 -05:00
|
|
|
case 0:
|
|
|
|
// Just for testing
|
2015-03-17 16:33:25 -04:00
|
|
|
// Turn testing
|
2015-04-05 06:45:31 -04:00
|
|
|
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
2015-02-13 17:34:38 -05:00
|
|
|
break;
|
|
|
|
case 1:
|
2015-02-27 15:44:18 -05:00
|
|
|
// Drive to Auto Zone (TM)
|
2015-03-17 16:33:25 -04:00
|
|
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, -0.8, 0.01));
|
2015-03-05 15:43:07 -05:00
|
|
|
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
2015-02-13 17:34:38 -05:00
|
|
|
break;
|
|
|
|
case 2:
|
2015-10-10 02:51:23 -04:00
|
|
|
//Collect a bin upright into the robot upright, turn, drive to Auto Zone (TM),turn
|
|
|
|
AddSequential(new RollIn(1.0));
|
2015-02-27 09:51:02 -05:00
|
|
|
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
2015-02-27 16:42:11 -05:00
|
|
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, -0.75));
|
2015-02-27 10:56:29 -05:00
|
|
|
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
2015-02-13 17:34:38 -05:00
|
|
|
break;
|
2015-04-05 06:45:31 -04:00
|
|
|
case 3:
|
2015-03-05 20:33:18 -05:00
|
|
|
// Collect one, two, or three totes, drive to Auto Zone (TM), release totes
|
2015-03-17 16:33:25 -04:00
|
|
|
AddSequential(new CollectTote(SmartDashboard::GetNumber("CollectToteTurn")));
|
2015-07-31 12:52:15 -04:00
|
|
|
if(SmartDashboard::GetBoolean("Two totes")) {
|
2015-03-17 16:33:25 -04:00
|
|
|
AddParallel(new Turn(0.81));
|
2015-10-09 13:10:34 -04:00
|
|
|
AddSequential(new Raise(3.5,false,-1));
|
2015-03-17 16:33:25 -04:00
|
|
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Two Tote Distance"), 0.0, 0.75));
|
2015-02-24 12:02:30 -05:00
|
|
|
AddSequential(new CollectTote());
|
2015-10-09 13:10:34 -04:00
|
|
|
AddSequential(new Lower(3.0,false,1));
|
|
|
|
AddSequential(new Raise(3.5,false,-1));
|
2015-07-31 12:52:15 -04:00
|
|
|
if(SmartDashboard::GetBoolean("Three totes")) {
|
2015-03-17 16:33:25 -04:00
|
|
|
AddSequential(new Turn(3.8));
|
|
|
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Three Tote Distance"), 0.0, 0.75));
|
2015-03-05 20:07:52 -05:00
|
|
|
AddSequential(new CollectTote());
|
2015-10-09 13:10:34 -04:00
|
|
|
AddSequential(new Lower(3.0,false,1));
|
|
|
|
AddSequential(new Raise(3.5,false,-1));
|
2015-03-05 20:07:52 -05:00
|
|
|
}
|
2015-02-24 12:02:30 -05:00
|
|
|
}
|
2015-02-28 03:23:54 -05:00
|
|
|
AddSequential(new Turn(SmartDashboard::GetNumber("TurnAmount")));
|
2015-03-17 16:33:25 -04:00
|
|
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, 0.75));
|
2015-02-24 15:03:59 -05:00
|
|
|
AddSequential(new ReleaseTote());
|
2015-02-13 17:34:38 -05:00
|
|
|
break;
|
2015-04-05 06:45:31 -04:00
|
|
|
case 4:
|
2015-03-19 08:52:16 -04:00
|
|
|
//Use rear elevator to move tote
|
2015-03-20 14:27:59 -04:00
|
|
|
AddSequential(new Turn(1.8));
|
2015-03-22 14:29:07 -04:00
|
|
|
AddSequential(new AutoDrive(2.3, 0.0, -0.75));
|
2015-03-20 14:27:59 -04:00
|
|
|
AddSequential(new Turn(1.8));
|
2015-03-19 08:52:16 -04:00
|
|
|
break;
|
2015-04-05 06:45:31 -04:00
|
|
|
case 5:
|
2015-03-19 09:04:55 -04:00
|
|
|
//Use rear elevator to move bin
|
2015-03-22 14:29:07 -04:00
|
|
|
AddSequential(new BinLower(0.1));
|
|
|
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, 0.75));
|
2015-03-19 08:52:16 -04:00
|
|
|
AddSequential(new Turn(2.1));
|
|
|
|
break;
|
2015-04-23 05:09:43 -04:00
|
|
|
case 6:
|
|
|
|
//Drive forward and collect a single gray tote
|
2015-10-09 13:10:34 -04:00
|
|
|
AddSequential(new Lower(3.0,false,1));
|
2015-04-23 05:09:43 -04:00
|
|
|
AddSequential(new CollectTote(SmartDashboard::GetNumber("CollectToteTurn")));
|
2015-10-09 13:10:34 -04:00
|
|
|
AddSequential(new Lower(3.0,false,1));
|
|
|
|
AddSequential(new Raise(3.5,false,-1));
|
2015-04-23 05:09:43 -04:00
|
|
|
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0.0, -0.75));
|
2015-02-13 17:34:38 -05:00
|
|
|
default:
|
|
|
|
printf("Invalid seq: %d\n", seq);
|
|
|
|
break;
|
|
|
|
}
|
2015-02-06 13:45:01 -05:00
|
|
|
}
|
2015-02-08 12:26:15 -05:00
|
|
|
// vim: ts=2:sw=2:et
|