Skip to content
ethanhuey edited this page May 7, 2014 · 4 revisions

Shifters

Shifters is a class used to shift the gears of the robot to either high gear or low gear. The robot moves faster in high gear than it would in low gear. There are two double solenoids acting as shifters for the two sets of wheels on Ratchet.

Constructor

Shifter::Shifter(main_robot* r, uint8_t mod,uint32_t chanF,uint32_t chanR)

uint8_t mod, uint32_t chanF and uint32_t chanR are values used to instantiate the DoubleSolenoid class. main_robot* r is a pointer to robot so that we are able to call other methods from other classes.

shiftGear

void Shifter::shiftGear()

This method is a simple method to shift high when it's low and low when it's high. This simplifies the shifting process however it is unused because when buttons are held, enum values might be set before the shift actually completes and things will break.

setHigh

void Shifter::setHigh()

This method sets gear to high.

setLow

void Shifter::setLow()

This method sets gear to low.

buttonHelper

void Shifter::buttonHelper(void* objPtr, uint32_t button)

buttonHelper is called by every class that needs to be controlled somehow. SHIFT_LOW and SHIFT_HIGH are buttons that can be set in controls.h.

Clone this wiki locally