The Synthesis simulator comes with code simulation already integrated. However, a development environment for what ever code your are trying to simulate will be required. Synthesis' code simulation relies on the WPILib HALSim extensions, specifically the websocket-client extension. To enable this for your project, add the following lines to your
wpi.sim.envVar("HALSIMWS_HOST", "127.0.0.1") wpi.sim.addWebsocketsClient().defaultEnabled = true
NOTE: The GUI extension interfaces really well and add Joystick/Controller support to your code, whereas Synthesis currently only supports controllers for non-code simulation. If you wish to test using your controllers, I recommend using the GUI extension in conjunction.
Inside of Synthesis, you must configure your "IO map" so we know what signals go where. You can access the configuration modal on the side bar. Once inside the configuration modal, you can add the devices you want to add support for.
NOTE: Currently, due to the way the websocket extension works, no CAN devices are supported. We plan on bringing CAN support for the 2023 Summer release or potentially earlier. At the moment, PWM and Quadrature Encoders (encoders that use 2 DIO ports each) are supported, with more device types and sensors on the way.
Inside of Synthesis, open up the DriverStation. Once connected, you can use it like normal. Our DriverStation is currently limited in its features, so if you need anything beyond enabling and choosing between Telop and Auto, I recommend using the GUI extension for more functionality.
I recommend using VSCode and the WPILib Suite extension for running the code simulation. Alternatively you can use this command:
gradlew.bat simulationJava or
If you need help with anything regarding Synthesis or it's related features please reach out through our discord sever. It's the best way to get in contact with the community and our current developers.