diff --git a/.gitmodules b/.gitmodules index e1c6c06..0d1438a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "bin/ucpp"] path = bin/ucpp url = git://github.com/nikitakit/ucpp.git +[submodule "src/lib"] + path = src/lib + url = https://github.com/int0x191f2/hhlib.git diff --git a/src/lib b/src/lib new file mode 160000 index 0000000..95fc5e3 --- /dev/null +++ b/src/lib @@ -0,0 +1 @@ +Subproject commit 95fc5e36221f07c5506c78c7ea7f13335abd273b diff --git a/src/lib/controller/Controller.h b/src/lib/controller/Controller.h deleted file mode 100644 index 55373ac..0000000 --- a/src/lib/controller/Controller.h +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include "../Definitions.h" -// Logitech Extreme 3D Pro joysticks -class Extreme3dPro -{ - private: - Joystick *stickofjoy; - public: - //Array to hold joystick button values - int ButtonValue[11]; - //Call periodically to update joystick values - void handler(); - Extreme3dPro(uint8_t); - float GetThrottle(); - int GetJoystickButton(uint8_t); - float GetRawJoystickAxis(uint8_t); - float GetJoystickAxis(std::string axis); -}; -// vim: ts=2:sw=2:et diff --git a/src/lib/controller/Extreme3dPro.cpp b/src/lib/controller/Extreme3dPro.cpp deleted file mode 100644 index 7b4aac2..0000000 --- a/src/lib/controller/Extreme3dPro.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "Controller.h" -Extreme3dPro::Extreme3dPro(uint8_t port){ - stickofjoy = new Joystick(port); -} -float Extreme3dPro::GetThrottle(){ - return (-GetRawJoystickAxis(4)+1)/2; -} -int Extreme3dPro::GetJoystickButton(uint8_t button){ - return stickofjoy->GetRawButton(button); -} -float Extreme3dPro::GetRawJoystickAxis(uint8_t axis){ - return stickofjoy->GetRawAxis(axis); -} -float Extreme3dPro::GetJoystickAxis(std::string axis){ - if (axis == "x"){ - return stickofjoy->GetX(); - }else if (axis == "y"){ - return stickofjoy->GetY(); - }else if (axis == "z"){ - return stickofjoy->GetZ(); - }else if(axis == "throttle"){ - return stickofjoy->GetRawAxis(4); - }else{ - return 0; - } -} -void Extreme3dPro::handler(){ - for(int i=0;i<=11;i++){ - ButtonValue[i] = stickofjoy->GetRawButton(i); - } -} -// vim: ts=2:sw=2:et diff --git a/src/lib/drive/WCDrive.cpp b/src/lib/drive/WCDrive.cpp deleted file mode 100644 index 5dd820b..0000000 --- a/src/lib/drive/WCDrive.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "WCDrive.h" -//Constructor for drive with 4-6 motors all on first sidecar -WCDrive::WCDrive(uint8_t motorCount, uint8_t motor1, uint8_t motor2, uint8_t motor3, uint8_t motor4, uint8_t motor5=NULL, uint8_t motor6=NULL){ - engine1 = new Talon(motor1); - engine2 = new Talon(motor2); - engine3 = new Talon(motor3); - engine4 = new Talon(motor4); - if(motorCount==6){ - engine5 = new Talon(motor5); - engine6 = new Talon(motor6); - } -} -WCDrive::WCDrive(uint8_t motorCount, uint8_t motor1sidecar, uint8_t motor1, uint8_t motor2sidecar, uint8_t motor2, uint8_t motor3sidecar, uint8_t motor3, uint8_t motor4sidecar, uint8_t motor4, uint8_t motor5sidecar=NULL, uint8_t motor5=NULL, uint8_t motor6sidecar=NULL, uint8_t motor6=NULL){ - engine1 = new Talon(motor1sidecar,motor1); - engine2 = new Talon(motor2sidecar,motor2); - engine3 = new Talon(motor3sidecar,motor3); - engine4 = new Talon(motor4sidecar,motor4); - if(motorCount==6){ - engine5 = new Talon(motor5sidecar,motor5); - engine6 = new Talon(motor6sidecar,motor6); - } -} -void WCDrive::Update(int motorCount, float y, float x){ - if(y>1.0f){ - y=1.0f; - }else if(y!=0.0f&&y<-1.0f){ - y=-1.0f; - } - float leftPower=((y-x)/2+1)*127+1; - float rightPower=((y+x)/2+1)*127+1; - engine1->SetRaw(int(rightPower)); - engine2->SetRaw(int(rightPower)); - engine3->SetRaw(int(rightPower)); - engine4->SetRaw(int(leftPower)); - if(motorCount==6){ - engine5->SetRaw(int(leftPower)); - engine6->SetRaw(int(leftPower)); - } -} diff --git a/src/lib/drive/WCDrive.h b/src/lib/drive/WCDrive.h deleted file mode 100644 index d1ceaed..0000000 --- a/src/lib/drive/WCDrive.h +++ /dev/null @@ -1,13 +0,0 @@ -#include -class WCDrive { - private: - Talon *engine1, *engine2, *engine3, *engine4, *engine5, *engine6; - public: - //Assume 4 motors unless otherwise stated - //motors,pwm1,pwm2,pwm3,pwm4,(pwm5,pwm6) - explicit WCDrive(uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t); - //motors,sidecarpwm1,pwm1,sidecarpwm2,pwm2,sidecarpwn3,pwm3,sidecarpwm4,pwm4,(sidecarpwm5,pwm5,sidecarpwm6,pwm6) - WCDrive(uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t); - //motor count, x, y - void Update(int, float,float); -}; diff --git a/src/lib/pneumatics/Compressor.cpp b/src/lib/pneumatics/Compressor.cpp deleted file mode 100644 index 442c981..0000000 --- a/src/lib/pneumatics/Compressor.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "Compressor.h" -AirCompressor::AirCompressor(uint8_t compressorGauge, uint8_t compressorRelay){ - compressor = new Compressor(compressorGauge,compressorRelay); - timer = new Timer(); - lastTime=0; - compressing=false; -} -AirCompressor::AirCompressor(uint8_t compressorGaugeSidecar, uint8_t compressorGauge, uint8_t compressorRelaySidecar, uint8_t compressorRelay){ - compressor = new Compressor(compressorGaugeSidecar, compressorGauge, compressorRelaySidecar, compressorRelay); - timer = new Timer(); - lastTime=0; - compressing=false; -} -void AirCompressor::CompressorSystemPeriodic(){ - bool compressorEnabled; - if(timer->Get()-lastTime>=0.5f){ - // Update compressor when current time-last time is more than .5 seconds - lastTime=timer->Get(); - compressorEnabled=true; - } - if(compressorEnabled){ - if(compressing&&compressor->GetPressureSwitchValue()==1){ - // It is compressing, but the pressure is too high - StopCompressor(); - }else if(!compressing&&compressor->GetPressureSwitchValue()==0){ - // It is not compressing and the pressure isn't too high - StartCompressor(); - } - }else{ - if(compressing){ - // If the compressor is not enabled, but it's still compressing - StopCompressor(); - } - } - e_CollectorSolenoidState=IDLE; -} -void AirCompressor::StopCompressor(){ - printf("Stopping compressor\n"); - compressor->Stop(); - compressing=false; -} -void AirCompressor::StartCompressor(){ - printf("Starting compressor\n"); - compressor->Start(); - compressing=true; -} -// vim: ts=2:sw=2:et diff --git a/src/lib/pneumatics/Compressor.h b/src/lib/pneumatics/Compressor.h deleted file mode 100644 index 63c71b3..0000000 --- a/src/lib/pneumatics/Compressor.h +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -class AirCompressor{ - private: - Compressor *compressor; - //Timer used for keeping time? - Timer *timer; - double lastTime; - bool compressing; - public: - enum{ - EXTENDED, - RETRACTED, - IDLE - }e_CollectorSolenoidState; - explicit AirCompressor(uint8_t,uint8_t); - AirCompressor(uint8_t,uint8_t,uint8_t,uint8_t); - void CompressorSystemPeriodic(); - void StopCompressor(); - void StartCompressor(); -}; -// vim: ts=2:sw=2:et