As to why your first code block isn't working, I can't say exactly. Looking at the code, IsAutonomous gets data from the driver station and returns the value of the autonomous member. Maybe there's an issue with getting data in the continuous loop?
Additionally, with an IterativeRobot,you don't need to explicitly call IsAutonomous since your AutonomousPeriodic and AutonomousTeleop will only be called when the mode is autonomous (check out IterativeRobot::StartCompetition)
Code:
else if (IsAutonomous())
{
// call AutonomousInit() if we are now just entering autonomous mode from
// either a different mode or from power-on
if(!m_autonomousInitialized)
{
// KBS NOTE: old code reset all PWMs and relays to "safe values"
// whenever entering autonomous mode, before calling
// "Autonomous_Init()"
AutonomousInit();
m_autonomousInitialized = true;
// reset the initialization flags for the other modes
m_disabledInitialized = false;
m_teleopInitialized = false;
printf("Autonomous_Init() completed\n");
}
if (NextPeriodReady())
{
AutonomousPeriodic();
}
AutonomousContinuous();
}
Also, just so you're aware in case you or someone else needs it, IsAutonomous returns a boolean telling if the state is autonomous or not. Simply calling it like you did in your first code block won't actually do anything since the return value is ignored. If you want to use it to make a decision you would need to put it in an IF statement (for example) as is done in the code block that I posted.