2
0
mirror of https://github.com/team2059/Zaphod synced 2025-01-07 22:14:14 -05:00

Moved src/lib to a submodule (github.com/int0x191f2/hhlib.git)

This commit is contained in:
Adam Long 2014-12-28 21:20:40 +00:00
parent 7b24f4914e
commit 9d286d1dbd
8 changed files with 4 additions and 172 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "bin/ucpp"] [submodule "bin/ucpp"]
path = bin/ucpp path = bin/ucpp
url = git://github.com/nikitakit/ucpp.git url = git://github.com/nikitakit/ucpp.git
[submodule "src/lib"]
path = src/lib
url = https://github.com/int0x191f2/hhlib.git

1
src/lib Submodule

@ -0,0 +1 @@
Subproject commit 95fc5e36221f07c5506c78c7ea7f13335abd273b

View File

@ -1,19 +0,0 @@
#include <WPILib.h>
#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

View File

@ -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

View File

@ -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));
}
}

View File

@ -1,13 +0,0 @@
#include <WPILib.h>
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);
};

View File

@ -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

View File

@ -1,22 +0,0 @@
#include <WPILib.h>
#include <time.h>
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