-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for CAN devices. #34
Conversation
Fyi, I'm already working on the making DeepBlueSim compatible with these changes, but this can be merged before that is finished because DeepBlueSim will continue to reference the current commit of WPIWebSockets until it is made compatible. |
|
||
// Define the command line that npx should use | ||
workingDir = buildDir // Because templateDir can't be under it | ||
command = '@asyncapi/generator@1.17.25' | ||
args = ['--force-write', | ||
'-o', "${outputDir}/org/team199/wpiws/devices", | ||
"https://raw.githubusercontent.com/wpilibsuite/allwpilib/master/simulation/halsim_ws_core/doc/wpilib-ws.yaml", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do go back to directly referencing the WPILib spec rather than the one here (see other comment), we should change this to point at a specific tag rather than master
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Per my other comment, I'd like to do that as a separate PR.
src/main/java/org/team199/wpiws/connection/MessageProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/org/team199/wpiws/connection/MessageProcessor.java
Outdated
Show resolved
Hide resolved
wpilib-ws.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original reason we PRed wpilib-ws.yaml
to WPILib was so that it could be kept up-to-date with their project. Thus, if we wanted to add this support, it would probably make more sense to open a new PR to allwpilib
to add the necessary info to the machine-readable spec. In order to do the aliasing, we could then (for example) do:
simDevice:
type: object
required:
- type
- device
properties:
type:
const: SimDevice
oneOf:
- device:
type: string
data:
type: object
additionalProperties:
type: string
- device:
type: string
format: "CANMotor:.+" # If we actually do this we can make a better regex
data:
$ref: "#/schemas/aiData/properties/data"
- ...etc
(I threw this together quickly, so we'd also have to validate the syntax)
We could then try to delete the extra SimDevice object with a generator hook. (I tried and failed to do this before, but hopefully, we can make it work :D )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With my latest commit, I've updated the local wpilib-ws.yaml
to better address the aliasing. I'll open a wpilib PR to get the changes included there, but I don't see a good reason to wait. Even once the wpilib copy is updated, we should refer to a fixed version (as you mentioned above). But doing that won't change the actual contents of the yaml file that is used. It will just change it's source to better document intent. That can be as a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created the wpilib PR.
Co-authored-by: CoolSpy3 <coolspythree@gmail.com>
Co-authored-by: CoolSpy3 <coolspythree@gmail.com>
…he template files to deal with that.
No description provided.