From fc2613d57f88a89b9faf806a42befe8122cfbf10 Mon Sep 17 00:00:00 2001 From: Dean Brettle Date: Wed, 22 May 2024 10:20:24 -0700 Subject: [PATCH] Document use of an extended version of the spec. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f2cbf89..e18cf03 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # WPIWebSockets This API provides a Java interface to the [WPILib HALSim WebSockets API](https://github.com/wpilibsuite/allwpilib/blob/master/simulation/halsim_ws_core/doc/hardware_ws_api.md) which mirrors the standard simulation API. # Building the API -To build the API, navigate to the root directory of this repository and run `./gradlew build`. This will use Gradle to build the API with Java 8. Note that the simulated device files (org.team199.wpiws.devices.*) are auto-generated using the [AsyncAPI Generator](https://github.com/asyncapi/generator) and [WPILib's machine readable WebSocket specification](https://github.com/wpilibsuite/allwpilib/blob/master/simulation/halsim_ws_core/doc/wpilib-ws.yaml). The AsyncAPI template used to generate these files is located at [./asyncapi-template](https://github.com/DeepBlueRobotics/WPIWebSockets/tree/master/asyncapi-template). These files are auto-generated during the `WPIWebSockets:build` task, however, they can be manually regenerated by running `./gradlew generateDeviceFiles`. +To build the API, navigate to the root directory of this repository and run `./gradlew build`. This will use Gradle to build the API with Java 8. Note that the simulated device files (org.team199.wpiws.devices.*) are auto-generated using the [AsyncAPI Generator](https://github.com/asyncapi/generator) and [an extended version](https://github.com/DeepBlueRobotics/WPIWebSockets/tree/master/wpilib-ws.yaml) of [WPILib's machine readable WebSocket specification](https://github.com/wpilibsuite/allwpilib/blob/master/simulation/halsim_ws_core/doc/wpilib-ws.yaml). The AsyncAPI template used to generate these files is located at [./asyncapi-template](https://github.com/DeepBlueRobotics/WPIWebSockets/tree/master/asyncapi-template). These files are auto-generated during the `WPIWebSockets:build` task, however, they can be manually regenerated by running `./gradlew generateDeviceFiles`. # Using the API Connecting to the running HALSim client and server instances can be accomplished by using the `connectHALSim` and `startHALSimServer` methods of [`org.team199.wpiws.connection.WSConnection`](https://github.com/DeepBlueRobotics/WPIWebSockets/blob/master/src/main/java/org/team199/wpiws/connection/WSConnection.java). Code for connecting to simulated devices can be found in the `org.team199.wpiws.devices` package. These classes can be initialized by providing the constructor with the device id with which it should associate itself. The instance will then provide getter, setter, and callback methods for all of the values exposed by the WebSocket API. (ex. `new PWMSim("5").setSpeed(5)`, `new DIOSim("0").getValue()`). Note: `static` methods apply globaly to the device type.