Skip to content

Rewrite Simulation Code on Formatted Branch#3

Open
Eddwal wants to merge 16 commits into
mainfrom
formatted-simimpl
Open

Rewrite Simulation Code on Formatted Branch#3
Eddwal wants to merge 16 commits into
mainfrom
formatted-simimpl

Conversation

@Eddwal

@Eddwal Eddwal commented Nov 27, 2025

Copy link
Copy Markdown
Contributor

This is a branch of formatting (not main, due to formatting issues merging onto main makes it appear that this rewrote the whole code repository rather than highlighting the changes), containing the code for drive simulation.

Current Features:

  • Swerve Module Simulation using CTRE motor simulation, including CAN chain delay, realistic motor controllers, and battery draw affect on drive
  • Drive simulation/orchestration with MapleSim
  • Gyro Simulation using MapleSim
  • Robot physics interactions with Reefscape field and game pieces using MapleSim
  • Camera simulation using PhotonSimulation
  • Ability to change between an OI and Xbox Controller for simulation teleop (done in Constants.java)
  • Simulation autonomous following
  • Layout files for simulation for Sim GUI, Advantage Scope, and Elastic
  • Simulation start up guide (sim-guide.md)

Bug Fixes:

  • The issue that the incorrect swerve module velocity was being measured but odometry was still correct was also happening in Sim. In the TalonFX module implementation, the field Drive Velocity Radians Per Second was getting set to the circumference of the wheel multiplied by the drive motor velocity in rotations per second, getting linear velocity per second rather than radians per second. This code diverged from the AdvantageKit template, in which drive velocity radians per second is set to Units.rotationsToRadians(driveVelocity.getValueAsDouble()). I changed the code back to this and the velocity started measuring correctly.

Current Issues:

  • Sim camera location is not configured, right now it's setup as an LL4
  • The simulation displays the KitBot rather than the actual robot. When I get a CAD of the actual bot I will fix this
  • The azimuth motor for Maple Sim is currently set as a Falcon500. When I set it to a Kraken the simulation breaks. I messaged the maple-sim team about this

@Eddwal

Eddwal commented Nov 27, 2025

Copy link
Copy Markdown
Contributor Author

Being able to deploy with the controller set to Xbox is somewhat dangerous, I'm thinking of adding a git pre-commit hook that ensures on commit it is set to OI

@Eddwal

Eddwal commented Nov 27, 2025

Copy link
Copy Markdown
Contributor Author

Expanding on that, automatically formatting on commit could be helpful for code consistency and making sure git diff shows actual diff

Base automatically changed from formatting to main December 3, 2025 02:58
@Eddwal

Eddwal commented Dec 19, 2025

Copy link
Copy Markdown
Contributor Author

FYI this all got merged in when autos was merged into main

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.

2 participants