当前位置: 首页>>代码示例>>Java>>正文


Java DriverStation.reportError方法代码示例

本文整理汇总了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);
}
 
开发者ID:FIRST-Team-339,项目名称:2017,代码行数:33,代码来源:ErrorMessage.java

示例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);
	}

}
 
开发者ID:FRC2832,项目名称:Robot_2017,代码行数:21,代码来源:NavX.java

示例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);
     }
 }
 
开发者ID:cyborgs3335,项目名称:STEAMworks,代码行数:20,代码来源:NavX.java

示例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);
     }
 }
 
开发者ID:frc2879,项目名称:2017-newcomen,代码行数:19,代码来源:IMU.java

示例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);
}
 
开发者ID:team8,项目名称:FRC-2017-Public,代码行数:29,代码来源:ADXRS453_Gyro.java

示例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;
}
 
开发者ID:first95,项目名称:FRC2017,代码行数:20,代码来源:ButtonTracker.java

示例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;
	}
}
 
开发者ID:MTHSRoboticsClub,项目名称:FRC-2017,代码行数:18,代码来源:NavXSensor.java

示例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;

}
 
开发者ID:RobotCasserole1736,项目名称:CasseroleLib,代码行数:25,代码来源:CsvLogger.java

示例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;
}
 
开发者ID:RobotCasserole1736,项目名称:CasseroleLib,代码行数:32,代码来源:CsvLogger.java

示例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();


}
 
开发者ID:RobotCasserole1736,项目名称:CasseroleLib,代码行数:29,代码来源:ADXRS453_Gyro.java

示例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);
}
 
开发者ID:FIRST-Team-339,项目名称:2016,代码行数:30,代码来源:ErrorMessage.java

示例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;
}
 
开发者ID:first95,项目名称:FRC2016,代码行数:17,代码来源:ButtonTracker.java

示例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;
}
 
开发者ID:bussell,项目名称:SparkFun6Dof,代码行数:23,代码来源:GyroITG3200.java

示例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);
     }
 }
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:22,代码来源:Robot.java

示例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);
     }
 }
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:23,代码来源:Robot.java


注:本文中的edu.wpi.first.wpilibj.DriverStation.reportError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。