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

added bin collecting, super strafing autogd

This commit is contained in:
Adam Long 2015-02-27 11:47:10 +00:00
parent bbc4f69932
commit 0296bf7831
7 changed files with 24 additions and 16 deletions

View File

@ -3,6 +3,8 @@
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../Elevator/Raise.h" #include "../Elevator/Raise.h"
#include "../Elevator/Lower.h" #include "../Elevator/Lower.h"
#include "../BinElevator/BinRaise.h"
#include "../BinElevator/BinLower.h"
#include "AutoDrive.h" #include "AutoDrive.h"
#include "Turn.h" #include "Turn.h"
#include "../Collector/RollIn.h" #include "../Collector/RollIn.h"
@ -18,15 +20,15 @@ Autonomous::Autonomous(int seq){
case 1: case 1:
// 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(SmartDashboard::GetNumber("Auto Zone Distance"), -0.75,0)); AddSequential(new BinRaise(1.2));
AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0,1));
AddSequential(new BinLower(.9));
//AddSequential(new AutoDrive(1.2, -0.75,0));
break; break;
case 2: case 2:
// Get one tote and go to Auto Zone (TM) // Wait a desigated value, drive to Auto Zone (TM)
AddSequential(new CollectTote()); Wait(SmartDashboard::GetNumber("Auto Wait Time"));
AddSequential(new Turn(90)); AddSequential(new AutoDrive(SmartDashboard::GetNumber("Auto Zone Distance"), 0,1));
AddSequential(new AutoDrive(2.0, 1.0, 0.0));
AddSequential(new ReleaseTote());
AddSequential(new AutoDrive(0.5, -1.0, 0.0));
break; break;
case 3: case 3:
// Collect three totes, drive to Auto Zone (TM) // Collect three totes, drive to Auto Zone (TM)

View File

@ -1,10 +1,11 @@
#include "BinLower.h" #include "BinLower.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../../OI.h" #include "../../OI.h"
BinLower::BinLower() : Command("BinLower"){ BinLower::BinLower(float t) : Command("BinLower"){
timeout=t;
} }
void BinLower::Initialize(){ void BinLower::Initialize(){
SetTimeout(2.5); SetTimeout(timeout);
} }
void BinLower::Execute(){ void BinLower::Execute(){
DentRobot::binElevator->Run(-1.0); DentRobot::binElevator->Run(-1.0);

View File

@ -5,8 +5,10 @@
#include "WPILib.h" #include "WPILib.h"
class BinLower: public Command{ class BinLower: public Command{
private:
float timeout;
public: public:
BinLower(); BinLower(float);
void Initialize(); void Initialize();
void Execute(); void Execute();
bool IsFinished(); bool IsFinished();

View File

@ -1,10 +1,11 @@
#include "BinRaise.h" #include "BinRaise.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../../OI.h" #include "../../OI.h"
BinRaise::BinRaise() : Command("BinRaise"){ BinRaise::BinRaise(float t) : Command("BinRaise"){
timeout=t;
} }
void BinRaise::Initialize(){ void BinRaise::Initialize(){
SetTimeout(3.0); SetTimeout(timeout);
} }
void BinRaise::Execute(){ void BinRaise::Execute(){
DentRobot::binElevator->Run(1.0); DentRobot::binElevator->Run(1.0);

View File

@ -5,8 +5,10 @@
#include "WPILib.h" #include "WPILib.h"
class BinRaise: public Command{ class BinRaise: public Command{
private:
float timeout;
public: public:
BinRaise(); BinRaise(float);
void Initialize(); void Initialize();
void Execute(); void Execute();
bool IsFinished(); bool IsFinished();

View File

@ -32,7 +32,7 @@ void DentRobot::RobotInit(){
SmartDashboard::PutBoolean("Three totes", true); SmartDashboard::PutBoolean("Three totes", true);
// TODO: Calibrate the following two values // TODO: Calibrate the following two values
// Distance (in time) to auto zone // Distance (in time) to auto zone
SmartDashboard::PutNumber("Auto Zone Distance", 1.0); SmartDashboard::PutNumber("Auto Zone Distance", 5.7);
// Distance (in time) to auto tote (used in sequence 3) // Distance (in time) to auto tote (used in sequence 3)
SmartDashboard::PutNumber("Auto Tote Distance", 0.5); SmartDashboard::PutNumber("Auto Tote Distance", 0.5);

4
OI.cpp
View File

@ -35,8 +35,8 @@ OI::OI() {
//JoystickButton *right8=new JoystickButton(rightStick, 8); //JoystickButton *right8=new JoystickButton(rightStick, 8);
//right7->WhenPressed(new BinOpenArms()); //right7->WhenPressed(new BinOpenArms());
//right8->WhenPressed(new BinCloseArms()); //right8->WhenPressed(new BinCloseArms());
binRaise=new BinRaise(); binRaise=new BinRaise(3.0);
binLower=new BinLower(); binLower=new BinLower(2.0);
right3->WhenPressed(binLower); right3->WhenPressed(binLower);
right3->CancelWhenPressed(binRaise); right3->CancelWhenPressed(binRaise);
right5->WhenPressed(binRaise); right5->WhenPressed(binRaise);