I guess I’ll toss my 2cents into the hat… No bad game data so far. /knock on wood
My teams (Java & CPP) are polling the game data in robotPeriodic() so that if the data is late or changes after the start of the match, the robot will use the latest. I also force upper case, just for safety. I also write the value out to the dashboard, so if something goes wrong, the drive team can look at the value. (Although, I’m not sure they are aware of it’s presence…)
We don’t start along a path until a valid string is received, so we are vulnerable to not receiving a string (We probably should time-out and run a line program).
JAVA:
gameData = DriverStation.getInstance().getGameSpecificMessage().toUpperCase();
SmartDashboard.putString("Game Data", gameData);
CPP:
autoGameData = frc::DriverStation::GetInstance().GetGameSpecificMessage();
std::transform(autoGameData.begin(), autoGameData.end(), autoGameData.begin(), ::toupper);
SmartDashboard::PutString("Game Data", autoGameData);
AutoPeriodic():
if (autoStartPosition == sAutoCenter) {
if (autoTarget == sAutoSwitch) {
if (autoGameData[0] == 'L')
autoCenterFast(false);
if (autoGameData[0] == 'R')
autoCenterFast(true);
}
}