This is the SyntheSim Java utility library. FRC users can add this to their project to enhance the simulation capabilities of commonly used libraries
A list of the 3rd-Party libraries SyntheSimJava supports, including the features currently offered.
- CANSparkMax
- Basic motor control
- Basic internal encoder data
- Motor following
- Full encoder support
- TalonFX
- Basic motor control
- Full configuration support (via a TalonFXConfigurator wrapper)
- Basic internal encoder data
- Motor following
- Full encoder support
To build the project, run the build task:
Example
Windows:
gradlew.bat buildMacOS/Linux:
./gradlew buildCurrently, SyntheSimJava is only available as a local repository. This means it will need to be published and accessed locally.
To publish the project locally, run the publishToMavenLocal task:
Example
Windows:
gradlew.bat publishToMavenLocalMacOS/Linux:
./gradlew publishToMavenLocalIn order to add the project locally, you must include the mavenLocal() repository to your projects:
repositories {
mavenLocal()
...
}Then, add the implementation to your dependencies:
dependencies {
...
implementation "com.autodesk.synthesis:SyntheSimJava:1.0.0"
...
}SyntheSimJava creates alternative classes that wrap the original ones. Everything that we intercept is passed on to the original class, making it so these classes can (although not recommended) be used when running your robot code on original hardware. Be sure to switch over any and all CAN devices that this project supports in order to effectively simulate your code inside of Synthesis, or with any HALSim, WebSocket supported simulation/device.
The one exception to this is the CANSparkMax.getAbsoluteEncoder() method, which you must substitute for the CANSparkMax.getAbsoluteEncoderSim() method, because we were unable to override the original, because we are unable to wrap the return type SparkAbsoluteEncoder, because it's constructor is private. We instead created a class that implements all the same interfaces and has all the same methods, and thus works exactly the same, except it isn't an explicit subclass of SparkAbsoluteEncoder. The only difference to the API is the method name, everything else operates identically.