Explicitly list required components when using FindJava and FindJNI Consolidate find_package calls for Java, JNI, and OpenCV into the root CMakeLists.txt file Remove references to main_lib_dest Install missing generated headers Flatten some if statements Use LinkMacOSGUI macro instead of hand rolling it Stop installing OpenCV libraries and an extra ntcorejni library; OpenCV JAR will still be installed to make it easy to use Only print platform version on Windows Prevent GUI modules from being built when wpimath is off, which would otherwise cause a build failure Simplify build configuration checks Clean up fieldImages JAR creation Place built JARs in the same subdir as installed JARs Remove unnecessary JAR includes Remove extra directories in target_include_directories Improve CMake docs
HAL XRP Client
This is an extension that provides a client version of the XRP protocol for transmitting robot hardware interface state to an XRP robot over UDP.
Configuration
The XRP client has a number of configuration options available through environment variables.
HALSIMXRP_HOST: The host to connect to. Defaults to localhost.
HALSIMXRP_PORT: The port number to connect to. Defaults to 3540.
XRP Protocol
The WPILib -> XRP protocol is binary-based to save on bandwidth due to hardware limitations of the XRP robot. The messages to/from the XRP follow a the format below:
| 2 bytes | 1 byte | n bytes |
|---|---|---|
| uint16_t sequence | uint8_t control | <Tagged Data> |
Control Byte
The control byte is used to indicate the current enabled state of the WPILib robot code. When this is set to 1, the robot is enabled, and when it is set to 0 it is disabled.
Messages originating from the XRP have an unspecified value for the control byte.
Tagged Data
The Tagged Data section can contain an arbitrary number of data blocks. Each block has the format below:
| 1 byte | 1 byte | n bytes |
|---|---|---|
| uint8_t size | uint8_t tagID | <payload> |
The size byte encodes the size of the data block, excluding itself. Thus the smallest block size is 2 bytes, with a size value of 1 (1 size byte, 1 tag byte, 0 payload bytes). Maximum size of the payload is 254 bytes.
Utilizing tagged data blocks allows us to send multiple pieces of data in a single UDP packet. The tags currently implemented for the XRP are as follows:
| Tag | Description |
|---|---|
| 0x12 | XRPMotor |
| 0x13 | XRPServo |
| 0x14 | DIO |
| 0x15 | AnalogIn |
| 0x16 | XRPGyro |
| 0x17 | BuiltInAccel |
| 0x18 | Encoder |
XRPMotor
| Order | Data Type | Description |
|---|---|---|
| 0 | uint8_t | ID |
| 1 | float | Value [-1.0, 1.0] |
IDs:
| ID | Description |
|---|---|
| 0 | Left Motor |
| 1 | Right Motor |
| 2 | Motor 3 |
| 3 | Motor 4 |
XRPServo
| Order | Data Type | Description |
|---|---|---|
| 0 | uint8_t | ID |
| 1 | float | Value [0.0, 1.0] |
IDs:
| ID | Description |
|---|---|
| 4 | Servo 1 |
| 5 | Servo 2 |
DIO
| Order | Data Type | Description |
|---|---|---|
| 0 | uint8_t | ID |
| 1 | uint8_t | Value (True/False) |
AnalogIn
| Order | Data Type | Description |
|---|---|---|
| 0 | uint8_t | ID |
| 1 | float | Value |
XRPGyro
| Order | Data Type | Description |
|---|---|---|
| 0 | float | rate_x (dps) |
| 1 | float | rate_y (dps) |
| 2 | float | rate_z (dps) |
| 3 | float | angle_x (deg) |
| 4 | float | angle_y (deg) |
| 5 | float | angle_z (deg) |
BuiltInAccel
| Order | Data Type | Description |
|---|---|---|
| 0 | float | accel_x (g) |
| 1 | float | accel_y (g) |
| 2 | float | accel_z (g) |
Encoder
| Order | Data Type | Description |
|---|---|---|
| 0 | uint8_t | ID |
| 1 | int32_t | Count |
| 2 | uint32_t | Period Numerator |
| 3 | uint32_t | Period Denominator |
IDs:
| ID | Description |
|---|---|
| 0 | Left Motor Encoder |
| 1 | Right Motor Encoder |
| 2 | Motor 3 Encoder |
| 3 | Motor 4 Encoder |