2
0
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:
Austen Adler 2015-02-13 22:30:15 -05:00
parent 79b635d554
commit d92afcde6e
7 changed files with 25 additions and 21 deletions

View File

@ -25,6 +25,7 @@ bool AutoDrive::IsFinished(){
return IsTimedOut(); return IsTimedOut();
} }
void AutoDrive::End(){ void AutoDrive::End(){
DentRobot::drivetrain->DriveMecanum(0.0,0.0,0.0,0.9,0.0);
} }
void AutoDrive::Interrupted(){ void AutoDrive::Interrupted(){
End(); End();

View File

@ -7,28 +7,30 @@
#include "../Collector/CloseCollector.h" #include "../Collector/CloseCollector.h"
#include "../Collector/OpenCollector.h" #include "../Collector/OpenCollector.h"
#include "../Collector/RollIn.h" #include "../Collector/RollIn.h"
#include "../Collector/CollectTote.h"
Autonomous::Autonomous(int seq){ Autonomous::Autonomous(int seq){
SmartDashboard::GetNumber("Auto Wait Time"); //SmartDashboard::GetNumber("Auto Wait Time");
switch(seq){ switch(seq){
case 0: case 0:
// Just for testing // Just for testing
AddSequential(new Raise()); AddSequential(new CollectTote());
AddSequential(new Lower()); //AddSequential(new Raise());
AddSequential(new OpenCollector()); //AddSequential(new Lower());
AddSequential(new CloseCollector()); //AddSequential(new OpenCollector());
AddSequential(new Turn()); //AddSequential(new CloseCollector());
AddParallel(new AutoDrive(0.5)); //AddSequential(new Turn());
AddParallel(new CloseCollector()); //AddParallel(new AutoDrive(0.5));
AddSequential(new RollIn()); //AddParallel(new CloseCollector());
AddSequential(new Turn()); //AddSequential(new RollIn());
//AddSequential(new Turn());
break; break;
case 1: case 1:
// Drive forward a bit, turn around, collect tote then bin // Drive forward a bit, turn around, collect tote then bin
AddParallel(new Raise());
AddSequential(new AutoDrive(0.5)); AddSequential(new AutoDrive(0.5));
AddSequential(new Turn()); AddSequential(new Turn());
AddSequential(new Turn()); AddSequential(new Turn());
AddSequential(new RollIn()); AddSequential(new RollIn());
AddSequential(new Raise());
break; break;
case 2: case 2:
// Drive forward a bit, turn around, collect tote then bin // Drive forward a bit, turn around, collect tote then bin
@ -40,7 +42,7 @@ Autonomous::Autonomous(int seq){
break; break;
case 3: case 3:
// Wait a desigated value, drive to Auto Zone (TM) // 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)); AddSequential(new AutoDrive(2.0));
break; break;
default: default:

View File

@ -15,6 +15,8 @@ bool Turn::IsFinished(){
return IsTimedOut(); return IsTimedOut();
} }
void Turn::End(){ void Turn::End(){
// Stop driving
DentRobot::drivetrain->DriveMecanum(0.0,0.0,0.0,0.9,0.0);
} }
void Turn::Interrupted(){ void Turn::Interrupted(){
End(); End();

View File

@ -1,10 +1,9 @@
#include "CloseCollector.h" #include "CloseCollector.h"
CloseCollector::CloseCollector() : Command("CloseCollector"){ CloseCollector::CloseCollector() : Command("CloseCollector"){
Requires(DentRobot::collector);
} }
void CloseCollector::Initialize(){ void CloseCollector::Initialize(){
printf("Initialized collector: 0.5\n"); printf("Initialized collector: 0.5\n");
SetTimeout(2.5); SetTimeout(.5);
} }
void CloseCollector::Execute(){ void CloseCollector::Execute(){
//printf("Closing collector: -0.5f\n"); //printf("Closing collector: -0.5f\n");

View File

@ -4,8 +4,9 @@
#include "RollIn.h" #include "RollIn.h"
#include "CloseCollector.h" #include "CloseCollector.h"
CollectTote::CollectTote(){ CollectTote::CollectTote(){
AddParallel(new RollIn()); AddParallel(new CloseCollector());
AddParallel(new AutoDrive(0.5, -0.75)); AddSequential(new RollIn());
AddSequential(new CloseCollector()); // TODO: Fix null error
//AddParallel(new AutoDrive(0.5, -0.75));
} }
// vim: ts=2:sw=2:et // vim: ts=2:sw=2:et

View File

@ -1,6 +1,5 @@
#include "RollIn.h" #include "RollIn.h"
RollIn::RollIn() : Command("RollIn"){ RollIn::RollIn() : Command("RollIn"){
Requires(DentRobot::collector);
} }
void RollIn::Initialize(){ void RollIn::Initialize(){
printf("Initialized RollIn\n"); printf("Initialized RollIn\n");

View File

@ -16,12 +16,12 @@ DentRobot::DentRobot(){
aut=new Autonomous(0); 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 Wait Time", 1.0);
SmartDashboard::PutNumber("Auto Sequence", 0); //SmartDashboard::PutNumber("Auto Sequence", 0);
printf("Initialized"); printf("Initialized");
} }
void DentRobot::RobotInit(){ void DentRobot::RobotInit(){
SmartDashboard::PutNumber("CodeVersion",0.001); //SmartDashboard::PutNumber("CodeVersion",0.001);
} }
void DentRobot::DisabledPeriodic(){ void DentRobot::DisabledPeriodic(){
Scheduler::GetInstance()->Run(); Scheduler::GetInstance()->Run();