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

View File

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

View File

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

View File

@ -1,22 +1,22 @@
#include "ReleaseTote.h"
ReleaseTote::ReleaseTote() : Command("ReleaseTote"){
#include "RollOut.h"
RollOut::RollOut() : Command("RollOut"){
Requires(DentRobot::collector);
}
void ReleaseTote::Initialize(){
void RollOut::Initialize(){
SetTimeout(2.0);
}
void ReleaseTote::Execute(){
void RollOut::Execute(){
//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
DentRobot::collector->MoveRollers((-DentRobot::oi->GetLeftStick()->GetRawAxis(3)+1.0)/2/2);
}
bool ReleaseTote::IsFinished(){
bool RollOut::IsFinished(){
return DentRobot::collector->BoxCollected();
}
void ReleaseTote::End(){
void RollOut::End(){
DentRobot::collector->MoveRollers(0.0f);
}
void ReleaseTote::Interrupted(){
void RollOut::Interrupted(){
End();
}
// vim: ts=2:sw=2:et

View File

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

8
OI.cpp
View File

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