本文整理汇总了Java中edu.wpi.first.wpilibj.communication.FRCControl类的典型用法代码示例。如果您正苦于以下问题:Java FRCControl类的具体用法?Java FRCControl怎么用?Java FRCControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FRCControl类属于edu.wpi.first.wpilibj.communication包,在下文中一共展示了FRCControl类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startApp
import edu.wpi.first.wpilibj.communication.FRCControl; //导入依赖的package包/类
/**
* 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.");
}
}
}
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:32,代码来源:RobotBase.java
示例2: startApp
import edu.wpi.first.wpilibj.communication.FRCControl; //导入依赖的package包/类
/**
* 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.");
}
}
}
开发者ID:eshsrobotics,项目名称:wpilib-java,代码行数:29,代码来源:RobotBase.java
示例3: updateData
import edu.wpi.first.wpilibj.communication.FRCControl; //导入依赖的package包/类
/**
* 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;
}
}
}
}
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:42,代码来源:Kinect.java
示例4: DriverStationLCD
import edu.wpi.first.wpilibj.communication.FRCControl; //导入依赖的package包/类
/**
* 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);
}
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:18,代码来源:DriverStationLCD.java
示例5: getData
import edu.wpi.first.wpilibj.communication.FRCControl; //导入依赖的package包/类
/**
* 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);
}
}
}
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:14,代码来源:KinectStick.java
示例6: DriverStationLCD
import edu.wpi.first.wpilibj.communication.FRCControl; //导入依赖的package包/类
/**
* 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();
}
开发者ID:FRC3161,项目名称:Iapetus2014,代码行数:13,代码来源:DriverStationLCD.java
示例7: updateData
import edu.wpi.first.wpilibj.communication.FRCControl; //导入依赖的package包/类
/**
* 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, tempOutputData, tempOutputData.size(), 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;
}
}
}
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:64,代码来源:DriverStationEnhancedIO.java
示例8: updateLCD
import edu.wpi.first.wpilibj.communication.FRCControl; //导入依赖的package包/类
/**
* Send the text data to the Driver Station.
*/
public synchronized void updateLCD() {
FRCControl.setUserDsLcdData(m_textBuffer, FRCControl.USER_DS_LCD_DATA_SIZE, kSyncTimeout_ms);
}
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:7,代码来源:DriverStationLCD.java
示例9: updateLCD
import edu.wpi.first.wpilibj.communication.FRCControl; //导入依赖的package包/类
/**
* Send the text data to the Driver Station.
*/
private void updateLCD() {
synchronized (textBuffer) {
FRCControl.setUserDsLcdData(flattenTextBuffer(textBuffer), FRCControl.USER_DS_LCD_DATA_SIZE, TIMEOUT_MS);
}
}
开发者ID:FRC3161,项目名称:Iapetus2014,代码行数:9,代码来源:DriverStationLCD.java
示例10: flush
import edu.wpi.first.wpilibj.communication.FRCControl; //导入依赖的package包/类
/**
* 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;
}
}
开发者ID:frc-team-342,项目名称:wpilibj,代码行数:24,代码来源:Protocol.java
注:本文中的edu.wpi.first.wpilibj.communication.FRCControl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论