|
Re: Autonomous Code (Help!!!)
Sure, I'll help.
Start by using a simple counter inside the autonomous mode communication loop. Set it to zero as soon as you enter the autonomous_mode function. Whenever you get new data, increment its value. That will happen about every 26 milliseconds, so 38 counts is very close to a second.
Then test the value of the counter after you increment it. If it's between 0 and 5*38, you're in the first five seconds, so you turn the drive motors on full forward. If it's between 5*38 and 7*38, you're in the next two seconds, so you activate the relays and turn the drive motors on in reverse. If it's greater than 7*38, turn off the drive motors.
That will do what you asked. You can get more detailed with timing of the relays if you wish, or you can add more steps with more actions.
For what it's worth, I'd expect most robots going five seconds at full speed this year will run into one of the mid-field goals. Some will likely be fast enough to run into the far goals if they manage to miss the mid-field ones -- assuming they also don't ram the opposing alliance's robots.
|