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

Renamed collector commands (untested)

This commit is contained in:
Austen Adler 2015-02-13 19:40:23 -05:00
parent 24844d9086
commit dc593a3282
6 changed files with 31 additions and 31 deletions

View File

@ -6,7 +6,7 @@
#include "Turn.h" #include "Turn.h"
#include "../Collector/CloseCollector.h" #include "../Collector/CloseCollector.h"
#include "../Collector/OpenCollector.h" #include "../Collector/OpenCollector.h"
#include "../Collector/CollectTote.h" #include "../Collector/RollIn.h"
Autonomous::Autonomous(int seq){ Autonomous::Autonomous(int seq){
SmartDashboard::GetNumber("Auto Wait Time"); SmartDashboard::GetNumber("Auto Wait Time");
switch(seq){ switch(seq){
@ -19,7 +19,7 @@ Autonomous::Autonomous(int seq){
AddSequential(new Turn()); AddSequential(new Turn());
AddParallel(new AutoDrive(0.5)); AddParallel(new AutoDrive(0.5));
AddParallel(new CloseCollector()); AddParallel(new CloseCollector());
AddSequential(new CollectTote()); AddSequential(new RollIn());
AddSequential(new Turn()); AddSequential(new Turn());
break; break;
case 1: case 1:
@ -28,7 +28,7 @@ Autonomous::Autonomous(int seq){
AddSequential(new AutoDrive(0.5)); AddSequential(new AutoDrive(0.5));
AddSequential(new Turn()); AddSequential(new Turn());
AddSequential(new Turn()); AddSequential(new Turn());
AddSequential(new CollectTote()); AddSequential(new RollIn());
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
@ -36,7 +36,7 @@ Autonomous::Autonomous(int seq){
AddParallel(new AutoDrive(0.5)); AddParallel(new AutoDrive(0.5));
AddSequential(new Turn()); AddSequential(new Turn());
AddSequential(new Turn()); AddSequential(new Turn());
AddSequential(new CollectTote()); AddSequential(new RollIn());
break; break;
case 3: case 3:
// Wait a desigated value, drive to Auto Zone (TM) // Wait a desigated value, drive to Auto Zone (TM)

View File

@ -1,22 +1,22 @@
#include "CollectTote.h" #include "RollIn.h"
CollectTote::CollectTote() : Command("CollectTote"){ RollIn::RollIn() : Command("RollIn"){
Requires(DentRobot::collector); Requires(DentRobot::collector);
} }
void CollectTote::Initialize(){ void RollIn::Initialize(){
printf("Initialized CollectTote\n"); printf("Initialized RollIn\n");
SetTimeout(2.0); SetTimeout(2.0);
} }
void CollectTote::Execute(){ void RollIn::Execute(){
//TODO check this value to move the motors in the right direction //TODO check this value to move the motors in the right direction
DentRobot::collector->MoveRollers(-(-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2); DentRobot::collector->MoveRollers(-(-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2);
} }
bool CollectTote::IsFinished(){ bool RollIn::IsFinished(){
return DentRobot::collector->BoxCollected()||IsTimedOut(); return DentRobot::collector->BoxCollected()||IsTimedOut();
} }
void CollectTote::End(){ void RollIn::End(){
DentRobot::collector->MoveRollers(0.0); DentRobot::collector->MoveRollers(0.0);
} }
void CollectTote::Interrupted(){ void RollIn::Interrupted(){
End(); End();
} }
// vim: ts=2:sw=2:et // vim: ts=2:sw=2:et

View File

@ -1,14 +1,14 @@
#ifndef COLLECTTOTE_H #ifndef ROLLIN_H
#define COLLECTTOTE_H #define ROLLIN_H
#include "Commands/Command.h" #include "Commands/Command.h"
#include "../../CommandBase.h" #include "../../CommandBase.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "WPILib.h" #include "WPILib.h"
class CollectTote: public Command{ class RollIn: public Command{
public: public:
CollectTote(); RollIn();
void Initialize(); void Initialize();
void Execute(); void Execute();
bool IsFinished(); bool IsFinished();

View File

@ -1,22 +1,22 @@
#include "ReleaseTote.h" #include "RollOut.h"
ReleaseTote::ReleaseTote() : Command("ReleaseTote"){ RollOut::RollOut() : Command("RollOut"){
Requires(DentRobot::collector); Requires(DentRobot::collector);
} }
void ReleaseTote::Initialize(){ void RollOut::Initialize(){
SetTimeout(2.0); SetTimeout(2.0);
} }
void ReleaseTote::Execute(){ void RollOut::Execute(){
//TODO check this value to move the motors in the right direction //TODO check this value to move the motors in the right direction
// Devide by 2 twice because this speed should be half the collector speed // Devide by 2 twice because this speed should be half the collector speed
DentRobot::collector->MoveRollers((-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2/2); DentRobot::collector->MoveRollers((-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2/2);
} }
bool ReleaseTote::IsFinished(){ bool RollOut::IsFinished(){
return DentRobot::collector->BoxCollected(); return DentRobot::collector->BoxCollected();
} }
void ReleaseTote::End(){ void RollOut::End(){
DentRobot::collector->MoveRollers(0.0f); DentRobot::collector->MoveRollers(0.0f);
} }
void ReleaseTote::Interrupted(){ void RollOut::Interrupted(){
End(); End();
} }
// vim: ts=2:sw=2:et // vim: ts=2:sw=2:et

View File

@ -1,14 +1,14 @@
#ifndef RELEASETOTE_H #ifndef ROLLOUT_H
#define RELEASETOTE_H #define ROLLOUT_H
#include "Commands/Command.h" #include "Commands/Command.h"
#include "../../CommandBase.h" #include "../../CommandBase.h"
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "WPILib.h" #include "WPILib.h"
class ReleaseTote: public Command{ class RollOut: public Command{
public: public:
ReleaseTote(); RollOut();
void Initialize(); void Initialize();
void Execute(); void Execute();
bool IsFinished(); bool IsFinished();

8
OI.cpp
View File

@ -3,8 +3,8 @@
#include "Commands/Elevator/Raise.h" #include "Commands/Elevator/Raise.h"
#include "Commands/Collector/OpenCollector.h" #include "Commands/Collector/OpenCollector.h"
#include "Commands/Collector/CloseCollector.h" #include "Commands/Collector/CloseCollector.h"
#include "Commands/Collector/CollectTote.h" #include "Commands/Collector/RollIn.h"
#include "Commands/Collector/ReleaseTote.h" #include "Commands/Collector/RollOut.h"
OI::OI() { OI::OI() {
// Joysticks // Joysticks
@ -17,8 +17,8 @@ OI::OI() {
JoystickButton *left2=new JoystickButton(leftStick, 2); JoystickButton *left2=new JoystickButton(leftStick, 2);
right1->WhileHeld(new CloseCollector()); right1->WhileHeld(new CloseCollector());
right2->WhileHeld(new OpenCollector()); right2->WhileHeld(new OpenCollector());
left1->WhileHeld(new CollectTote()); left1->WhileHeld(new RollIn());
left2->WhileHeld(new ReleaseTote()); left2->WhileHeld(new RollOut());
// Elevator // Elevator
raise=new Raise(); raise=new Raise();
lower=new Lower(); lower=new Lower();