I’m working with Kevin Watson’s 3.0 compatible FRC framework. I have code in the begining of my Autonomous() function that should cause the robot to wait, based on a few constants defined in Autonomous.h. It doesn’t seem to work, and just takes off immediately. Could it have something to do with the fact that the field control system spends a moment in teleop before jumping to autonomous in the begining?
I attached a .zip archive with my entire workspace.
The best thing to do for delays is make a counter that does everything. Here is a few lines that I used for our robot in the Tacoma Regional:
int timer = 0;
if(timer < 72)
/* 72, if I remember right, is about 2 seconds, this number can be adjusted however you need it to be */
// This is where the remainder of autonomous functions occured
It cycles 40 times a second right? So you can just make a function that returned i / 40 so you can say if(timer < 2) which would be the actual amount of seconds. I know it’s basic math to just multiply by 40, but it makes the code a little more readable for someone that doesn’t know that.
That’s the next thing I was going to check. I put it in there during our last competition in hopes of getting around to test it there, and I haven’t been able to yet. I’m hoping to do that early Thursday morning in Atlanta.