mirror of
https://github.com/team2059/Dent
synced 2024-12-18 20:52:29 -05:00
Worked on autonomous
This commit is contained in:
parent
81ec89c8f1
commit
24844d9086
@ -1,9 +1,9 @@
|
|||||||
#include "AutoDrive.h"
|
#include "AutoDrive.h"
|
||||||
#include "../../DentRobot.h"
|
#include "../../DentRobot.h"
|
||||||
// Drive for a short while then stop. Just for testing
|
// Drive for a short while then stop. Just for testing
|
||||||
AutoDrive::AutoDrive() : Command("AutoDrive"){
|
AutoDrive::AutoDrive(double wait) : Command("AutoDrive"){
|
||||||
Requires(DentRobot::drivetrain);
|
Requires(DentRobot::drivetrain);
|
||||||
SetTimeout(0.5);
|
SetTimeout(wait);
|
||||||
}
|
}
|
||||||
void AutoDrive::Initialize(){
|
void AutoDrive::Initialize(){
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
class AutoDrive: public Command{
|
class AutoDrive: public Command{
|
||||||
public:
|
public:
|
||||||
AutoDrive();
|
AutoDrive(double);
|
||||||
void Initialize();
|
void Initialize();
|
||||||
void Execute();
|
void Execute();
|
||||||
bool IsFinished();
|
bool IsFinished();
|
||||||
|
@ -7,15 +7,45 @@
|
|||||||
#include "../Collector/CloseCollector.h"
|
#include "../Collector/CloseCollector.h"
|
||||||
#include "../Collector/OpenCollector.h"
|
#include "../Collector/OpenCollector.h"
|
||||||
#include "../Collector/CollectTote.h"
|
#include "../Collector/CollectTote.h"
|
||||||
Autonomous::Autonomous(){
|
Autonomous::Autonomous(int seq){
|
||||||
AddSequential(new Raise());
|
SmartDashboard::GetNumber("Auto Wait Time");
|
||||||
AddSequential(new Lower());
|
switch(seq){
|
||||||
AddParallel(new OpenCollector());
|
case 0:
|
||||||
AddParallel(new CloseCollector());
|
// Just for testing
|
||||||
AddSequential(new Turn());
|
AddSequential(new Raise());
|
||||||
AddParallel(new AutoDrive());
|
AddSequential(new Lower());
|
||||||
AddParallel(new CloseCollector());
|
AddSequential(new OpenCollector());
|
||||||
AddParallel(new CollectTote());
|
AddSequential(new CloseCollector());
|
||||||
AddSequential(new Turn());
|
AddSequential(new Turn());
|
||||||
|
AddParallel(new AutoDrive(0.5));
|
||||||
|
AddParallel(new CloseCollector());
|
||||||
|
AddSequential(new CollectTote());
|
||||||
|
AddSequential(new Turn());
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
// Drive forward a bit, turn around, collect tote then bin
|
||||||
|
AddParallel(new Raise());
|
||||||
|
AddSequential(new AutoDrive(0.5));
|
||||||
|
AddSequential(new Turn());
|
||||||
|
AddSequential(new Turn());
|
||||||
|
AddSequential(new CollectTote());
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// Drive forward a bit, turn around, collect tote then bin
|
||||||
|
AddParallel(new Raise());
|
||||||
|
AddParallel(new AutoDrive(0.5));
|
||||||
|
AddSequential(new Turn());
|
||||||
|
AddSequential(new Turn());
|
||||||
|
AddSequential(new CollectTote());
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// Wait a desigated value, drive to Auto Zone (TM)
|
||||||
|
Wait(SmartDashboard::GetNumber("Auto Wait Time"));
|
||||||
|
AddSequential(new AutoDrive(2.0));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("Invalid seq: %d\n", seq);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// vim: ts=2:sw=2:et
|
// vim: ts=2:sw=2:et
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
class Autonomous: public CommandGroup{
|
class Autonomous: public CommandGroup{
|
||||||
public:
|
public:
|
||||||
Autonomous();
|
Autonomous(int);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
// vim: ts=2:sw=2:et
|
// vim: ts=2:sw=2:et
|
||||||
|
@ -13,9 +13,11 @@ DentRobot::DentRobot(){
|
|||||||
drivetrain=new Drivetrain();
|
drivetrain=new Drivetrain();
|
||||||
elevator=new Elevator();
|
elevator=new Elevator();
|
||||||
binElevator=new BinElevator();
|
binElevator=new BinElevator();
|
||||||
aut=new Autonomous();
|
aut=new Autonomous(0);
|
||||||
CameraServer::GetInstance()->SetQuality(25);
|
CameraServer::GetInstance()->SetQuality(25);
|
||||||
CameraServer::GetInstance()->StartAutomaticCapture("cam0");
|
CameraServer::GetInstance()->StartAutomaticCapture("cam0");
|
||||||
|
SmartDashboard::PutNumber("Auto Wait Time", 1.0);
|
||||||
|
SmartDashboard::PutNumber("Auto Sequence", 0);
|
||||||
printf("Initialized");
|
printf("Initialized");
|
||||||
}
|
}
|
||||||
void DentRobot::RobotInit(){
|
void DentRobot::RobotInit(){
|
||||||
|
Loading…
Reference in New Issue
Block a user