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

Added BinClose and BinOpen commands

This commit is contained in:
Adam Long 2015-02-20 20:54:41 +00:00
parent 0a15d92598
commit d515a11cd6
11 changed files with 96 additions and 9 deletions

View File

@ -3,10 +3,12 @@
#include "Subsystems/Collector.h" #include "Subsystems/Collector.h"
#include "Subsystems/Elevator.h" #include "Subsystems/Elevator.h"
#include "Subsystems/BinElevator.h" #include "Subsystems/BinElevator.h"
#include "Subsystems/Pneumatics.h"
Drivetrain* CommandBase::drivetrain = NULL; Drivetrain* CommandBase::drivetrain = NULL;
Collector* CommandBase::collector = NULL; Collector* CommandBase::collector = NULL;
Elevator* CommandBase::elevator = NULL; Elevator* CommandBase::elevator = NULL;
BinElevator* CommandBase::binElevator = NULL; BinElevator* CommandBase::binElevator = NULL;
Pneumatics* CommandBase::pneumatics=NULL;
OI* CommandBase::oi = NULL; OI* CommandBase::oi = NULL;
CommandBase::CommandBase(char const *name) : Command(name) { CommandBase::CommandBase(char const *name) : Command(name) {
} }
@ -17,6 +19,7 @@ void CommandBase::init(){
collector = new Collector(); collector = new Collector();
elevator = new Elevator(); elevator = new Elevator();
binElevator = new BinElevator(); binElevator = new BinElevator();
pneumatics = new Pneumatics();
oi = new OI(); oi = new OI();
} }
// vim: ts=2:sw=2:et // vim: ts=2:sw=2:et

View File

@ -6,6 +6,7 @@
#include "Subsystems/Collector.h" #include "Subsystems/Collector.h"
#include "Subsystems/Elevator.h" #include "Subsystems/Elevator.h"
#include "Subsystems/BinElevator.h" #include "Subsystems/BinElevator.h"
#include "Subsystems/Pneumatics.h"
#include "OI.h" #include "OI.h"
#include "WPILib.h" #include "WPILib.h"
@ -18,6 +19,7 @@ class CommandBase: public Command {
static Collector *collector; static Collector *collector;
static Elevator *elevator; static Elevator *elevator;
static BinElevator *binElevator; static BinElevator *binElevator;
static Pneumatics *pneumatics;
static OI *oi; static OI *oi;
}; };
#endif #endif

View File

@ -0,0 +1,21 @@
#include "BinCloseArms.h"
#include "../../DentRobot.h"
#include "../../OI.h"
BinCloseArms::BinCloseArms() : Command("BinCloseArms"){
}
void BinCloseArms::Initialize(){
//Should never need to use this
SetTimeout(0.5);
}
void BinCloseArms::Execute(){
DentRobot::pneumatics->SetOpen(true);
}
bool BinCloseArms::IsFinished(){
return true;
}
void BinCloseArms::End(){
}
void BinCloseArms::Interrupted(){
End();
}
// vim: ts=2:sw=2:et

View File

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

View File

@ -0,0 +1,21 @@
#include "BinOpenArms.h"
#include "../../DentRobot.h"
#include "../../OI.h"
BinOpenArms::BinOpenArms() : Command("BinOpenArms"){
}
void BinOpenArms::Initialize(){
//Should never need to use this
SetTimeout(0.5);
}
void BinOpenArms::Execute(){
DentRobot::pneumatics->SetOpen(true);
}
bool BinOpenArms::IsFinished(){
return true;
}
void BinOpenArms::End(){
}
void BinOpenArms::Interrupted(){
End();
}
// vim: ts=2:sw=2:et

View File

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

View File

@ -8,12 +8,14 @@ Drivetrain* DentRobot::drivetrain=NULL;
Elevator* DentRobot::elevator=NULL; Elevator* DentRobot::elevator=NULL;
BinElevator* DentRobot::binElevator=NULL; BinElevator* DentRobot::binElevator=NULL;
CommandGroup* DentRobot::aut=NULL; CommandGroup* DentRobot::aut=NULL;
Pneumatics* DentRobot::pneumatics=NULL;
DentRobot::DentRobot(){ DentRobot::DentRobot(){
oi=new OI(); oi=new OI();
collector=new Collector(); collector=new Collector();
drivetrain=new Drivetrain(); drivetrain=new Drivetrain();
elevator=new Elevator(); elevator=new Elevator();
binElevator=new BinElevator(); binElevator=new BinElevator();
pneumatics=new Pneumatics();
aut=new Autonomous(0); aut=new Autonomous(0);
CameraServer::GetInstance()->SetQuality(25); CameraServer::GetInstance()->SetQuality(25);
CameraServer::GetInstance()->StartAutomaticCapture("cam0"); CameraServer::GetInstance()->StartAutomaticCapture("cam0");

View File

@ -6,6 +6,7 @@
#include "Subsystems/BinElevator.h" #include "Subsystems/BinElevator.h"
#include "Subsystems/Drivetrain.h" #include "Subsystems/Drivetrain.h"
#include "Subsystems/Collector.h" #include "Subsystems/Collector.h"
#include "Subsystems/Pneumatics.h"
#include "Commands/Autonomous/Autonomous.h" #include "Commands/Autonomous/Autonomous.h"
class DentRobot: public IterativeRobot { class DentRobot: public IterativeRobot {
private: private:
@ -17,6 +18,7 @@ class DentRobot: public IterativeRobot {
static Drivetrain* drivetrain; static Drivetrain* drivetrain;
static Elevator* elevator; static Elevator* elevator;
static BinElevator* binElevator; static BinElevator* binElevator;
static Pneumatics* pneumatics;
static CommandGroup* aut; static CommandGroup* aut;
void RobotInit(); void RobotInit();
void DisabledPeriodic(); void DisabledPeriodic();

View File

@ -21,7 +21,7 @@
#define BINELEVATOR_ENCODERA 10 #define BINELEVATOR_ENCODERA 10
#define BINELEVATOR_ENCODERB 11 #define BINELEVATOR_ENCODERB 11
#define BINELEVATOR_SOLDENOID_ONE 1 #define BINELEVATOR_SOLDENOID_ONE 1
#define BINELEVATOR_SOLDENOID_TWO 1 #define BINELEVATOR_SOLDENOID_TWO 2
// Drivetrain // Drivetrain
#define DRIVE_FRONT_LEFT_CAN 2 #define DRIVE_FRONT_LEFT_CAN 2

View File

@ -1,13 +1,13 @@
#include "Pnuematics.h" #include "Pneumatics.h"
#include "../RobotMap.h" #include "../RobotMap.h"
Pnuematics::Pnuematics() : Subsystem("Pnuematics"){ Pneumatics::Pneumatics() : Subsystem("Pneumatics"){
solenoid1 = new Solenoid(BINELEVATOR_SOLDENOID_ONE); solenoid1 = new Solenoid(BINELEVATOR_SOLDENOID_ONE);
solenoid2 = new Solenoid(BINELEVATOR_SOLDENOID_TWO); solenoid2 = new Solenoid(BINELEVATOR_SOLDENOID_TWO);
} }
void Pnuematics::InitDefaultCommand(){ void Pneumatics::InitDefaultCommand(){
} }
void Pnuematics::SetOpen(bool k){ void Pneumatics::SetOpen(bool k){
if(k){ if(k){
solenoid1->Set(true); solenoid1->Set(true);
solenoid2->Set(false); solenoid2->Set(false);

View File

@ -1,13 +1,13 @@
#ifndef PNUEMATICS_H #ifndef PNEUMATICS_H
#define PNUEMATICS_H #define PNEUMATICS_H
#include "WPILib.h" #include "WPILib.h"
class Pnuematics: public Subsystem class Pneumatics: public Subsystem
{ {
private: private:
Solenoid *solenoid1, *solenoid2; Solenoid *solenoid1, *solenoid2;
public: public:
Pnuematics(); Pneumatics();
void InitDefaultCommand(); void InitDefaultCommand();
void SetOpen(bool); void SetOpen(bool);
}; };