Skip to content

Commit

Permalink
Document use of an extended version of the spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
brettle committed May 22, 2024
1 parent 37eac06 commit fc2613d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down

0 comments on commit fc2613d

Please sign in to comment.