예제 #1
0
/**
 * Check if the DS is attached
 * @return True if the DS is connected to the robot
 */
bool DriverStation::IsDSAttached()
{
	HALControlWord controlWord;
    memset(&controlWord, 0, sizeof(controlWord));
	HALGetControlWord(&controlWord);
	return controlWord.dsAttached;
}
예제 #2
0
/**
 * Check if the DS is commanding teleop mode
 * @return True if the robot is being commanded to be in teleop mode
 */
bool DriverStation::IsOperatorControl()
{
	HALControlWord controlWord;
    memset(&controlWord, 0, sizeof(controlWord));
	HALGetControlWord(&controlWord);
	return !(controlWord.autonomous || controlWord.test);
}
예제 #3
0
/**
 * Check if the DS is commanding autonomous mode
 * @return True if the robot is being commanded to be in autonomous mode
 */
bool DriverStation::IsAutonomous()
{
	HALControlWord controlWord;
    memset(&controlWord, 0, sizeof(controlWord));
	HALGetControlWord(&controlWord);
	return controlWord.autonomous;
}
예제 #4
0
/**
 * Check if the robot is disabled
 * @return True if the robot is explicitly disabled or the DS is not connected
 */
bool DriverStation::IsDisabled()
{
	HALControlWord controlWord;
    memset(&controlWord, 0, sizeof(controlWord));
	HALGetControlWord(&controlWord);
	return !(controlWord.enabled && controlWord.dsAttached);
}
예제 #5
0
/**
 * Report an error to the DriverStation messages window.
 * The error is also printed to the program console.
 */
void DriverStation::ReportError(std::string error) {
  std::cout << error << std::endl;

  HALControlWord controlWord;
  HALGetControlWord(&controlWord);
  if (controlWord.dsAttached) {
    HALSetErrorData(error.c_str(), error.size(), 0);
  }
}
예제 #6
0
/**
 * Is the driver station attached to a Field Management System?
 * @return True if the robot is competing on a field being controlled by a Field Management System
 */
bool DriverStation::IsFMSAttached()
{
	HALControlWord controlWord;
	HALGetControlWord(&controlWord);
	return controlWord.fmsAttached;
}
예제 #7
0
/**
 * Check if the DS is commanding test mode
 * @return True if the robot is being commanded to be in test mode
 */
bool DriverStation::IsTest()
{
	HALControlWord controlWord;
	HALGetControlWord(&controlWord);
	return controlWord.test;
}