2021-01-09 23:24:57 -08:00
asyncapi : 2.0 .0
info :
title : WPILib WebSocket Remote Endpoint API
2024-05-26 14:58:32 -07:00
version : "1.1.0"
2021-01-09 23:24:57 -08:00
description : |
API to route WPILib HAL calls over WebSockets.
license :
name : WPILib BSD
channels :
wpilibws :
description : General channel for WPILib WebSocket messages
publish :
operationId : wpilibwsPublish
message :
$ref : "#/components/messages/wpilibwsMsg"
subscribe :
operationId : wpilibwsSubscribe
message :
$ref : "#/components/messages/wpilibwsMsg"
components :
messages :
wpilibwsMsg :
title : WPILib WebSocket Message
summary : Message envelope. Note that the "data" field contains a diff of the current state of a particular device. E.g. If only the "value" changes for a DIO device, then only the "<>value" field will be sent.
contentType : application/json
examples :
- payload :
type : PWM
device : "1"
data :
"<speed": 0.5
- payload :
type : DIO
device : "3"
data :
"<init": true
payload :
type : object
oneOf :
- $ref : "#/components/schemas/accelData"
2024-05-26 14:58:32 -07:00
- $ref : "#/components/schemas/addressableLEDData"
2021-01-09 23:24:57 -08:00
- $ref : "#/components/schemas/aiData"
2024-05-26 14:58:32 -07:00
- $ref : "#/components/schemas/aoData"
2021-01-09 23:24:57 -08:00
- $ref : "#/components/schemas/dioData"
- $ref : "#/components/schemas/dpwmData"
- $ref : "#/components/schemas/driverstationData"
- $ref : "#/components/schemas/dutycycleData"
- $ref : "#/components/schemas/encoderData"
- $ref : "#/components/schemas/gyroData"
2024-05-26 14:58:32 -07:00
- $ref : "#/components/schemas/halData"
2021-01-09 23:24:57 -08:00
- $ref : "#/components/schemas/joystickData"
2024-05-26 14:58:32 -07:00
- $ref : "#/components/schemas/pcmData"
2021-01-09 23:24:57 -08:00
- $ref : "#/components/schemas/pwmData"
- $ref : "#/components/schemas/relayData"
- $ref : "#/components/schemas/solenoidData"
- $ref : "#/components/schemas/roborioData"
2024-05-30 05:32:45 -07:00
- $ref : "#/components/schemas/canmotorData"
- $ref : "#/components/schemas/canencoderData"
- $ref : "#/components/schemas/cangyroData"
- $ref : "#/components/schemas/canaccelData"
- $ref : "#/components/schemas/canainData"
- $ref : "#/components/schemas/candioData"
- $ref : "#/components/schemas/candutycycleData"
2024-05-24 12:56:34 -07:00
- $ref : "#/components/schemas/simdeviceData"
2021-01-09 23:24:57 -08:00
schemas :
accelData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : Accel
device :
type : string
description : Arbitrary device name
data :
type : object
description : "Accelerometer Data (type: Accelerometer, device: channel number)"
properties :
<init :
type : boolean
description : "If accelerometer is initialized in the robot program"
<range :
type : number
description : "Desired range in G’ s"
">x" :
type : number
description : "Acceleration in G’ s "
">y" :
type : number
description : "Acceleration in G’ s "
">z" :
type : number
description : "Acceleration in G’ s "
2024-05-26 14:58:32 -07:00
addressableLEDData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : AddressableLED
device :
type : string
description : Arbitrary device number
data :
type : object
description : "Addressable LED Data (type: AddressableLED, device: arbitrary)"
properties :
<init :
type : boolean
description : "If the led strip is initialized in the robot program"
"<output_port" :
type : integer
description : "DIO pin number"
"<length" :
type : integer
description : "The number of leds in the strip"
"<running" :
type : boolean
description : "Whether the strip is outputting data"
"<data" :
type : array
description : "One value per led"
items :
type : object
description : "An object with \"r\", \"g\", and \"b\" keys, representing the rgb (0-255) components of the color"
properties :
r :
type : integer
g :
type : integer
b :
type : integer
2021-01-09 23:24:57 -08:00
aiData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : AI
device :
type : string
description : Device Identifier (usually channel)
data :
type : object
description : "Analog Input Data (type: AI, device: channel number)"
properties :
<init :
type : boolean
description : "If analog input is initialized in the robot program"
2024-05-26 14:58:32 -07:00
"<avg_bits" :
type : integer
description : "The number of averaging bits"
"<oversample_bits" :
type : integer
description : "The number of oversampling bits"
2021-01-09 23:24:57 -08:00
">voltage" :
type : number
description : "Input voltage, in volts"
2024-05-26 14:58:32 -07:00
"<accum_init" :
type : boolean
description : "If the accumulator is initialized in the robot program"
">accum_value" :
type : integer
description : "The accumulated value"
">accum_count" :
type : integer
description : "The number of accumulated values"
"<accum_center" :
type : integer
description : "The center value of the accumulator"
"<accum_deadband" :
type : integer
description : "The accumulator's deadband"
aoData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : AO
device :
type : string
description : Device Identifier (usually channel)
data :
type : object
description : "Analog Output Data (type: AO, device: channel number)"
properties :
<init :
type : boolean
description : "If analog output is initialized in the robot program"
"<voltage" :
type : number
description : "Output voltage, in volts"
2021-01-09 23:24:57 -08:00
dioData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : DIO
device :
type : string
description : Device Identifier (usually channel)
data :
type : object
description : "Digital Input/Output Data (type: DIO, device: channel number)"
properties :
<init :
type : boolean
description : "If DIO is initialized in the robot program"
<input :
type : boolean
description : "True if input, false if output"
<>value :
type : boolean
description : "Input or output state"
2024-05-26 14:58:32 -07:00
"<pulse_length" :
type : number
description : "Reserved for future use"
2021-01-09 23:24:57 -08:00
dpwmData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : dPWM
device :
type : string
description : Device Identifier (usually channel)
data :
type : object
description : "Duty Cycle Output Data (type: dPWM, device: channel number)"
properties :
<init :
type : boolean
description : "If output is initialized in the robot program"
<duty_cycle :
type : number
description : "Duty cycle %"
minimum : 0.0
maximum : 1.0
<dio_pin :
type : integer
description : "DIO pin number"
driverstationData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : DriverStation
device :
type : string
description : Should be left blank
data :
type : object
description : "Driver Station Data (type: DriverStation)"
properties :
">new_data" :
type : boolean
description : "One shot. If set to true in a message, notifies the robot program that new DS and Joystick data is available."
">enabled" :
type : boolean
description : "True to enable the robot program"
">autonomous" :
type : boolean
description : "True for autonomous mode; false for teleoperated mode"
">test" :
type : boolean
description : "True for test mode; false for other modes"
">estop" :
type : boolean
description : "True to emergency stop (no motor outputs)"
">fms" :
type : boolean
description : "True if the DS is connected to a Field Management System (FMS)"
">ds" :
type : boolean
description : "True if a DS application is connected"
">station" :
type : string
description : "Station color and number; supported values are 'red1', 'red2', 'red3', 'blue1', 'blue2', 'blue3'."
">match_time" :
type : number
description : "Match time countdown, in seconds, for each match period (e.g. for 15 second period, starts at 15 and counts down to 0). If not in a match, -1."
">game_data" :
type : string
description : "Game-specific data; arbitrary string contents"
dutycycleData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : DutyCycle
device :
type : string
description : Arbitrary device name
data :
type : object
description : "Duty Cycle Input Data (type: DutyCycle, device: channel number)"
properties :
">connected" :
type : boolean
description : "True if the encoder is connected"
">position" :
type : number
description : "The position in rotations"
encoderData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : Encoder
device :
type : string
description : Device Identifier (usually channel)
data :
type : object
description : "Quadrature Encoder Data (type: Encoder, device: channel number)"
properties :
<init :
type : boolean
description : "If encoder is initialized in the robot program"
<channel_a :
type : integer
description : "Digital channel number for 'A' phase"
<channel_b :
type : integer
description : "Digital channel number for 'B' phase"
<samples_to_avg :
type : integer
description : "Number of samples to average for period measurement"
">count" :
type : integer
description : "Accumulated count (pulses)"
">period" :
type : number
description : "Period between pulses in seconds"
2024-05-26 14:58:32 -07:00
"<reverse_direction" :
type : boolean
description : "If the encoder direction should be inverted"
2021-01-09 23:24:57 -08:00
gyroData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : Gyro
device :
type : string
description : Arbitrary device name
data :
type : object
description : "Gyro Data (type: Gyro, device: channel number)"
properties :
<init :
type : boolean
description : "If gyro is initialized in the robot program"
<range :
type : number
description : "Gyro range in degrees/second (optional)"
">connected" :
type : boolean
description : "True if the gyro is connected"
">angle_x" :
type : number
description : "The gyro angle in degrees"
">angle_y" :
type : number
description : "The gyro angle in degrees"
">angle_z" :
type : number
description : "The gyro angle in degrees"
">rate_x" :
type : number
description : "The current gyro angular rate of change in degrees/second"
">rate_y" :
type : number
description : "The current gyro angular rate of change in degrees/second"
">rate_z" :
type : number
description : "The current gyro angular rate of change in degrees/second"
2024-05-26 14:58:32 -07:00
halData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : HAL
device :
type : string
description : "\"HAL\""
const : HAL
data :
type : object
description : "HAL Data (type: HAL, device: HAL)"
properties :
">sim_periodic_before" :
type : boolean
description : "Sent by the robot before running periodic simulation functions"
">sim_periodic_after" :
type : boolean
description : "Sent by the robot after running periodic simulation functions"
2021-01-09 23:24:57 -08:00
joystickData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : Joystick
device :
type : string
description : Device Identifier (usually channel)
data :
type : object
description : "Joystick Data (type: Joystick, device: channel number)"
properties :
">axes" :
type : array
items :
type : number
description : "Value of an individual axis on this joystick"
minimum : -1.0
maximum : 1.0
">povs" :
type : array
description : "One array element per POV; value is a"
items :
type : integer
description : "State of all POV switches on this joystick; an angle in degrees of the POV (e.g. 0, 90, 315) if pressed, or -1 if the POV is not pressed"
">buttons" :
type : array
description : State of all buttons on this joystick
items :
type : boolean
description : Pressed state of an individual button
<rumble_left :
type : number
description : "Left rumble"
minimum : 0.0
maximum : 1.0
<rumble_right :
type : number
description : "Right rumble"
minimum : 0.0
maximum : 1.0
2024-05-27 06:52:25 -07:00
<outputs :
type : integer
description : "Bitmask of joystick HID outputs"
2021-01-09 23:24:57 -08:00
2024-05-26 14:58:32 -07:00
pcmData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : CTREPCM
device :
type : string
description : Device Identifier (usually channel)
data :
2024-05-27 06:52:25 -07:00
type : object
description : "PCM Output Data (type: PCM, device: module number)"
properties :
<init :
type : boolean
description : "If PCM is initialized in the robot program"
">on" :
type : boolean
description : "Whether the compressor is running"
"<closed_loop" :
type : boolean
description : "Whether closed-loop control is enabled"
">pressure_switch" :
type : boolean
description : "The value of the pressure switch"
">current" :
type : number
description : "The amount of current being drawn by the compressor, in Amps"
2024-05-26 14:58:32 -07:00
2021-01-09 23:24:57 -08:00
pwmData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : PWM
device :
type : string
description : Device Identifier (usually channel)
data :
type : object
description : "PWM Output Data (type: PWM, device: channel number)"
properties :
<init :
type : boolean
description : "If PWM is initialized in the robot program"
<speed :
type : number
description : "Speed"
minimum : -1.0
maximum : 1.0
<position :
type : number
description : "Servo position"
minimum : 0.0
maximum : 1.0
2024-05-26 14:58:32 -07:00
"<raw" :
type : integer
description : "The pulse time in microseconds"
"<period_scale" :
type : integer
description : "Scales the PWM signal by squelching setting a 2-bit mask of outputs to squelch (ex. `1` -> squelch every other value; `3` -> squelch 3 of 4 values)"
"<zero_latch" :
type : boolean
description : "Whether the PWM should be latched to 0"
2021-01-09 23:24:57 -08:00
relayData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : Relay
device :
type : string
description : Device Identifier (usually channel)
data :
type : object
description : "Relay Output Data (type: Relay, device: channel number)"
properties :
<init_fwd :
type : boolean
description : "If relay forward direction is initialized in the robot program"
<init_rev :
type : boolean
description : "If relay reverse direction is initialized in the robot program"
<fwd :
type : boolean
description : "True if forward direction is enabled"
<rev :
type : boolean
description : "True if reverse direction is enabled"
solenoidData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : Solenoid
device :
type : string
description : Device Identifier (usually channel)
data :
type : object
description : "Solenoid Data (type: Solenoid, device: channel number)"
properties :
<init :
type : boolean
description : "If Solenoid is initialized in the robot program"
<output :
type : boolean
description : "The state of the solenoid"
roborioData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : RoboRIO
device :
type : string
description : Should be left blank
data :
type : object
description : "RoboRIO Data (type: RoboRIO)"
properties :
">fpga_button" :
type : boolean
description : "FPGA button state"
">vin_voltage" :
type : number
description : "Vin rail voltage"
">vin_current" :
type : number
description : "Vin rail current"
">6v_voltage" :
type : number
description : "6V rail voltage"
">6v_current" :
type : number
description : "6V rail current"
">6v_active" :
type : boolean
description : "True if 6V rail active, false if inactive"
">6v_faults" :
type : integer
description : "Number of faults on 6V rail"
">5v_voltage" :
type : number
description : "5V rail voltage"
">5v_current" :
type : number
description : "5V rail current"
">5v_active" :
type : boolean
description : "True if 5V rail active, false if inactive"
">5v_faults" :
type : integer
description : "Number of faults on 5V rail"
">3v3_voltage" :
type : number
description : "3.3V rail voltage"
">3v3_current" :
type : number
description : "3.3V rail current"
">3v3_active" :
type : boolean
description : "True if 3.3V rail active, false if inactive"
">3v3_faults" :
type : integer
description : "Number of faults on 3.3V rail"
2024-05-24 12:56:34 -07:00
canmotorData :
type : object
required :
- type
- device
properties :
type :
type : string
2024-05-30 05:32:45 -07:00
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
2024-05-24 12:56:34 -07:00
const : CANMotor
device :
type : string
2024-05-30 05:32:45 -07:00
description : "Should have the form ControllerClassName[id]"
2024-05-24 12:56:34 -07:00
data :
type : object
description : "CANMotor Data"
properties :
<init :
type : boolean
description : "If CANMotor is initialized in the robot program"
"<percentOutput" :
type : number
description : "Percent Output"
minimum : -1.0
maximum : 1.0
">supplyCurrent" :
type : number
description : "Supply current in Amps"
minimum : 0.0
">motorCurrent" :
type : number
description : "Motor current in Amps"
minimum : 0.0
">busVoltage" :
type : number
description : "Bus voltage in Volts"
minimum : 0.0
"<neutralDeadband" :
type : number
description : "Neutral Deadband"
minimum : 0
maximum : 1.0
"<brakeMode" :
type : boolean
description : "Is in brake mode"
canencoderData :
type : object
required :
- type
- device
properties :
type :
type : string
2024-05-30 05:32:45 -07:00
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
2024-05-24 12:56:34 -07:00
const : CANEncoder
device :
type : string
2024-05-30 05:32:45 -07:00
description : "Should have the form EncoderClassName[id]"
2024-05-24 12:56:34 -07:00
data :
type : object
description : "CANEncoder Data"
properties :
<init :
type : boolean
description : "If CANEncoder is initialized in the robot program"
">position" :
type : number
description : "Position in rotations"
">velocity" :
type : number
description : "Velocity in rotations per second"
2024-05-30 05:32:45 -07:00
cangyroData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : CANGyro
device :
type : string
description : "Should have the form GyroClassName[id]"
data :
$ref : "#/components/schemas/gyroData/properties/data"
canaccelData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : CANAccel
device :
type : string
description : "Should have the form AccelClassName[id]"
data :
$ref : "#/components/schemas/accelData/properties/data"
canainData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : CANAIn
device :
type : string
description : "Should have the form AnalogInputClassName[id]"
data :
$ref : "#/components/schemas/aiData/properties/data"
candioData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : CANDIO
device :
type : string
description : "Should have the form DIOClassName[id]"
data :
$ref : "#/components/schemas/dioData/properties/data"
candutycycleData :
type : object
required :
- type
- device
properties :
type :
type : string
description : Device Type (e.g. DIO/AI/PWM/Encoder etc)
const : CANDutyCycle
device :
type : string
description : "Should have the form DutyCycleClassName[id]"
data :
$ref : "#/components/schemas/dutycycleData/properties/data"
2024-05-24 12:56:34 -07:00
simdeviceData :
type : object
required :
- type
- device
2024-05-30 05:32:45 -07:00
properties :
type :
type : string
const : SimDevice
device :
type : string
data :
type : object
additionalProperties :
2024-05-24 12:56:34 -07:00
type : string