We ran into a little issue with running motors in autonomous at the Palmetto regional. We know about the watchdog for the robot and the motor safetly timers. We disabled the watchdog and set the expiration timeout for the motors, but still sometimes the motors would shut off before the time was up. It seems to happen more on the fields than in the pits, but it did happen in the pit when tethered as well. Our code is similiar to this. I don’t have access to it, the laptop is locked up at the school.
My question is if we set the expiration, can’t the code delay that long before updating the drive setting? That is before the “drive isn’t updated often enough” message?
This didn’t always run the full 2 seconds:
myRobot.SetExpiration(6); // set MotorSafety expiration
myRobot.Drive(0.6, 0.0);
Wait(2.0); // wait 2 seconds while driving
myRobot.Drive(0.0, 0.0);
To get around this we implemented a loop that keept calling myRobot.Drive() for the time required. Something like:
Timer timer;
timer.Reset();
timer.Start();
while (timer.Get() < 2.0)
{
myRobot.Drive(0.6, 0.0);
}
myRobot.Drive(0.0, 0.0);