diff --git a/src/CommandBase.cpp b/src/CommandBase.cpp index 42344fb..5470252 100644 --- a/src/CommandBase.cpp +++ b/src/CommandBase.cpp @@ -2,6 +2,7 @@ #include "Subsystems/Drivetrain.h" #include "Subsystems/Collector.h" #include "Subsystems/Elevator.h" +#include "Subsystems/AirCompressor.h" #include "Commands/Drive.h" #include "Commands/Collect.h" #include "Commands/Eject.h" @@ -10,6 +11,7 @@ Drivetrain* CommandBase::drivetrain = NULL; Collector* CommandBase::collector = NULL; Elevator* CommandBase::elevator = NULL; +AirCompressor* CommandBase::airCompressor = NULL; OI* CommandBase::oi = NULL; CommandBase::CommandBase(char const *name) : Command(name) { } @@ -20,5 +22,6 @@ void CommandBase::init() drivetrain = new Drivetrain(); collector = new Collector(); elevator = new Elevator(); + airCompressor = new AirCompressor(); oi = new OI(); } diff --git a/src/CommandBase.h b/src/CommandBase.h index a0e5d05..e6891d1 100644 --- a/src/CommandBase.h +++ b/src/CommandBase.h @@ -5,6 +5,7 @@ #include "Subsystems/Drivetrain.h" #include "Subsystems/Collector.h" #include "Subsystems/Elevator.h" +#include "Subsystems/AirCompressor.h" #include "OI.h" #include "WPILib.h" @@ -16,6 +17,7 @@ class CommandBase: public Command { static Drivetrain *drivetrain; static Collector *collector; static Elevator *elevator; + static AirCompressor *airCompressor; static OI *oi; }; #endif diff --git a/src/Commands/Compress.cpp b/src/Commands/Compress.cpp new file mode 100644 index 0000000..92f0e8e --- /dev/null +++ b/src/Commands/Compress.cpp @@ -0,0 +1,18 @@ +#include "Compress.h" +#include +#include "../DentRobot.h" +Compress::Compress() : Command("Compress"){ + Requires(DentRobot::airCompressor); +} +void Compress::Initialize(){ +} +void Compress::Execute(){ + DentRobot::airCompressor->CreateCompressedAir(); +} +bool Compress::IsFinished(){ + return false; +} +void Compress::End(){ +} +void Compress::Interrupted(){ +} diff --git a/src/Commands/Compress.h b/src/Commands/Compress.h new file mode 100644 index 0000000..89a440c --- /dev/null +++ b/src/Commands/Compress.h @@ -0,0 +1,18 @@ +#ifndef COMPRESSOR_H +#define COMPRESSOR_H + +#include "../CommandBase.h" +#include "../DentRobot.h" +#include "Commands/Command.h" +#include "WPILib.h" + +class Compress: public Command{ + public: + Compress(); + void Initialize(); + void Execute(); + bool IsFinished(); + void End(); + void Interrupted(); +}; +#endif diff --git a/src/DentRobot.cpp b/src/DentRobot.cpp index ad9a71b..3861d86 100644 --- a/src/DentRobot.cpp +++ b/src/DentRobot.cpp @@ -3,11 +3,13 @@ OI* DentRobot::oi=NULL; Collector* DentRobot::collector=NULL; Drivetrain* DentRobot::drivetrain=NULL; Elevator* DentRobot::elevator=NULL; +AirCompressor * DentRobot::airCompressor=NULL; DentRobot::DentRobot(){ oi=new OI(); collector=new Collector(); drivetrain=new Drivetrain(); elevator=new Elevator(); + airCompressor=new AirCompressor(); printf("Initialized"); } void DentRobot::RobotInit(){ diff --git a/src/DentRobot.h b/src/DentRobot.h index cd88121..e111c83 100644 --- a/src/DentRobot.h +++ b/src/DentRobot.h @@ -5,6 +5,7 @@ #include "Subsystems/Elevator.h" #include "Subsystems/Drivetrain.h" #include "Subsystems/Collector.h" +#include "Subsystems/AirCompressor.h" class DentRobot: public IterativeRobot { private: Command *driveCommand = NULL; @@ -13,6 +14,7 @@ public: static Collector* collector; static Drivetrain* drivetrain; static Elevator* elevator; + static AirCompressor* airCompressor; DentRobot(); void RobotInit(); void DisabledPeriodic(); diff --git a/src/Subsystems/AirCompressor.cpp b/src/Subsystems/AirCompressor.cpp new file mode 100644 index 0000000..f8738f9 --- /dev/null +++ b/src/Subsystems/AirCompressor.cpp @@ -0,0 +1,14 @@ +#include "AirCompressor.h" +#include "../RobotMap.h" + +AirCompressor::AirCompressor() : Subsystem("AirCompressor") { + compressher = new Compressor(31); +} +void AirCompressor::InitDefaultCommand() { +} +void AirCompressor::CreateCompressedAir() { + compressher->Start(); +} +void AirCompressor::StopCreatingCompressedAir() { + compressher->Stop(); +} diff --git a/src/Subsystems/AirCompressor.h b/src/Subsystems/AirCompressor.h new file mode 100644 index 0000000..e997c27 --- /dev/null +++ b/src/Subsystems/AirCompressor.h @@ -0,0 +1,15 @@ +#ifndef AIRCOMPRESSOR_H +#define AIRCOMPRESSOR_H + +#include "WPILib.h" +class AirCompressor: public Subsystem +{ + private: + Compressor *compressher; + public: + AirCompressor(); + void InitDefaultCommand(); + void CreateCompressedAir(); + void StopCreatingCompressedAir(); +}; +#endif diff --git a/src/Subsystems/Drivetrain.cpp b/src/Subsystems/Drivetrain.cpp index e9fc379..17f690c 100644 --- a/src/Subsystems/Drivetrain.cpp +++ b/src/Subsystems/Drivetrain.cpp @@ -15,7 +15,6 @@ void Drivetrain::DriveMecanum(float x, float y, float z, float sensitivity, floa double correctY = (sensitivity*(pow(y,3))+(1-sensitivity)*y); double correctX = -(sensitivity*(pow(x,3))+(1-sensitivity)*x); double correctZ = -z *.5; - double slowfactor = 2.5; rightFront->Set((-correctX + correctY - correctZ)); leftFront->Set((correctX + correctY + correctZ)*-1); rightRear->Set((correctX + correctY - correctZ));