Skip to content
ZackAlfakir edited this page May 7, 2014 · 1 revision

#DriveTrain Created a DriveTrain class that inherits from RobotDrive

DriveTrain(class main_robot* robot,
               uint8_t modFL,uint32_t chanFL,
               uint8_t modRL,uint32_t chanRL,
               uint8_t modFR,uint32_t chanFR,
               uint8_t modRR,uint32_t chanRR);

Constructor requires mod and channel numbers for Front left, Front right, Back left, and back right speed controllers.

void autoDrive(double distance);

Method that requires distance values for driving. Only needs to be called once.

void autoTurn(double degrees);

Method that requires degrees turned. Called one time whenever you want to turn.

void teleTurn(Dir direction, double power);

Method that requires directions from enum Dir in drive train and a double for the speed of the turn. called one time every time you turn.

void updateDrive();

Called periodically to stop the autoDrive when it has traveled its set distance.

void updateTurn();

Called periodically to stop the autoTurn when it has turned its set degrees.

void update();

Calls updateTurn and updateDrive periodically.

... bool isAuto(); ...

Returns true if any of the flags for the automatic turning and driving are true.

void stopAuto();

stopAuto stops driveTrain, stops and resets the values on the encoders (so that we are no longer measuring autonomous movement) and sets all autonomous flags to false.

Clone this wiki locally