This repository contains a reference implementation of a XRP robot that can be controlled via the WPILib XRP extension.
The firmware implements a custom binary protocol over UDP to account for the less performant hardware on the XRP.
Official documentation for the XRP and how to use it with WPILib can be found on the WPILib Docs site. The documentation below is also reflected in the official WPILib documentation.
To install the latest firmware on your XRP, do the following:
The firmware provides an endpoint for the WPILib Simulation layer that allows WPILib robot programs to interact with real hardware on the XRP over UDP.
Upon boot up, the following will happen:
For ideal use, the XRP should be placed on a flat surface prior to power up, and if necessary, users can hit the reset button to restart the firmware and IMU calibration process.
If setup as an Access Point, the configured AP name should appear in the list of available WiFi networks. The XRP will be available at the IP address 192.168.42.1.
If setup in STA mode (i.e. connected to an existing network), the IP address can be determined by either using a tool like Angry IP Scanner, or (more easily), by connecting the XRP to a computer, navigating to the PICODISK removable drive and opening the xrp-status.txt
file. This file contains information about which network the XRP is connected to, as well as the IP address.
The XRP provides a simple web-based configuration screen that allows users to adjust the network settings. This screen is available at http://<IP ADDRESS OF XRP>:5000
. By default, this will be http://192.168.42.1:5000
.
Users can manually edit the JSON configuration to change the AP name/password, or provide a list of networks to connect to in STA mode. Note that an AP name and password must always be provided as the XRP will fallback to generating an AP if it cannot connect to any listed networks. The mode
field can be switched between AP
or STA
depending on the user's preference.
After saving changes, make sure the restart the XRP.
As of 10/13/2023, you MUST use the 2024 Beta 1 version (or later) of WPILib to write XRP programs. There are also examples and templates available (look for "XRP" in the examples/templates dropdown when creating a new project).
DIO Port # | Function |
---|---|
0 | XRP User Button |
1 | XRP Onboard LED |
2 | RESERVED |
3 | RESERVED |
4 | Left Encoder A |
5 | Left Encoder B |
6 | Right Encoder A |
7 | Right Encoder B |
8 | Motor 3 Encoder A |
9 | Motor 3 Encoder B |
10 | Motor 4 Encoder A |
11 | Motor 4 Encoder B |
Analog Port # | Function |
---|---|
0 | Left Reflectance |
1 | Right Reflectance |
2 | Rangefinder |
NOTE: The analog I/O mapping assumes that the reflectance sensor and rangefinder are plugged into the XRP as directed in the setup instructions. All analog I/O channels return values in the range 0-5V.
The reflectance sensors return a value from 0.0V (white) to 5.0V (black).
The maximum range of the rangefinder is 4m, and the minimum detectable range is 2cm. Any values outside of this range will cause the rangefinder to saturate and return the maximum value.
The rangefinder will return a value between 0.0V (min distance) to 5.0V (4m).
Instead of pure PWM channels, the XRP uses SimDevices, specifically the XRPMotor
and XRPServo
devices.
Device # | Device Type | Function |
---|---|---|
0 | XRPMotor | Left Motor |
1 | XRPMotor | Right Motor |
2 | XRPMotor | Motor 3 |
3 | XRPMotor | Motor 4 |
4 | XRPServo | Servo 1 |
5 | XRPServo | Servo 2 |