I guess you could call our code dead reckoning... but not quite. What ours does is during practice or whenever we have the chance we have the operator run the robot in whatever way we want it to. While the operator is doing this, the program records all the movements that were made with the joystick. During autonomous mode, the program sends the recorded joystick movements to the robot and voila! we have a great autonomous run.. and we got lucky last week at ypsi and recorded an excellent pattern to follow. We've been using it ever since.
Now as for how it works, we aren't going to release that until after our last regional (next week) unless we make it into nationals in which case we'll release it after then. Honestly, it really is quite simple to implement, and we can store up to 8 different programs at once. It is simliar to the "copycat" program in the white papers section, but ours is much simpler... mainly because it runs off our hardware timer (see below)
As for selection of user programs.. we put 3 switches on our board that the operator selects, and the state of these switches is recorded every loop.. until autonomous mode is activated at which point it stops recording the value since obviously it is invalid at that point.. and runs the appropriate program.
Code:
if auto_button = 1 OR auton_mode = 1 then
select (auto_select)
case 0 'joy 1
run 2
case 1 'joy 2
run 3
case 2 'joy 3
run 4
case 3 'joy 4
run 5
case 4 'joy 5
run 2
case 5 'joy 6
run 3
case 6 'joy 7
run 4
case 7
'do nothing... just in case :-)
endselect
else
gosub operator_control
endif
For all timing on our bot, we have a hardware pulse generator (a 555 timer) that generates a pulse every 1/5th second and we increment a counter at every transition, thus getting 1/10th second resolution. It really is so much easier to do than counting loops because it is consistant, and doesn't vary according to how much code you write or if you have a really long branch of code or anything. It really makes things so much simpler. I am only aware of a few teams which have a device such as this actually. And everything on our bot is based off this timer.. if it broke we would not be able to function really... which is why we built 3
But look for us to release our code (which is actually commented pretty good) next week if we dont get to go to nationals..
[edit]
Another thing I forgot to mention is because of the presence of that timer... our code isn't very easy to adapt to other robots..
[/edit]