|
Re: Do you write functions for your code?
I shouldn't be talking since our robot barely worked, but we used a select statement to switch between autonomous modes in user routines fast. This "in theory" will make our autonomous failsafe if the desired mode encounters a problem.
autoMode = DEAD_RECKON;
switch (autoMode)
{
case DONOTHING:
break;
case DEAD_RECKON: /* Dead_Recockning */
// MyTimerInterrupt is calling Handle_DeadReckoning
//rr_auto_mode_dead_reckoning();
// RR_LEFT_DRIVE_MOTOR = leftScaledSpeedCmd;
// RR_RIGHT_DRIVE_MOTOR = rightScaledSpeedCmd;
// RR_LEFT_DRIVE_MOTOR = 157;
// RR_RIGHT_DRIVE_MOTOR = 175;
if(RR_OPTICAL_SENSOR_1 == 1)
autoMode = LINE_TRACKING;
break;
case KNOCK_BALL:
// put something here
break;
case LINE_TRACKING:
rr_auto_mode_line_tracking();
break;
case DONOTHING:
break;
}
-----
We're using a PID control loop also in our autonomous, taking in feedback from 2 encoders mounted on the left and right drive train. We ended up disabling a good portion of it since the encoders kept getting dislodged. Anyone else use a PID loop with success?
__________________
Greg Liebowitz
Team 75 - RoboRaiders
Webmaster/Programmer
www.roboraiders.com
Last edited by gl75 : 08-03-2004 at 21:35.
|