diff --git a/simulation/halsim_ws_core/doc/hardware_ws_api.md b/simulation/halsim_ws_core/doc/hardware_ws_api.md index 63d450848c..061fa984be 100644 --- a/simulation/halsim_ws_core/doc/hardware_ws_api.md +++ b/simulation/halsim_ws_core/doc/hardware_ws_api.md @@ -77,13 +77,17 @@ The “hardware“ (which might be a full-fledged 3D simulation engine, a physic | Type value | Description | Device value | | ----------------------- | -------------------------- | ------------------------- | | [``"Accel"``][] | Accelerometer | Arbitrary device name | +| [``"AddressableLED"``][]| Addressable LED Strip | Arbitrary device number | | [``"AI"``][] | Analog input | Port index, e.g. "1", "2" | +| [``"AO"``][] | Analog output | Port index, e.g. "1", "2" | +| [``"CTREPCM"``][] | PCM | Module number, e.g. "1", "2" | | [``"DIO"``][] | Digital input/output | Port index, e.g. "1", "2" | | [``"dPWM"``][] | Duty cycle output | Arbitrary device number | | [``"DriverStation"``][] | Driver station / FMS state | Blank | | [``"DutyCycle"``][] | Duty cycle input | Arbitrary device name | | [``"Encoder"``][] | Quadrature encoder | Arbitrary device number | | [``"Gyro"``][] | Gyro | Arbitrary device name | +| [``"HAL"``][] | HAL data | ``"HAL"`` | | [``"Joystick"``][] | Joystick data | Joystick number | | [``"PWM"``][] | PWM output | Port index, e.g. "1", "2" | | [``"Relay"``][] | Relay output | Port index, e.g. "1", "2" | @@ -105,16 +109,46 @@ C++/Java implementation note: these are created as either BuiltInAccelerometer o | ``">y"`` | Float | Acceleration in G’s | | ``">z"`` | Float | Acceleration in G’s | +#### Addressable LED Strip ("AddressableLED") + +[``"AddressableLED"``]:#addressable-led-strip-addressableled + +| Data Key | Type | Description | +| ------------------ | ------- | ---------------------------------------------------- | +| ``"voltage"`` | Float | Input voltage, in volts | +| Data Key | Type | Description | +| --------------------- | ------- | --------------------------------------------------- | +| ``"voltage"`` | Float | Input voltage, in volts | +| ``"accum_value"`` | Integer | The accumulated value | +| ``">accum_count"`` | Integer | The number of accumulated values | +| ``"value"`` | Boolean | Input or output state | +| ``"count"`` | Integer | Accumulated count (pulses) | -| ``">period"`` | Float | Period between pulses in seconds | +| Data Key | Type | Description | +| ------------------------ | ------- | --------------------------------------------------- | +| ``"count"`` | Integer | Accumulated count (pulses) | +| ``">period"`` | Float | Period between pulses in seconds | +| ``"rate_y"`` | Float | The current gyro angular rate of change in degrees/second | | ``">rate_z"`` | Float | The current gyro angular rate of change in degrees/second | +#### HAL Data ("HAL") + +[``"HAL"``]:#hal-data-hal + +Only sent in XRP mode. + +Only one of ``">sim_periodic_before"`` or ``">sim_periodic_after"`` should be sent in a single message. + +| Data Key | Type | Description | +| -------------------------- | ------- | -------------------------------------------------------------- | +| ``">sim_periodic_before"`` | Boolean | Sent by the robot before running periodic simulation functions | +| ``">sim_periodic_after"`` | Boolean | Sent by the robot after running periodic simulation functions | + #### Joystick Data ("Joystick") [``"Joystick"``]:#joystick-data-joystick @@ -215,17 +264,34 @@ Joystick data is an input to the robot program and should be updated for each in | ``"on"`` | Boolean | Whether the compressor is running | +| ``"pressure_switch"`` | Boolean | The value of the pressure switch | +| ``">current"`` | Float | The amount of current being drawn by the compressor, in Amps | + #### PWM Output ("PWM") [``"PWM"``]:#pwm-output-pwm -PWMs may be used to control either motor controllers or servos. Typically only one of either ``" squelch every other value; `3` -> squelch 3 of 4 values) | +| ``"voltage": type: number description: "Input voltage, in volts" + "accum_value": + type: integer + description: "The accumulated value" + ">accum_count": + type: integer + description: "The number of accumulated values" + "value: type: boolean description: "Input or output state" + "period": type: number description: "Period between pulses in seconds" + "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" + joystickData: type: object required: @@ -368,6 +491,36 @@ components: minimum: 0.0 maximum: 1.0 + 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: + on": + type: boolean + description: "Whether the compressor is running" + "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" + pwmData: type: object required: @@ -398,6 +551,15 @@ components: description: "Servo position" minimum: 0.0 maximum: 1.0 + " squelch every other value; `3` -> squelch 3 of 4 values)" + "data"] = jsonData; + payload["ProcessHalCallback(payload); },