mirror of
https://github.com/team2059/Dent
synced 2024-12-18 20:52:29 -05:00
Worked on auto. Fixed the bug of the century: robot could not collect and close collector at the same time
This commit is contained in:
parent
79b635d554
commit
d92afcde6e
@ -25,6 +25,7 @@ bool AutoDrive::IsFinished(){
|
||||
return IsTimedOut();
|
||||
}
|
||||
void AutoDrive::End(){
|
||||
DentRobot::drivetrain->DriveMecanum(0.0,0.0,0.0,0.9,0.0);
|
||||
}
|
||||
void AutoDrive::Interrupted(){
|
||||
End();
|
||||
|
@ -7,28 +7,30 @@
|
||||
#include "../Collector/CloseCollector.h"
|
||||
#include "../Collector/OpenCollector.h"
|
||||
#include "../Collector/RollIn.h"
|
||||
#include "../Collector/CollectTote.h"
|
||||
Autonomous::Autonomous(int seq){
|
||||
SmartDashboard::GetNumber("Auto Wait Time");
|
||||
//SmartDashboard::GetNumber("Auto Wait Time");
|
||||
switch(seq){
|
||||
case 0:
|
||||
// Just for testing
|
||||
AddSequential(new Raise());
|
||||
AddSequential(new Lower());
|
||||
AddSequential(new OpenCollector());
|
||||
AddSequential(new CloseCollector());
|
||||
AddSequential(new Turn());
|
||||
AddParallel(new AutoDrive(0.5));
|
||||
AddParallel(new CloseCollector());
|
||||
AddSequential(new RollIn());
|
||||
AddSequential(new Turn());
|
||||
AddSequential(new CollectTote());
|
||||
//AddSequential(new Raise());
|
||||
//AddSequential(new Lower());
|
||||
//AddSequential(new OpenCollector());
|
||||
//AddSequential(new CloseCollector());
|
||||
//AddSequential(new Turn());
|
||||
//AddParallel(new AutoDrive(0.5));
|
||||
//AddParallel(new CloseCollector());
|
||||
//AddSequential(new RollIn());
|
||||
//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 RollIn());
|
||||
AddSequential(new Raise());
|
||||
break;
|
||||
case 2:
|
||||
// Drive forward a bit, turn around, collect tote then bin
|
||||
@ -40,7 +42,7 @@ Autonomous::Autonomous(int seq){
|
||||
break;
|
||||
case 3:
|
||||
// Wait a desigated value, drive to Auto Zone (TM)
|
||||
Wait(SmartDashboard::GetNumber("Auto Wait Time"));
|
||||
//Wait(SmartDashboard::GetNumber("Auto Wait Time"));
|
||||
AddSequential(new AutoDrive(2.0));
|
||||
break;
|
||||
default:
|
||||
|
@ -15,6 +15,8 @@ bool Turn::IsFinished(){
|
||||
return IsTimedOut();
|
||||
}
|
||||
void Turn::End(){
|
||||
// Stop driving
|
||||
DentRobot::drivetrain->DriveMecanum(0.0,0.0,0.0,0.9,0.0);
|
||||
}
|
||||
void Turn::Interrupted(){
|
||||
End();
|
||||
|
@ -1,10 +1,9 @@
|
||||
#include "CloseCollector.h"
|
||||
CloseCollector::CloseCollector() : Command("CloseCollector"){
|
||||
Requires(DentRobot::collector);
|
||||
}
|
||||
void CloseCollector::Initialize(){
|
||||
printf("Initialized collector: 0.5\n");
|
||||
SetTimeout(2.5);
|
||||
SetTimeout(.5);
|
||||
}
|
||||
void CloseCollector::Execute(){
|
||||
//printf("Closing collector: -0.5f\n");
|
||||
|
@ -4,8 +4,9 @@
|
||||
#include "RollIn.h"
|
||||
#include "CloseCollector.h"
|
||||
CollectTote::CollectTote(){
|
||||
AddParallel(new RollIn());
|
||||
AddParallel(new AutoDrive(0.5, -0.75));
|
||||
AddSequential(new CloseCollector());
|
||||
AddParallel(new CloseCollector());
|
||||
AddSequential(new RollIn());
|
||||
// TODO: Fix null error
|
||||
//AddParallel(new AutoDrive(0.5, -0.75));
|
||||
}
|
||||
// vim: ts=2:sw=2:et
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "RollIn.h"
|
||||
RollIn::RollIn() : Command("RollIn"){
|
||||
Requires(DentRobot::collector);
|
||||
}
|
||||
void RollIn::Initialize(){
|
||||
printf("Initialized RollIn\n");
|
||||
|
@ -16,12 +16,12 @@ DentRobot::DentRobot(){
|
||||
aut=new Autonomous(0);
|
||||
CameraServer::GetInstance()->SetQuality(25);
|
||||
CameraServer::GetInstance()->StartAutomaticCapture("cam0");
|
||||
SmartDashboard::PutNumber("Auto Wait Time", 1.0);
|
||||
SmartDashboard::PutNumber("Auto Sequence", 0);
|
||||
//SmartDashboard::PutNumber("Auto Wait Time", 1.0);
|
||||
//SmartDashboard::PutNumber("Auto Sequence", 0);
|
||||
printf("Initialized");
|
||||
}
|
||||
void DentRobot::RobotInit(){
|
||||
SmartDashboard::PutNumber("CodeVersion",0.001);
|
||||
//SmartDashboard::PutNumber("CodeVersion",0.001);
|
||||
}
|
||||
void DentRobot::DisabledPeriodic(){
|
||||
Scheduler::GetInstance()->Run();
|
||||
|
Loading…
Reference in New Issue
Block a user