At our latest regional we learned that we were actually not able to read the game data. However all of our code works as planned outside of the match when we input the game data into driver’s station ourselves. When I simplified our code to read game data and go straight no matter what side of the switch is ours, our robot took a sharp turn to the side and forward(not a small drift but a clear turn). However when I took out the part where it reads the FMS game data and just went straight, our bot was able to cross the auto line. Ideally I would like to make our robot put a cube in our side of the switch so I need to be able to read the game data. The following is our code to go forward after reading game data (which resulted in our robot crashing into the portal on our side of the field) :
public$@#void$@#autonomousInit() {
timer.reset();
timer.start();
}
public$@#void$@#autonomousPeriodic() {
String$@#gameData;
gameData$@#= DriverStation.getInstance().getGameSpecificMessage();
if(gameData.length() > 0) {
if(gameData.charAt(0) ==$@#'L') {
if(timer.get()<2.5) {
drivetrain.arcadeDrive(0.7,0);
}
else {
drivetrain.arcadeDrive(0,0);
}
}
else {
if(timer.get()<2.5) {
drivetrain.arcadeDrive(0.7 , 0);
}
else {
drivetrain.arcadeDrive(0.7, 0);
}
}
}
}
(end code)
Any help would be appreciated! Thanks!