mirror of
https://github.com/team2059/Dent
synced 2025-01-07 22:14:14 -05:00
Added basic compressor support
This commit is contained in:
parent
d61da0b436
commit
8744869328
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
18
src/Commands/Compress.cpp
Normal file
18
src/Commands/Compress.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "Compress.h"
|
||||
#include <cmath>
|
||||
#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(){
|
||||
}
|
18
src/Commands/Compress.h
Normal file
18
src/Commands/Compress.h
Normal file
@ -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
|
@ -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(){
|
||||
|
@ -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();
|
||||
|
14
src/Subsystems/AirCompressor.cpp
Normal file
14
src/Subsystems/AirCompressor.cpp
Normal file
@ -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();
|
||||
}
|
15
src/Subsystems/AirCompressor.h
Normal file
15
src/Subsystems/AirCompressor.h
Normal file
@ -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
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user