-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Currently, using the sim support provided by lib199 is error prone because it requires knowing the names of the various devices and properties and using those names (as strings) to create and use SimDeviceSim objects. To address this:
- Use the
asyncapi-generatorlike we do inDeepBlueSim, to auto-generate*Simclasses for the various CAN devices we createSimDevicesfor. These would have names likeCANEncoderSim,CANMotorSim,CANDutyCycleSim, etc. The constructors would take the class name (e.g.CANSparkMax), port number, and an optional "input" name (for devices with multiple inputs). - Make the public API provided by the
*Simclasses as consistent as possible with the API provided by WPI's*Simclasses. In particular, theregister*Callbackmethods should return aCallbackStoresubclass and anycancel*Callbackmethods should not be public. - Create simple subclasses of the above
*Simclasses for each of the actual device objects we simulate (e.g.CANSparkMaxSimextendsCANMotorSim) and have the constructors for those take the actual device objects (e.g. aCANSparkMax) and construct the appropriate class name to pass to the*Simsuper constructor.
Side note: Although we could reuse these *Sim classes in DeepBlueSim.jarWPIWebSockets.jar (instead of auto-generating separate *Sim classes there), that would have the following disadvantages:
- Reusing the result of 1 above would involve either making
DeepBlueSim.jarWPIWebSockets.jardepend on lib199.jar or putting the*Simclasses in a separate jar that bothlib199.jarandWPIWebSockets.jar(and robot projects) depend on. - Doing 2 would make
DeepBlueSim.jarWPIWebSockets.jardepend on wpilib. - Doing 3 would make
DeepBlueSim.jarWPIWebSockets.jardepend on vendordeps if the sims weren't split into a separate jar.
Those extra dependencies don't seem worth the effort since the "real" common API is defined by the wpilib-ws.yaml file use to auto-generate the *Sim classes in both projects anyways.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request