Something like this maybe useful for pausing. This example is directed towards auton, but can be applied in any instance of pausing
Code:
m_autoPeriodicLoops++;
//Make sure in your init you set m_autonomousCase = 1;
switch(m_autonomousCase)
{
case 1:
{
//Reset auto counter
m_autoPeriodicLoops = 0;
m_autonomousCase = 2;
}
case 2:
{
if(m_autoPeriodicLoops < 50)
{
//Wait for 50 loops 50 * ~20ms = ~1 second
robotDrive->TankDrive(0.0 , 0.0);
}
else
{
//Robot will drive after the 50 loops have completed
robotDrive->TankDrive(0.5 , 0.5);
}
}
This will pause the robot for about one second (this can vary depending on how much other code is running, and what you have your Periodic loop set to refresh at). Default is about 20 ms.
By using this method you can have other things in the background running in your loops but you are not "stopping" the cRio completely by using a Wait function.