This template provides a partially completed WPILib Java project for a Swerve subsystem.
Programmers are expected to correct the code.
JSON Documentation: https://docs.google.com/document/d/1BHlBtJr1VE0Y8vt6WOzpMimnzWnfdrWHdG0ruRJGxIU/edit?usp=sharing
Swerve Drive Presentation: https://docs.google.com/presentation/d/1jDL35-vLMYBl8dbPGuoaoglUoYSdfB8PENtxiW-kt4w/edit?slide=id.g374b4a56ed5_0_196#slide=id.g374b4a56ed5_0_196
The backleft.json, backright.json, frontleft.json, frontright.json, and swervedrive.json in the deploy/swerve directory have incorrect values! It is up to you to correct this code so that we can simulate the swerve drive! After you are done, you should be able to do the following:
Once you’ve filled in the required code, you can run the robot in simulation using the WPILib extension:
- Open the Command Palette in VS Code:
Ctrl+Shift+P(Windows) /Cmd+Shift+P(Mac). - Select
WPILib: Simulate Robot Code. - Choose the option: Sim GUI.
To control the robot simulation:
- In AS, open the "Robot Simulation" window (usually on the right or bottom).
- Under Joysticks, find the
Joysticks[0]slot. - Drag Keyboard 0 into
Joysticks[0](unless you have a physical controller connected).Joysticks[0],[1], etc., represent the slots used in your robot code (e.g.,new Joystick(0)).- Binding
Keyboard 0simulates a gamepad using your keyboard.
- Under Robot State, click “Teleoperated” to enable the robot.
W= Drive ForwardS= Drive BackwardA= Drive LeftD= Drive Right