本文整理匯總了Java中edu.wpi.first.wpilibj.DriverStation.reportError方法的典型用法代碼示例。如果您正苦於以下問題:Java DriverStation.reportError方法的具體用法?Java DriverStation.reportError怎麽用?Java DriverStation.reportError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.wpi.first.wpilibj.DriverStation
的用法示例。
在下文中一共展示了DriverStation.reportError方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: printError
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
/**
* Prints error to specified devices
*
* @param errorMessage
* the message to be printed.
* @param attatchTimeStamp
* whether or not to include a time stamp.
*/
public void printError (String errorMessage,
boolean attatchTimeStamp)
{
String appendedErrorMessage;
rioTime = getDate();
matchTime = Hardware.driverStation.getMatchTime();
if (appendTimeStamp == true)
appendedErrorMessage = appendErrorMessage(errorMessage);
else
appendedErrorMessage = errorMessage;
// if the error must print to the Drivers' Station
if (defaultPrintDevice == PrintsTo.driverStation ||
defaultPrintDevice == PrintsTo.driverStationAndRoboRIO)
{
final String dsReport = appendErrorMessage(errorMessage);
DriverStation.reportError(dsReport, false);
}
// if the error must print to the errorlog on the rio.
if (defaultPrintDevice == PrintsTo.roboRIO ||
defaultPrintDevice == PrintsTo.driverStationAndRoboRIO)
PrintsToRIO(appendedErrorMessage);
}
示例2: NavX
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
public NavX() {
try {
/***********************************************************************
* navX-MXP:
* - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.
* - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
*
* navX-Micro:
* - Communication via I2C (RoboRIO MXP or Onboard) and USB.
* - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
*
* Multiple navX-model devices on a single robot are supported.
************************************************************************/
ahrs = new AHRS(SerialPort.Port.kUSB);
} catch (RuntimeException ex ) {
DriverStation.reportError("Error instantiating navX MXP: " + ex.getMessage(), true);
}
}
示例3: NavX
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
public NavX() {
try {
/***********************************************************************
* navX-MXP:
* - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.
* - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
*
* navX-Micro:
* - Communication via I2C (RoboRIO MXP or Onboard) and USB.
* - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
*
* Multiple navX-model devices on a single robot are supported.
************************************************************************/
ahrs = new AHRS(SPI.Port.kMXP); // Use SPI!!!
//ahrs = new AHRS(I2C.Port.kMXP);
} catch (RuntimeException ex ) {
DriverStation.reportError("Error instantiating navX MXP: " + ex.getMessage(), true);
}
}
示例4: IMU
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
public IMU() {
try {
/***********************************************************************
* navX-MXP:
* - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.
* - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
*
* navX-Micro:
* - Communication via I2C (RoboRIO MXP or Onboard) and USB.
* - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
*
* Multiple navX-model devices on a single robot are supported.
************************************************************************/
ahrs = new AHRS(SPI.Port.kMXP);
} catch (RuntimeException ex ) {
DriverStation.reportError("Error instantiating navX MXP: " + ex.getMessage(), true);
}
}
示例5: ADXRS453_Gyro
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
/**
* Constructor.
*
* @param port
* (the SPI port that the gyro is connected to)
*/
public ADXRS453_Gyro(SPI.Port port) {
m_spi = new SPI(port);
m_spi.setClockRate(3000000);
m_spi.setMSBFirst();
m_spi.setSampleDataOnRising();
m_spi.setClockActiveHigh();
m_spi.setChipSelectActiveLow();
/** Validate the part ID */
if ((readRegister(kPIDRegister) & 0xff00) != 0x5200) {
m_spi.free();
m_spi = null;
DriverStation.reportError("Could not find ADXRS453 gyro on SPI port " + port.value, false);
return;
}
m_spi.initAccumulator(kSamplePeriod, 0x20000000, 4, 0x0c00000E, 0x04000000, 10, 16, true, true);
calibrate();
LiveWindow.addSensor("ADXRS453_Gyro", port.value, this);
}
示例6: ButtonTracker
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
public ButtonTracker(Joystick Joystick, int Channel)
{
mChannel = Channel;
mJoystick = Joystick;
if (!usedNumbers.containsKey(Joystick))
{
usedNumbers.put(Joystick, new ButtonTracker[17]);
}
if (usedNumbers.get(Joystick)[Channel] != null)
{
// SmartDashboard.putBoolean("ERROR", true);
// System.out.println("MORE THAN ONE BUTTON TRACKER PER BUTTON.");
DriverStation.reportError("MORE THAN ONE BUTTON TRACKER PER BUTTON!", false);
}
usedNumbers.get(Joystick)[Channel] = this;
}
示例7: initialize
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
public static void initialize()
{
if (!initialized) {
System.out.println("NavXSensor::initialize() called...");
try {
ahrs = new AHRS(SPI.Port.kMXP);
} catch (RuntimeException ex ) {
DriverStation.reportError("Error instantiating navX MXP: " + ex.getMessage(), true);
}
reset();
initialized = true;
}
}
示例8: close
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
/**
* Closes the log file and ensures everything is written to disk. init() must be called again in
* order to write to the file.
*
* @return -1 on failure to close, 0 on success
*/
public static int close() {
if (log_open == false) {
return 0;
}
try {
log_file.close();
log_open = false;
}
// Catch ALL the errors!!!
catch (IOException e) {
DriverStation.reportError("Error Closing Log File: " + e.getMessage(), false);
return -1;
}
return 0;
}
示例9: logData
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
/**
* Logs data for all stored method handles. Methods that are not considered "simple" should be
* handled accordingly within this method. This method should be called once per loop.
*
* @param forceSync set true if a forced write is desired (i.e. brownout conditions)
* @return 0 if log successful, -1 if log is not open, and -2 on other errors
*/
public static int logData(boolean forceSync) {
if (!log_open) {
//System.out.println("ERROR - Log is not yet opened, cannot write!");
return -1;
}
if (forceSync)
forceSync();
try {
for (int i = 0; i < methodHandles.size(); i++) {
MethodHandle mh = methodHandles.get(i);
String fieldName = dataFieldNames.get(i);
Vector<Object> mhArgs = mhReferenceObjects.get(i);
log_file.write(getStandardLogData(mh, mhArgs,fieldName) + ", ");
}
log_file.write("\n");
} catch (Exception ex) {
DriverStation.reportError("Error writing to log file: " + ex.getMessage(), false);
return -2;
}
return 0;
}
示例10: ADXRS453_Gyro
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
/**
* Constructor.
*
* @param port
* (the SPI port that the gyro is connected to)
*/
public ADXRS453_Gyro(SPI.Port port) {
m_spi = new SPI(port);
m_spi.setClockRate(3000000);
m_spi.setMSBFirst();
m_spi.setSampleDataOnRising();
m_spi.setClockActiveHigh();
m_spi.setChipSelectActiveLow();
/** Validate the part ID */
if ((readRegister(kPIDRegister) & 0xff00) != 0x5200) {
m_spi.free();
m_spi = null;
DriverStation.reportError("Could not find ADXRS453 gyro on SPI port " + port.name(), false);
return;
}
m_spi.initAccumulator(kSamplePeriod, 0x20000000, 4, 0x0c00000E, 0x04000000, 10, 16, true, true);
calibrate();
}
示例11: printError
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
/**
* Prints error to specified devices.
*
* @param errorMessage
* to be printed
*/
public void printError (String errorMessage)
{
String appendedErrorMessage;
rioTime = getDate();
matchTime = Hardware.driverStation.getMatchTime();
if (appendTimeStamp == true)
appendedErrorMessage = appendErrorMessage(errorMessage);
else
appendedErrorMessage = errorMessage;
// if the error must print to the Drivers' Station
if (defaultPrintDevice == PrintsTo.driverStation ||
defaultPrintDevice == PrintsTo.driverStationAndRoboRIO)
{
final String dsReport = appendErrorMessage(errorMessage);
DriverStation.reportError(dsReport, false);
}
// if the error must print to the errorlog on the rio.
if (defaultPrintDevice == PrintsTo.roboRIO ||
defaultPrintDevice == PrintsTo.driverStationAndRoboRIO)
PrintsToRIO(appendedErrorMessage);
}
示例12: ButtonTracker
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
public ButtonTracker(Joystick Joystick, int Channel) {
mChannel = Channel;
mJoystick = Joystick;
if (!usedNumbers.containsKey(Joystick)) {
usedNumbers.put(Joystick, new ButtonTracker[17]);
}
if (usedNumbers.get(Joystick)[Channel] != null) {
// SmartDashboard.putBoolean("ERROR", true);
System.out.println("MORE THAN ONE BUTTON TRACKER PER BUTTON.");
DriverStation.reportError("MORE THAN ONE BUTTON TRACKER PER BUTTON!", false);
}
usedNumbers.get(Joystick)[Channel] = this;
}
示例13: writeI2CBuffer
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
public boolean writeI2CBuffer(int registerAddress, int data)
{
boolean retVal = false;
try
{
retVal = m_i2c.write( registerAddress, data );
if ( DEBUG )
{
byte[] buf = new byte[1];
ReadI2CBuffer( registerAddress, 1, buf);
if ( data != buf[0] )
{
DriverStation.reportError( "Expected " + data + "\nseeing " + buf[0] + "\n", false );
}
}
}
catch (Throwable t)
{
DriverStation.reportError("ERROR Unhandled exception: " + t.toString() + " at " + Arrays.toString(t.getStackTrace()), false);
}
return retVal;
}
示例14: Robot
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
public Robot() {
myRobot = new RobotDrive(0, 1);
myRobot.setExpiration(0.1);
stick = new Joystick(0);
try {
/***********************************************************************
* navX-MXP:
* - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.
* - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
*
* navX-Micro:
* - Communication via I2C (RoboRIO MXP or Onboard) and USB.
* - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
*
* Multiple navX-model devices on a single robot are supported.
************************************************************************/
ahrs = new AHRS(SPI.Port.kMXP);
} catch (RuntimeException ex ) {
DriverStation.reportError("Error instantiating navX MXP: " + ex.getMessage(), true);
}
}
示例15: Robot
import edu.wpi.first.wpilibj.DriverStation; //導入方法依賴的package包/類
public Robot() {
myRobot = new RobotDrive(frontLeftChannel, rearLeftChannel,
frontRightChannel, rearRightChannel);
myRobot.setExpiration(0.1);
stick = new Joystick(0);
try {
/***********************************************************************
* navX-MXP:
* - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.
* - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
*
* navX-Micro:
* - Communication via I2C (RoboRIO MXP or Onboard) and USB.
* - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
*
* Multiple navX-model devices on a single robot are supported.
************************************************************************/
ahrs = new AHRS(SPI.Port.kMXP);
} catch (RuntimeException ex ) {
DriverStation.reportError("Error instantiating navX MXP: " + ex.getMessage(), true);
}
}