Skip to content
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 CAN message schema to wpilib-ws.yaml and add 2 CANMotor props #6651

Conversation

brettle
Copy link
Contributor

@brettle brettle commented May 23, 2024

We use wpilib-ws.yaml to auto-generate code designed to work with halsim_ws and are adding support for CAN devices. This PR:

  1. Updates wpilib-ws.yaml to reflect the specific SimDevice type messages described in the CAN messages section (and hardware/DutyCycle section) of the api doc.
  2. Adds and documents "<neutralDeadband" and "<brakeMode" as 2 new data properties for CANMotor messages. These are needed so that a simulated CANMotor can respond appropriately (including setting ">motorCurrent" and/or ">supplyCurrent") when "<percentOutput" is set.

const: SimDevice
device:
type: string
format: "[^:]+"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not written in the spec that other devices cannot have colons in the name. Might I suggest (although a bit more verbose)

Suggested change
format: "[^:]+"
format: "([^:]+|(?!DutyCycle|CAN(Motor|Encoder|Gyro|Accel|AIn|DIO|DutyCycle)).*:.*)+"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest commit uses a slightly shorter and imo clearer regex.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree! Your version is clearer :D

brettle and others added 2 commits May 23, 2024 15:38
Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
@PeterJohnson PeterJohnson merged commit 237ebfd into wpilibsuite:main May 24, 2024
25 checks passed
chauser pushed a commit to chauser/allwpilib that referenced this pull request May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants