Thread: Dead Reckonin
View Single Post
  #2   Spotlight this post!  
Unread 07-02-2004, 23:03
The Lucas's Avatar
The Lucas The Lucas is offline
CaMOElot, it is a silly place
AKA: My First Name is really "The" (or Brian)
FRC #0365 (The Miracle Workerz); FRC#1495 (AGR); FRC#4342 (Demon)
Team Role: Mentor
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Dela-Where?
Posts: 1,564
The Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond repute
Send a message via AIM to The Lucas
Re: Dead Reckonin

First of all you need a counter. The 26.2 ms area of the autonomous loop ( between Getdata() and Putdata()) should work nicely. You can just increment an int every time the new data if statement is true with no need to mess with interrupt driven timers. Next you can use the "rom" prefix to store large arrays of constants in program space instead of ram (ex: rom const unsigned char left_motor_values[] = {254, 195, 127, 42}). Create these arrays for left motor, right motor, and any other functions (10pt ball remover?) with one value for each segment or time period of the autonomous period (a segment could be to drive forward, or to turn, or to hit the ball). Also make a time length array that contains the number of cycles each segment should last. Then create a variable be the segment index for the arrays. Whenever the counter reaches value in the time length array, increment the index and reset the counter to zero to move on to the next segment. The last segment probably should do nothing, because if you just keep driving, you are bound to find a wall to slam into and the refs hate to see a robot spinning wheels and burning a hole in the carpet

To store more than one routine (left and right starting positions for example) on the robot, simply make more arrays with slightly different names (left_motor_values01, left_motor_values02, etc...) and use switches on the robot or OI to select which set of values to use. If you wanted something more advanced then you could make 2by2 matrices instead of arrays and use switches to select the row to use. Well that’s about all I can think of right now. Good Luck!
__________________
Electrical & Programming Mentor ---Team #365 "The Miracle Workerz"
Programming Mentor ---Team #4342 "Demon Robotics"
Founding Mentor --- Team #1495 Avon Grove High School
2007 CMP Chairman's Award - Thanks to all MOE members (and others) past and present who made it a reality.
Robot Inspector
"I don't think I'm ever more ''aware'' than I am right after I burn my thumb with a soldering iron"