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:
parent
0a15d92598
commit
d515a11cd6
@ -3,10 +3,12 @@
|
||||
#include "Subsystems/Collector.h"
|
||||
#include "Subsystems/Elevator.h"
|
||||
#include "Subsystems/BinElevator.h"
|
||||
#include "Subsystems/Pneumatics.h"
|
||||
Drivetrain* CommandBase::drivetrain = NULL;
|
||||
Collector* CommandBase::collector = NULL;
|
||||
Elevator* CommandBase::elevator = NULL;
|
||||
BinElevator* CommandBase::binElevator = NULL;
|
||||
Pneumatics* CommandBase::pneumatics=NULL;
|
||||
OI* CommandBase::oi = NULL;
|
||||
CommandBase::CommandBase(char const *name) : Command(name) {
|
||||
}
|
||||
@ -17,6 +19,7 @@ void CommandBase::init(){
|
||||
collector = new Collector();
|
||||
elevator = new Elevator();
|
||||
binElevator = new BinElevator();
|
||||
pneumatics = new Pneumatics();
|
||||
oi = new OI();
|
||||
}
|
||||
// vim: ts=2:sw=2:et
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "Subsystems/Collector.h"
|
||||
#include "Subsystems/Elevator.h"
|
||||
#include "Subsystems/BinElevator.h"
|
||||
#include "Subsystems/Pneumatics.h"
|
||||
#include "OI.h"
|
||||
#include "WPILib.h"
|
||||
|
||||
@ -18,6 +19,7 @@ class CommandBase: public Command {
|
||||
static Collector *collector;
|
||||
static Elevator *elevator;
|
||||
static BinElevator *binElevator;
|
||||
static Pneumatics *pneumatics;
|
||||
static OI *oi;
|
||||
};
|
||||
#endif
|
||||
|
21
Commands/BinElevator/BinCloseArms.cpp
Normal file
21
Commands/BinElevator/BinCloseArms.cpp
Normal 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
|
18
Commands/BinElevator/BinCloseArms.h
Normal file
18
Commands/BinElevator/BinCloseArms.h
Normal 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
|
21
Commands/BinElevator/BinOpenArms.cpp
Normal file
21
Commands/BinElevator/BinOpenArms.cpp
Normal 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
|
18
Commands/BinElevator/BinOpenArms.h
Normal file
18
Commands/BinElevator/BinOpenArms.h
Normal 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
|
@ -8,12 +8,14 @@ Drivetrain* DentRobot::drivetrain=NULL;
|
||||
Elevator* DentRobot::elevator=NULL;
|
||||
BinElevator* DentRobot::binElevator=NULL;
|
||||
CommandGroup* DentRobot::aut=NULL;
|
||||
Pneumatics* DentRobot::pneumatics=NULL;
|
||||
DentRobot::DentRobot(){
|
||||
oi=new OI();
|
||||
collector=new Collector();
|
||||
drivetrain=new Drivetrain();
|
||||
elevator=new Elevator();
|
||||
binElevator=new BinElevator();
|
||||
pneumatics=new Pneumatics();
|
||||
aut=new Autonomous(0);
|
||||
CameraServer::GetInstance()->SetQuality(25);
|
||||
CameraServer::GetInstance()->StartAutomaticCapture("cam0");
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "Subsystems/BinElevator.h"
|
||||
#include "Subsystems/Drivetrain.h"
|
||||
#include "Subsystems/Collector.h"
|
||||
#include "Subsystems/Pneumatics.h"
|
||||
#include "Commands/Autonomous/Autonomous.h"
|
||||
class DentRobot: public IterativeRobot {
|
||||
private:
|
||||
@ -17,6 +18,7 @@ class DentRobot: public IterativeRobot {
|
||||
static Drivetrain* drivetrain;
|
||||
static Elevator* elevator;
|
||||
static BinElevator* binElevator;
|
||||
static Pneumatics* pneumatics;
|
||||
static CommandGroup* aut;
|
||||
void RobotInit();
|
||||
void DisabledPeriodic();
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define BINELEVATOR_ENCODERA 10
|
||||
#define BINELEVATOR_ENCODERB 11
|
||||
#define BINELEVATOR_SOLDENOID_ONE 1
|
||||
#define BINELEVATOR_SOLDENOID_TWO 1
|
||||
#define BINELEVATOR_SOLDENOID_TWO 2
|
||||
|
||||
// Drivetrain
|
||||
#define DRIVE_FRONT_LEFT_CAN 2
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "Pnuematics.h"
|
||||
#include "Pneumatics.h"
|
||||
#include "../RobotMap.h"
|
||||
|
||||
Pnuematics::Pnuematics() : Subsystem("Pnuematics"){
|
||||
Pneumatics::Pneumatics() : Subsystem("Pneumatics"){
|
||||
solenoid1 = new Solenoid(BINELEVATOR_SOLDENOID_ONE);
|
||||
solenoid2 = new Solenoid(BINELEVATOR_SOLDENOID_TWO);
|
||||
}
|
||||
void Pnuematics::InitDefaultCommand(){
|
||||
void Pneumatics::InitDefaultCommand(){
|
||||
}
|
||||
void Pnuematics::SetOpen(bool k){
|
||||
void Pneumatics::SetOpen(bool k){
|
||||
if(k){
|
||||
solenoid1->Set(true);
|
||||
solenoid2->Set(false);
|
@ -1,13 +1,13 @@
|
||||
#ifndef PNUEMATICS_H
|
||||
#define PNUEMATICS_H
|
||||
#ifndef PNEUMATICS_H
|
||||
#define PNEUMATICS_H
|
||||
|
||||
#include "WPILib.h"
|
||||
class Pnuematics: public Subsystem
|
||||
class Pneumatics: public Subsystem
|
||||
{
|
||||
private:
|
||||
Solenoid *solenoid1, *solenoid2;
|
||||
public:
|
||||
Pnuematics();
|
||||
Pneumatics();
|
||||
void InitDefaultCommand();
|
||||
void SetOpen(bool);
|
||||
};
|
Loading…
Reference in New Issue
Block a user