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

Removed window motors (untested)

This commit is contained in:
Austen Adler 2015-02-14 15:24:42 -05:00
parent c783651d56
commit c8acfae930
11 changed files with 1 additions and 114 deletions

View File

@ -4,8 +4,6 @@
#include "../Elevator/Lower.h" #include "../Elevator/Lower.h"
#include "AutoDrive.h" #include "AutoDrive.h"
#include "Turn.h" #include "Turn.h"
#include "../Collector/CloseCollector.h"
#include "../Collector/OpenCollector.h"
#include "../Collector/RollIn.h" #include "../Collector/RollIn.h"
#include "../Collector/CollectTote.h" #include "../Collector/CollectTote.h"
Autonomous::Autonomous(int seq){ Autonomous::Autonomous(int seq){
@ -16,11 +14,8 @@ Autonomous::Autonomous(int seq){
AddSequential(new CollectTote()); AddSequential(new CollectTote());
//AddSequential(new Raise()); //AddSequential(new Raise());
//AddSequential(new Lower()); //AddSequential(new Lower());
//AddSequential(new OpenCollector());
//AddSequential(new CloseCollector());
//AddSequential(new Turn()); //AddSequential(new Turn());
//AddParallel(new AutoDrive(0.5)); //AddParallel(new AutoDrive(0.5));
//AddParallel(new CloseCollector());
//AddSequential(new RollIn()); //AddSequential(new RollIn());
//AddSequential(new Turn()); //AddSequential(new Turn());
break; break;

View File

@ -1,27 +0,0 @@
#include "CloseCollector.h"
CloseCollector::CloseCollector() : Command("CloseCollector"){
}
void CloseCollector::Initialize(){
printf("Initialized collector: 0.5\n");
SetTimeout(1);
}
void CloseCollector::Execute(){
//printf("Closing collector: -0.5f\n");
DentRobot::collector->MoveArms(-0.5);
//DentRobot::collector->MoveArms(-(-DentRobot::oi->GetRightStick()->GetRawAxis(3)+1)/2*.3/.5);
}
bool CloseCollector::IsFinished(){
if(DentRobot::collector->ArmSensor()||IsTimedOut()){
printf("Stopped Closing: %d, %d\n",DentRobot::collector->ArmSensor(), IsTimedOut());
return true;
}else{
return false;
}
}
void CloseCollector::End(){
DentRobot::collector->MoveArms(0.0f);
}
void CloseCollector::Interrupted(){
End();
}
// vim: ts=2:sw=2:et

View File

@ -1,20 +0,0 @@
#ifndef CLOSECOLLECTOR_H
#define CLOSECOLLECTOR_H
#include "Commands/Command.h"
#include "../../CommandBase.h"
#include "../../DentRobot.h"
#include "WPILib.h"
class CloseCollector: public Command{
public:
CloseCollector();
void Initialize();
void Execute();
bool IsFinished();
void End();
void Interrupted();
};
#endif
// vim: ts=2:sw=2:et

View File

@ -2,15 +2,11 @@
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "../Autonomous/AutoDrive.h" #include "../Autonomous/AutoDrive.h"
#include "RollIn.h" #include "RollIn.h"
#include "CloseCollector.h"
CollectTote::CollectTote(){ CollectTote::CollectTote(){
AddParallel(new CloseCollector());
AddParallel(new AutoDrive(0.5, -1.0)); AddParallel(new AutoDrive(0.5, -1.0));
AddSequential(new RollIn()); AddSequential(new RollIn());
AddParallel(new CloseCollector());
AddParallel(new AutoDrive(0.5, 1.0)); AddParallel(new AutoDrive(0.5, 1.0));
AddSequential(new RollIn()); AddSequential(new RollIn());
AddParallel(new CloseCollector());
AddParallel(new AutoDrive(0.5, -1.0)); AddParallel(new AutoDrive(0.5, -1.0));
AddSequential(new RollIn()); AddSequential(new RollIn());
} }

View File

@ -1,22 +0,0 @@
#include "OpenCollector.h"
OpenCollector::OpenCollector() : Command("OpenCollector"){
Requires(DentRobot::collector);
}
void OpenCollector::Initialize(){
SetTimeout(0.5);
}
void OpenCollector::Execute(){
DentRobot::collector->MoveArms(0.35);
//DentRobot::collector->MoveArms((-DentRobot::oi->GetRightStick()->GetRawAxis(3)+1)/2*.3/.5);
}
bool OpenCollector::IsFinished(){
//return DentRobot::collector->ArmSensor();
return IsTimedOut();
}
void OpenCollector::End(){
DentRobot::collector->MoveArms(0.0f);
}
void OpenCollector::Interrupted(){
End();
}
// vim: ts=2:sw=2:et

View File

@ -1,20 +0,0 @@
#ifndef OPENCOLLECTOR_H
#define OPENCOLLECTOR_H
#include "Commands/Command.h"
#include "../../CommandBase.h"
#include "../../DentRobot.h"
#include "WPILib.h"
class OpenCollector: public Command{
public:
OpenCollector();
void Initialize();
void Execute();
bool IsFinished();
void End();
void Interrupted();
};
#endif
// vim: ts=2:sw=2:et

View File

@ -2,10 +2,8 @@
#include "../../DentRobot.h" #include "../../DentRobot.h"
#include "RollOut.h" #include "RollOut.h"
#include "../Autonomous/AutoDrive.h" #include "../Autonomous/AutoDrive.h"
#include "CloseCollector.h"
ReleaseTote::ReleaseTote(){ ReleaseTote::ReleaseTote(){
AddParallel(new RollOut()); AddParallel(new RollOut());
AddParallel(new AutoDrive(0.5, 0.75)); AddParallel(new AutoDrive(0.5, 0.75));
AddSequential(new CloseCollector());
} }
// vim: ts=2:sw=2:et // vim: ts=2:sw=2:et

6
OI.cpp
View File

@ -1,8 +1,6 @@
#include "OI.h" #include "OI.h"
#include "Commands/Elevator/Lower.h" #include "Commands/Elevator/Lower.h"
#include "Commands/Elevator/Raise.h" #include "Commands/Elevator/Raise.h"
#include "Commands/Collector/OpenCollector.h"
#include "Commands/Collector/CloseCollector.h"
#include "Commands/Collector/RollIn.h" #include "Commands/Collector/RollIn.h"
#include "Commands/Collector/RollOut.h" #include "Commands/Collector/RollOut.h"
#include "Commands/BinElevator/BinLower.h" #include "Commands/BinElevator/BinLower.h"
@ -13,12 +11,8 @@ OI::OI() {
leftStick=new Joystick(0); leftStick=new Joystick(0);
rightStick=new Joystick(1); rightStick=new Joystick(1);
// Collector // Collector
JoystickButton *right1=new JoystickButton(rightStick, 1);
JoystickButton *right2=new JoystickButton(rightStick, 2);
JoystickButton *left1=new JoystickButton(leftStick, 1); JoystickButton *left1=new JoystickButton(leftStick, 1);
JoystickButton *left2=new JoystickButton(leftStick, 2); JoystickButton *left2=new JoystickButton(leftStick, 2);
right1->WhileHeld(new CloseCollector());
right2->WhileHeld(new OpenCollector());
left1->WhileHeld(new RollIn()); left1->WhileHeld(new RollIn());
left2->WhileHeld(new RollOut()); left2->WhileHeld(new RollOut());
// Elevator // Elevator

View File

@ -2,18 +2,12 @@
#include "../RobotMap.h" #include "../RobotMap.h"
Collector::Collector() : Subsystem("Collector") { Collector::Collector() : Subsystem("Collector") {
windowMotorLeft=new CANTalon(COLLECTOR_WINDOW_LEFT_CAN);
windowMotorRight=new CANTalon(COLLECTOR_WINDOW_RIGHT_CAN);
collectorMotorLeft=new CANTalon(COLLECTOR_LEFT_CAN); collectorMotorLeft=new CANTalon(COLLECTOR_LEFT_CAN);
collectorMotorBottom=new CANTalon(COLLECTOR_BOTTOM_CAN); collectorMotorBottom=new CANTalon(COLLECTOR_BOTTOM_CAN);
collectorMotorRight=new CANTalon(COLLECTOR_RIGHT_CAN); collectorMotorRight=new CANTalon(COLLECTOR_RIGHT_CAN);
} }
void Collector::InitDefaultCommand() { void Collector::InitDefaultCommand() {
} }
void Collector::MoveArms(double a){
windowMotorLeft->Set(a);
windowMotorRight->Set(-a);
}
void Collector::MoveRollers(double a){ void Collector::MoveRollers(double a){
collectorMotorLeft->Set(a); collectorMotorLeft->Set(a);
collectorMotorBottom->Set(a); collectorMotorBottom->Set(a);

View File

@ -5,11 +5,10 @@
class Collector: public Subsystem class Collector: public Subsystem
{ {
private: private:
CANTalon *windowMotorLeft, *windowMotorRight, *collectorMotorLeft, *collectorMotorBottom, *collectorMotorRight; CANTalon *collectorMotorLeft, *collectorMotorBottom, *collectorMotorRight;
public: public:
Collector(); Collector();
void InitDefaultCommand(); void InitDefaultCommand();
void MoveArms(double);
void MoveRollers(double); void MoveRollers(double);
bool ArmSensor(); bool ArmSensor();
bool BoxCollected(); bool BoxCollected();

View File