View Single Post
  #10   Spotlight this post!  
Unread 20-02-2004, 18:16
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Little help Please (with dead reconing code)

I dont have any C code for dead rec, but I can psudeo code for you and you can map it into C

if autonmode = false then /* initialize the auton variables*/
begin
sequence = 0
autontime = 0
end

else /* do the auton stuff */
begin

autontime = autontime+1 /* increment the loop counter */

if sequence = 0 then
begin
motor pwms = 254 /*full speed, or whatever you want for the 1st step*/
if autontime = 40 then /* this step happens for 40 loops */
begin
sequence = sequence + 1 /* next sequence next time */
autontime = 0 /*zero the loop count */
end
endif
else

if sequence = 1 then /*the next step*/
begin
right motor pwm = 0 /* turn hard right */
left motor pwm = 254
if autontime = 10 then /* this step happens for 10 loops */
begin
sequence = sequence + 1 /* next sequence next time */
autontime = 0 /*zero the loop count */
end
endif

else
if sequence = 2 then /* ect ect ect */

......

get the idea? have a variable that tells you which step of your sequence you are in, and have a variable that tells you how many times you have gone through the loop, and end that step when you have repeated it for a certain number of loops

this is dead rec - you have no outside info telling you how fast you are actually moving, how far you have turned - you have to use trial and error to test this with your bot and tweak the motor pwm settings for each sequence step, and tweak the autontime equality 'if' for each step, to get the bot to more or less go where you want it to go.

also, within each step you can turn other motors, or relays on and off, depending on what you want your machine to do at each step.

make any sense?