Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 46 additions & 8 deletions Shooter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ Shooter::Shooter(main_robot* r,uint8_t axisCan,
uint8_t clampMod, uint32_t clampFChan, uint32_t clampRChan,
uint8_t wormCan,
uint8_t punchMod,uint32_t punchFChan,uint32_t punchRChan,
uint8_t bobMod)
uint8_t bobMod,
Pneumatics* pnum7Wheel, DoubleSolenoid* solenoid7Wheel)
:isPickingUp(false),isPitchingUp(false),
isPitchingDown(false),wormIsPulling(false),winching(false),
hasTilted(false),isPickingUpStopping(false),autoPulling(false),
smartFiring(false),accelWorking(true),smartFireTimer(new Timer())
{
robot = r;
pnum_7Wheel = pnum7Wheel;
solenoid_7Wheel = solenoid7Wheel;
axis = new CANJaguar(axisCan);
attractor = new Talon(attractMod, attractChan);
clamper = new DoubleSolenoid(clampMod, clampFChan, clampRChan);
Expand All @@ -31,6 +34,8 @@ Shooter::Shooter(main_robot* r,uint8_t axisCan,
bobTheAccelerometer = new ADXL345_I2C_612(bobMod);
// bobThePot = new AnalogChannel(1,5);
isPickingUp = false;
//7WheelExtend = false;
//7WheelOldState = false;
shooterJoy = robot -> gunnerJoy;
shooterJoy -> addJoyFunctions(&buttonHelper,(void*)this,CLAMP);
shooterJoy -> addJoyFunctions(&buttonHelper,(void*)this,ENERGIZE);
Expand All @@ -45,6 +50,7 @@ Shooter::Shooter(main_robot* r,uint8_t axisCan,
Shooter::~Shooter()
{
delete axis;
delete pnum_7Wheel;
delete attractor;
delete clamper;
delete bobTheAccelerometer;
Expand Down Expand Up @@ -153,17 +159,47 @@ void Shooter::clampUp()
clamp = up;
}

void Shooter::wormPull()
void Shooter::auto7Wheel()
{
if(wormDone())
{
return;
/*if(!(ShooterJoy -> GetSmoothButton(CLAMP))
{
7WheelOldState = false;
}
else
{
if(!7WheelOldState)
{
7WheelOldState = true;
7WheelExtend = !7WheelExtend;
}
}
if(7WheelExtend)
{
pnum_7Wheel->setVectorValues(TIME, solenoid_7Wheel, DoubleSolenoid::kForward);
}
else
{
pnum_7Wheel->setVectorValues(TIME, solenoid_7Wheel, DoubleSolenoid::kReverse);
}*/
if(sevenWheel == up)
{
sevenWheelDown();
}
if(!wormIsPulling)
else
{
robot -> pnum -> setVectorValues(PUNCH_TIME, puncher, DoubleSolenoid::kForward);
sevenWheelUp();
}
wormIsPulling = true;
}
void Shooter::sevenWheelDown()
{
robot -> pnum->setVectorValues(TIME, solenoid_7Wheel, DoubleSolenoid::kForward);
sevenWheel = down;
}

void Shooter::sevenWheelUp()
{
robot -> pnum->setVectorValues(TIME, solenoid_7Wheel, DoubleSolenoid::kReverse);
sevenWheel = up;
}

void Shooter::wormStop()
Expand Down Expand Up @@ -218,6 +254,8 @@ void Shooter::buttonHelper(void* objPtr, uint32_t button)
if(button==CLAMP)
{
shooterObj->autoClamp();
shooterObj->auto7Wheel();//Not actually sure what button this should go on. Feel free to move this method
// if you arent happy. I dont think the clamp actually does anthing, however, so it should be fine.
}
if(button==ENERGIZE)
{
Expand Down
13 changes: 12 additions & 1 deletion Shooter.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,19 @@ class Shooter
uint8_t clampMod, uint32_t clampFChan, uint32_t clampRChan,
uint8_t wormCan,
uint8_t punchMod,uint32_t punchFChan,uint32_t punchRChan,
uint8_t bobMod);
uint8_t bobMod,
Pneumatics* pnum_7Wheel, DoubleSolenoid* solenoid_7Wheel);
~Shooter();
enum Clamp {down, up};
Clamp clamp;
Clamp sevenWheel;
//enum SevenWheel {down, up};
//SevenWheel sevenWheel;
Pneumatics* pnum_7Wheel;
DoubleSolenoid* solenoid_7Wheel;
void auto7Wheel();
void sevenWheelUp();
void sevenWheelDown();
void pitchUp();
void pitchDown();
void pitchStop();
Expand Down Expand Up @@ -63,6 +72,8 @@ class Shooter
bool isPitchingUp;
bool isPitchingDown;
bool wormIsPulling;
//bool 7WheelExtend;
//bool 7WheelOldState;
bool winching;
bool hasTilted;
bool isPickingUpStopping;
Expand Down
5 changes: 4 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ void main_robot::RobotInit()
driverJoy = new SmoothJoystick(this, DRIVER_JOY_PORT);
gunnerJoy = new SmoothJoystick(this, GUNNER_JOY_PORT);
pnum = new Pneumatics(this, PNUM_DIGIN_MODULE, PNUM_DIGIN_CHANNEL, PNUM_RELAY_MODULE, PNUM_RELAY_CHANNEL);
pnum_7Wheel = new Pneumatics(this, PNUM_7WHEEL_MODULE, PNUM_7WHEEL_CHANNEL, PNUM_7WHEEL_MODULE, PNUM_7WHEEL_CHANNEL);
solenoid_7Wheel = new DoubleSolenoid(SHOOT_7WHEEL_MODULE, SHOOT_7WHEEL_FCHAN, SHOOT_7WHEEL_RCHAN);
shift = new Shifter(this, SHIFT_MOD, SHIFT_FCHAN, SHIFT_RCHAN);
shift->setHigh();
drive = new DriveTrain(this, TALON_FL_MODULE, TALON_FL_CHANNEL,
Expand All @@ -36,7 +38,8 @@ void main_robot::RobotInit()
SHOOT_SLNOID_MODULE, SHOOT_SLNOID_FCHAN, SHOOT_SLNOID_RCHAN,
WORM_JAG_CAN,
PUNCH_SLNOID_MODULE, PUNCH_SLNOID_FCHAN, PUNCH_SLNOID_RCHAN,
SHOOT_ACCEL_MODULE);
SHOOT_ACCEL_MODULE,
pnum_7Wheel, solenoid_7Wheel);
sensors = new Sensors(this, USMODNUMBER, USCHANNEL, ISMODNUMBER, ISCHANNEL, ILMODNUMBER, ILCHANNEL, GYMOD, GYCHAN);
sensors->setGyroSens(1.0f); //default sensitivity
printf("Welcome to 612-2014 AERIAL ASSIST\n");
Expand Down
4 changes: 4 additions & 0 deletions main.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ class main_robot: public IterativeRobot
void TestPeriodic();
SmoothJoystick* driverJoy;
SmoothJoystick* gunnerJoy;

Pneumatics* pnum;
Pneumatics* pnum_7Wheel;
DoubleSolenoid* solenoid_7Wheel;

Shifter* shift;
DriveTrain* drive;
Shooter* shoot;
Expand Down
7 changes: 6 additions & 1 deletion ports.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ const static uint8_t TALON_RR_MODULE = 1;
// Pneumatics Channels
const static uint32_t PNUM_DIGIN_CHANNEL = 8;
const static uint32_t PNUM_RELAY_CHANNEL = 8;
const static uint32_t PNUM_7WHEEL_CHANNEL= 10;
// Pneumatics Modules
const static uint8_t PNUM_DIGIN_MODULE = 1;
const static uint8_t PNUM_RELAY_MODULE = 1;

const static uint8_t PNUM_7WHEEL_MODULE = 1;
// Shifter
const static uint32_t SHIFT_FCHAN = 7;
const static uint32_t SHIFT_RCHAN = 8;
Expand All @@ -34,6 +35,10 @@ const static uint8_t SHOOT_SLNOID_MODULE = 1; // clamp
const static uint32_t SHOOT_SLNOID_FCHAN = 5;
const static uint32_t SHOOT_SLNOID_RCHAN = 6;

const static uint8_t SHOOT_7WHEEL_MODULE = 1; // 7th wheel
const static uint32_t SHOOT_7WHEEL_FCHAN = 8;
const static uint32_t SHOOT_7WHEEL_RCHAN = 9;

const static uint32_t WORM_JAG_CAN = 2; // worm drive

const static uint8_t PUNCH_SLNOID_MODULE = 1; // dog clutch piston
Expand Down