Quasics2021Code/Mae/src/main/cpp/commands/TurnControlPanelToTargetColorCommand.cpp
// Called when the command is initially scheduled.
Called when the command is initially scheduled.
Called when the command is initially scheduled .
void TurnControlPanelToTargetColorCommand::Initialize() {
  std::string gameData;
  gameData = frc::DriverStation::GetInstance().GetGameSpecificMessage();
  if (gameData.length() > 0) {
    switch (gameData[0]) {
      case 'B':
        m_aimColor = ControlPanel::BLUE;
        break;
      case 'G':
        m_aimColor = ControlPanel::GREEN;
        break;
      case 'R':
        m_aimColor = ControlPanel::RED;
        break;
      case 'Y':
        m_aimColor = ControlPanel::YELLOW;
        break;
      default:
        m_aimColor = ControlPanel::UNKNOWN;
        break;
    }
    m_controlPanel->TurnWheelMotorOn(true);
  } else {
    m_aimColor = ControlPanel::NO_DATA;
  }
}
void TurnControlPanelToTargetColorCommand :: Initialize ( ) { std :: string gameData ; gameData = frc :: DriverStation :: GetInstance ( ) . GetGameSpecificMessage ( ) ; if ( gameData . length ( ) > 0 ) { switch ( gameData [ 0 ] ) { case ' ' : m_aimColor = ControlPanel :: BLUE ; break ; case ' ' : m_aimColor = ControlPanel :: GREEN ; break ; case ' ' : m_aimColor = ControlPanel :: RED ; break ; case ' ' : m_aimColor = ControlPanel :: YELLOW ; break ; default : m_aimColor = ControlPanel :: UNKNOWN ; break ; } m_controlPanel -> TurnWheelMotorOn ( true ) ; } else { m_aimColor = ControlPanel :: NO_DATA ; } }
Called when the command is initially scheduled.
Called when the command is initially scheduled .
// Blue case code // Green case code // Red case code // Yellow case code // This is corrupt data // Code for no data received yet