项目:wpilibj
文件:RobotBase.java
/**
* Starting point for the applications. Starts the OtaServer and then runs
* the robot.
*
* @throws javax.microedition.midlet.MIDletStateChangeException
*/
protected final void startApp() throws MIDletStateChangeException {
boolean errorOnExit = false;
Watchdog.getInstance().setExpiration(0.1);
Watchdog.getInstance().setEnabled(false);
FRCControl.observeUserProgramStarting();
UsageReporting.report(UsageReporting.kResourceType_Language,UsageReporting.kLanguage_Java);
writeVersionString();
try {
this.startCompetition();
} catch (Throwable t) {
t.printstacktrace();
errorOnExit = true;
} finally {
// startCompetition never returns unless exception occurs....
System.err.println("WARNING: Robots don't quit!");
if (errorOnExit) {
System.err.println("---> The startCompetition() method (or methods called by it) should have handled the exception above.");
} else {
System.err.println("---> Unexpected return from startCompetition() method.");
}
}
}
项目:wpilib-java
文件:RobotBase.java
/**
* Starting point for the applications. Starts the OtaServer and then runs
* the robot.
* @throws javax.microedition.midlet.MIDletStateChangeException
*/
protected final void startApp() throws MIDletStateChangeException {
boolean errorOnExit = false;
Watchdog.getInstance().setExpiration(0.1);
Watchdog.getInstance().setEnabled(false);
FRCControl.observeUserProgramStarting();
UsageReporting.report(UsageReporting.kResourceType_Language,UsageReporting.kLanguage_Java);
try {
this.startCompetition();
} catch (Throwable t) {
t.printstacktrace();
errorOnExit = true;
} finally {
// startCompetition never returns unless exception occurs....
System.err.println("WARNING: Robots don't quit!");
if (errorOnExit) {
System.err.println("---> The startCompetition() method (or methods called by it) should have handled the exception above.");
} else {
System.err.println("---> Unexpected return from startCompetition() method.");
}
}
}
项目:wpilibj
文件:Kinect.java
/**
* Called by the other Kinect functions to check for the latest data
* This function will update the internal data structures
* with the most recent Kinect input
*/
void updateData() {
int retVal;
if (m_recentPacketNumber != DriverStation.getInstance().getPacketNumber()){
m_recentPacketNumber = DriverStation.getInstance().getPacketNumber();
synchronized (m_headerDataSemaphore) {
retVal = FRCControl.getDynamicControlData(kHeaderBlockID,tempHeaderData,tempHeaderData.size(),5);
if (retVal == 0) {
tempHeaderData.copy(m_headerData);
m_headerValid = true;
}else {
m_headerValid = false;
}
}
synchronized (m_skeletonExTradataSemaphore) {
retVal = FRCControl.getDynamicControlData(kSkeletonExtraBlockID,tempSkeletonExTradata,tempSkeletonExTradata.size(),5);
if (retVal == 0) {
tempSkeletonExTradata.copy(m_skeletonExTradata);
m_skeletonExtraValid = true;
}else {
m_skeletonExtraValid = false;
}
}
synchronized (m_skeletonDataSemaphore) {
retVal = FRCControl.getDynamicControlData(kSkeletonBlockID,tempSkeletonData,tempSkeletonData.size(),5);
if (retVal == 0) {
tempSkeletonData.copy(m_skeletonData);
m_skeletonValid = true;
}else {
m_skeletonValid = false;
}
}
}
}
项目:wpilibj
文件:DriverStationLCD.java
/**
* DriverStationLCD constructor.
*
* This is only called once the first time GetInstance() is called
*/
private DriverStationLCD() {
m_textBuffer = new byte[FRCControl.USER_DS_LCD_DATA_SIZE];
for (int i = 0; i < FRCControl.USER_DS_LCD_DATA_SIZE; i++) {
m_textBuffer[i] = ' ';
}
m_textBuffer[0] = (byte) (kFulldisplayTextCommand >> 8);
m_textBuffer[1] = (byte) kFulldisplayTextCommand;
UsageReporting.report(UsageReporting.kResourceType_DriverStationLCD,0);
}
项目:wpilibj
文件:KinectStick.java
/**
* Update the data in this class with the latest data from the
* Driver Station.
*/
private void getData() {
if (m_recentPacketNumber != DriverStation.getInstance().getPacketNumber()){
m_recentPacketNumber = DriverStation.getInstance().getPacketNumber();
int retVal = FRCControl.getDynamicControlData(kJoystickDataID,tempOutputData,tempOutputData.size(),5);
if (retVal != 0) {
System.err.println("Bad retval: " + retVal);
}
}
}
项目:Iapetus2014
文件:DriverStationLCD.java
/**
* DriverStationLCD constructor.
*
* This is only called once the first time GetInstance() is called
*/
private DriverStationLCD() {
final char[] blank_bytes = new char[LINE_LENGTH];
Arrays.fill(blank_bytes,' ');
EMPTY_STRING = new String(blank_bytes);
textBuffer = new byte[NUM_LInes][FRCControl.USER_DS_LCD_DATA_SIZE];
clear();
}
项目:wpilib-java
文件:Kinect.java
/**
* Called by the other Kinect functions to check for the latest data
* This function will update the internal data structures
* with the most recent Kinect input
*/
void updateData() {
int retVal;
if (m_recentPacketNumber != DriverStation.getInstance().getPacketNumber()){
m_recentPacketNumber = DriverStation.getInstance().getPacketNumber();
synchronized (m_headerDataSemaphore) {
retVal = FRCControl.getDynamicControlData(kHeaderBlockID,5);
if (retVal == 0) {
tempSkeletonData.copy(m_skeletonData);
m_skeletonValid = true;
}else {
m_skeletonValid = false;
}
}
}
}
项目:wpilib-java
文件:DriverStationLCD.java
/**
* DriverStationLCD constructor.
*
* This is only called once the first time GetInstance() is called
*/
private DriverStationLCD() {
m_textBuffer = new byte[FRCControl.USER_DS_LCD_DATA_SIZE];
for (int i = 0; i < FRCControl.USER_DS_LCD_DATA_SIZE; i++) {
m_textBuffer[i] = ' ';
}
m_textBuffer[0] = (byte) (kFulldisplayTextCommand >> 8);
m_textBuffer[1] = (byte) kFulldisplayTextCommand;
UsageReporting.report(UsageReporting.kResourceType_DriverStationLCD,0);
}
项目:wpilib-java
文件:KinectStick.java
/**
* Update the data in this class with the latest data from the
* Driver Station.
*/
private void getData() {
if (m_recentPacketNumber != DriverStation.getInstance().getPacketNumber()){
m_recentPacketNumber = DriverStation.getInstance().getPacketNumber();
int retVal = FRCControl.getDynamicControlData(kJoystickDataID,5);
if (retVal != 0) {
System.err.println("Bad retval: " + retVal);
}
}
}
/**
* Called by the DriverStation class when data is available.
* This function will set any modified configuration / output,* then read the input and configuration from the IO.
*/
void updateData() {
int retVal;
synchronized (m_outputDataSemaphore) {
if (m_outputValid || m_configChanged || m_requestEnhancedEnable) {
m_outputData.flags = kStatusValid;
if (m_requestEnhancedEnable) {
// Someone called one of the get config APIs,but we are not in enhanced mode.
m_outputData.flags |= kForceEnhancedMode;
}
if (m_configChanged) {
if (!m_outputValid) {
// Someone called one of the set config APIs,but we are not in enhanced mode.
m_outputData.flags |= kForceEnhancedMode;
}
m_outputData.flags |= kStatusConfigChanged;
}
FRCControl.overrideIOConfig(m_outputData,5);
}
retVal = FRCControl.getDynamicControlData(kOutputBlockID,5);
if (retVal == 0) {
if (m_outputValid) {
if (m_configChanged) {
// If our config change made the round trip then clear the flag.
if (isConfigEqual(tempOutputData,m_outputData)) {
m_configChanged = false;
}
} else {
// Todo: This won't work until artf1128 is fixed
//if (tempOutputData.flags & kStatusConfigChanged)
{
// Configuration was updated on the DS,so update our local cache.
mergeConfigIntoOutput(tempOutputData,m_outputData);
}
}
} else {
// Initialize the local cache.
mergeConfigIntoOutput(tempOutputData,m_outputData);
}
m_requestEnhancedEnable = false;
m_outputValid = true;
} else {
m_outputValid = false;
m_inputValid = false;
}
}
synchronized (m_inputDataSemaphore) {
retVal = FRCControl.getDynamicControlData(kInputBlockID,tempInputData,tempInputData.size(),5);
if (retVal == 0 && tempInputData.data.api_version == kSupportedAPIVersion) {
tempInputData.copy(m_inputData);
m_inputValid = true;
} else {
m_outputValid = false;
m_inputValid = false;
}
}
}
项目:wpilibj
文件:DriverStationLCD.java
/**
* Send the text data to the Driver Station.
*/
public synchronized void updateLCD() {
FRCControl.setUserDsLcdData(m_textBuffer,FRCControl.USER_DS_LCD_DATA_SIZE,kSyncTimeout_ms);
}
项目:Iapetus2014
文件:DriverStationLCD.java
/**
* Send the text data to the Driver Station.
*/
private void updateLCD() {
synchronized (textBuffer) {
FRCControl.setUserDsLcdData(flattenTextBuffer(textBuffer),TIMEOUT_MS);
}
}
/**
* Called by the DriverStation class when data is available.
* This function will set any modified configuration / output,5);
if (retVal == 0 && tempInputData.data.api_version == kSupportedAPIVersion) {
tempInputData.copy(m_inputData);
m_inputValid = true;
} else {
m_outputValid = false;
m_inputValid = false;
}
}
}
项目:wpilib-java
文件:DriverStationLCD.java
/**
* Send the text data to the Driver Station.
*/
public synchronized void updateLCD() {
FRCControl.setUserDsLcdData(m_textBuffer,kSyncTimeout_ms);
}
项目:wpilibj
文件:Protocol.java
/**
* Flushes this output stream and forces any buffered output bytes
* to be written out. The general contract of <code>flush</code> is
* that calling it is an indication that,if any bytes prevIoUsly
* written have been buffered by the implementation of the output
* stream,such bytes should immediately be written to their
* intended destination.
* <p>
* The <code>flush</code> method of <code>OutputStream</code> does nothing.
*
* @exception IOException if an I/O error occurs.
*/
public synchronized void flush()
throws IOException {
if (errorBuffer == null) {
throw new IllegalStateException("DSErrorOutputStream is closed");
}
if (index > 0) {
FRCControl.setErrorData(errorBuffer,index,100);
index = 0;
}
}
项目:RobotCode2014
文件:Protocol.java
/**
* Flushes this output stream and forces any buffered output bytes
* to be written out. The general contract of <code>flush</code> is
* that calling it is an indication that,100);
index = 0;
}
}
项目:wpilib-java
文件:Protocol.java
/**
* Flushes this output stream and forces any buffered output bytes
* to be written out. The general contract of <code>flush</code> is
* that calling it is an indication that,100);
index = 0;
}
}