本文整理汇总了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);
}
}