"

2013 FRC Java API

"

edu.wpi.first.wpilibj.communication
Class FRCControl

java.lang.Object
  extended by edu.wpi.first.wpilibj.communication.FRCControl

public final class FRCControl
extends Object

Contains the code necessary to communicate between the robot and the driver station.


Nested Class Summary
static class FRCControl.CachedNativeBuffer
          A simple 1-element cache that keeps a pointer to native memory around.
static class FRCControl.DynamicControlData
           
 
Field Summary
static int IO_CONFIG_DATA_SIZE
          The size of the IO configuration data
static int USER_CONTROL_DATA_SIZE
          The size of the user control data
static int USER_DS_LCD_DATA_SIZE
          The size of the user driver station display data
static int USER_STATUS_DATA_SIZE
          The size of the user status data
 
Method Summary
static int getCommonControlData(FRCCommonControlData data, int wait_ms)
          Get the control data from the driver station.
static int getDynamicControlData(byte type, FRCControl.DynamicControlData dynamicData, int maxLength, int wait_ms)
          Get the dynamic control data from the driver station.
static void observeUserProgramAutonomous()
           
static void observeUserProgramDisabled()
           
static void observeUserProgramStarting()
          Let the DS know that the user is loading a new app.
static void observeUserProgramTeleop()
           
static void observeUserProgramTest()
           
static int overrideIOConfig(FRCControl.DynamicControlData ioConfig, int wait_ms)
          Right new io config data.
static void setErrorData(byte[] bytes, int length, int timeOut)
          Send data to the driver station's error panel
static void setErrorData(Pointer textPtr, int length, int timeOut)
          Send data to the driver station's error panel
static void setNewDataSem(Semaphore sem)
          Set the semaphore for the communications task to use
static int setStatusData(double battery, int dsDigitalOut, int updateNumber, byte[] userDataHigh, int userDataHighLength, byte[] userDataLow, int userDataLowLength, int wait_ms)
          Set the status data to send to the ds
static void setUserDsLcdData(byte[] bytes, int length, int timeOut)
          Send data to the driver station's user panel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IO_CONFIG_DATA_SIZE

public static final int IO_CONFIG_DATA_SIZE
The size of the IO configuration data

See Also:
Constant Field Values

USER_CONTROL_DATA_SIZE

public static final int USER_CONTROL_DATA_SIZE
The size of the user control data

See Also:
Constant Field Values

USER_STATUS_DATA_SIZE

public static final int USER_STATUS_DATA_SIZE
The size of the user status data

See Also:
Constant Field Values

USER_DS_LCD_DATA_SIZE

public static final int USER_DS_LCD_DATA_SIZE
The size of the user driver station display data

See Also:
Constant Field Values
Method Detail

getCommonControlData

public static int getCommonControlData(FRCCommonControlData data,
                                       int wait_ms)
Get the control data from the driver station. The parameter "data" is only updated when the method returns 0.

Parameters:
data - the object to store the results in (out param)
wait_ms - the maximum time to wait
Returns:
0 if new data, 1 if no new data, 2 if access timed out.

getDynamicControlData

public static int getDynamicControlData(byte type,
                                        FRCControl.DynamicControlData dynamicData,
                                        int maxLength,
                                        int wait_ms)
Get the dynamic control data from the driver station. The parameter "dynamicData" is only updated when the method returns 0.

Parameters:
type - The type to get.
dynamicData - The array to hold the result in.
maxLength - The maximum length of the data.
wait_ms - The maximum time to wait.
Returns:
0 if new data, 1 if no new data, 2 if access timed out.

overrideIOConfig

public static int overrideIOConfig(FRCControl.DynamicControlData ioConfig,
                                   int wait_ms)
Right new io config data.

Parameters:
ioConfig - The data to write / read
wait_ms - The maximum time to wait.
Returns:
0 if new data, 1 if no new data, 2 if access timed out.

setStatusData

public static int setStatusData(double battery,
                                int dsDigitalOut,
                                int updateNumber,
                                byte[] userDataHigh,
                                int userDataHighLength,
                                byte[] userDataLow,
                                int userDataLowLength,
                                int wait_ms)
Set the status data to send to the ds

Parameters:
battery - the battery voltage
dsDigitalOut - value to set the digital outputs on the ds to
updateNumber - unique ID for this update (incrementing)
userDataHigh - additional high-priority user data bytes
userDataHighLength - number of high-priority data bytes
userDataLow - additional low-priority user data bytes
userDataLowLength - number of low-priority data bytes
wait_ms - the timeout
Returns:
0 on success, 1 if userData.length is too big, 2 if semaphore could not be taken in wait_ms.

setErrorData

public static void setErrorData(byte[] bytes,
                                int length,
                                int timeOut)
Send data to the driver station's error panel

Parameters:
bytes - the byte array containing the properly formatted information for the display
length - the length of the byte array
timeOut - the maximum time to wait

setErrorData

public static void setErrorData(Pointer textPtr,
                                int length,
                                int timeOut)
Send data to the driver station's error panel

Parameters:
textPtr - pointer to C byte array containing the properly formatted information for the display
length - the length of the byte array
timeOut - the maximum time to wait

setUserDsLcdData

public static void setUserDsLcdData(byte[] bytes,
                                    int length,
                                    int timeOut)
Send data to the driver station's user panel

Parameters:
bytes - the byte array containing the properly formatted information for the display
length - the length of the byte array
timeOut - the maximum time to wait

setNewDataSem

public static void setNewDataSem(Semaphore sem)
Set the semaphore for the communications task to use

Parameters:
sem - the semaphore to use

observeUserProgramStarting

public static void observeUserProgramStarting()
Let the DS know that the user is loading a new app.


observeUserProgramDisabled

public static void observeUserProgramDisabled()

observeUserProgramAutonomous

public static void observeUserProgramAutonomous()

observeUserProgramTeleop

public static void observeUserProgramTeleop()

observeUserProgramTest

public static void observeUserProgramTest()

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"