2010 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 int overrideIOConfig(FRCControl.DynamicControlData ioConfig, int wait_ms)
          Right new io config data.
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)
          Set the data to be sent to the user
 
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)
userData - the byte array for the raw control data (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
userData - additional user data bytes (in param)
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.

setUserDsLcdData

public static void setUserDsLcdData(byte[] bytes,
                                    int length,
                                    int timeOut)
Set the data to be sent to the user

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

2010 FRC Java API


Copyright © 2006-2009 Sun Microsystems, Inc. All Rights Reserved.