Maple-sim Alpha: Bringing Robot Simulations to the Next Level with Physics Engines

Will the new release include a modified AdvantageKit Talon FX template with maple-sim?

1 Like

Yes, the AdvantageKit TalonFX template with maple-sim is already here.

I will update the dependencies to latest 2025 version (including wpilib, path planner and maple-sim).

3 Likes

Maple-Sim Beta 2: Reefscape!

As teams DIVE IN to the new Reefscape season, we are excited to present the latest release of Maple-Sim!

New Season, New Game



With the updated playing field and game elements, Maple-Sim is fully equipped to power your software development for the new season! Check out the Reefscape Simulation Notes for detailed information on season-specific simulations for the 2025 game.

What’s Changed

Full Changelog: Comparing v0.2.8...v0.3.0 · Shenzhen-Robotics-Alliance/maple-sim · GitHub

What’s Next?

The following will be available later this week:

Note: This is Maple-Sim’s first season. The development process will continue as teams use it throughout the season. Expect occasional instability, bugs, and API changes as we deliver updates. If you have any questions or concerns, please feel free to contact us on discord or submit an issue on GitHub—we’re here to help!

7 Likes

Are there any plans to add python support?

Currently, maplesim uses dyn4j, which is a java library, so python/c++ support isn’t possible as of now. I’m not sure if catrix is considering it at a later time, however.

This is really cool!
Is it possible that when algae is scored in the net, it will stay there instead of disappear – and possibly interact with other algae already in the net?

2 Likes

Excited to use this with yagsl. Any way to allow for coral to go down the station in either orientation?

1 Like

Unfortunately, as @Daniel1464 mentioned, Maple-Sim cannot support Python due to the limitations of the libraries it is based on.

Yes, that’s definitely possible! We could use the Dyn4j physics engine to simulate the interactions between algae when they are in the NET. However, I might not have time to work on that this week. It would be awesome if you could implement that yourself and submit a pull request!

Yes, you can use SimulatedArena.getInstance().addGamePiece() in your user code to achieve that.

Note that when placing algae (which is a ball), you only need to specify the position. For coral, however, both position and orientation need to be specified.

SimulatedArena.getInstance().addGamePiece(new ReefscapeAlgaeOnField(
    new Translation2d(2,2)
));
SimulatedArena.getInstance().addGamePiece(new ReefscapeCoral(
    // places the coral in 45-deg angle
    new Pose2d(2, 2, Rotation2d.fromDegrees(45))
));
3 Likes

v0.3.1: Some Small Improvement

Akit swerve template upgrades

Upgraded all AdvantageKit Swerve Templates to their latest version as being published in the AdvantageKit Kickoff release, and upgraded maple-sim in these templates to latest version.

Coral-Algae stack improvements

  1. Improved the way users visualize the Algae-Coral stacks. Previously, users had to call
    Logger.recordOutput("FieldSimulation/StackedAlgae", 
        ReefscapeCoralAlgaeStack.getStackedAlgaePoses());
    
    to visualize algae in the stack.
    Now, all the algae and coral in the stack will be displayed automatically when calling
    Logger.recordOutput("FieldSimulation/Algae", 
        SimulatedArena.getInstance().getGamePiecesArrayByType("Algae"));
    Logger.recordOutput("FieldSimulation/Coral", 
        SimulatedArena.getInstance().getGamePiecesArrayByType("Coral"));
    
  2. IntakeSimulations that intakes “Coral” or “Algae” game pieces can now interact with the stack.
    • When an activated IntakeSimulation that intakes “Coral” contacts with a Coral-Algae stack, the CORAL is obtained by the intake and the ALGAE will automatically fall to the ground.
    • When an activated IntakeSimulation that intakes “Algae” contacts with a Coral-Algae stack, the ALGAE is obtained by the intake and the CORAL will automatically fall to the ground.

Self-controlled module simulation SysId function

Two functions have been added to SelfControlledModuleSimulation:

  1.  runDriveMotorCharacterization(Rotation2d desiredModuleFacing, double volts)
    
  2.  runSteerMotorCharacterization(double volts)
    

This will allow users to run SysId characterizations on drive and steer motors during simulation!

Changelog

  • Update build.gradle by @thenetworkgrinch in #81
  • Akit swerve template upgrades in #83
  • Coral-Algae stacks improvements in #83
  • SysId for SelfControlledModuleSimulation in #83

Full Changelog: Comparing v0.3.0...v0.3.1 · Shenzhen-Robotics-Alliance/maple-sim · GitHub

4 Likes

Can you explain a bit more about the difference between the regular CTRE template and the Enhance one?

Absolutely! The difference lies in how they simulate motor behavior.

The swerve templates run closed loops on motors. However, since there is no actual motor during the simulation, we must simulate how motor controllers execute user commands.

The regular swerve template uses PIDController and SimpleMotorFeedforward from WPILib to simulate motor controllers. While this mimics the behavior, it’s not 100% accurate.

The enhanced template, however, uses Phoenix 6’s simulation feature for a more accurate simulation of CTRE motor controllers, closely matching real-world performance.

TL;DR: The regular template is enough, use the enhanced one for a more accurate simulation.

1 Like

Join Our Discord Server (PermanentLink)

For further discussion on development or to get help, please join our Discord community:Maple-Sim

3 Likes

CTRE Generated Swerve Project with Maple-Sim - Finally Here!

:pray: This work is inspired by and based on Team 5104 “The Breakerbots”'s Custom Library - BreakerLib. Thank you, @Roman-Tech-Plus, for your creativity and generosity!

Why did it take so long?

We started in late November, so you might wonder why we're only releasing it now in January.

Alright, I'll admit it—one big reason was my laziness (LMAO).

We also ran into technical challenges with internal bugs in PhoenixLib, which caused motor simulation failures. To make matters worse, the CTRE Swerve API and Phoenix library function like black boxes. Without access to intermediate variables, debugging the simulation was a tough task.

Fortunately, most of the simulation bugs were resolved during PhoenixLib's kickoff. While a few small glitches remain, they can be avoided by tweaking some configurations during simulation.

TL;DR: I was lazy, and we faced technical challenges, but we nailed it! (YEAH! :tada:)


Thank you for your patience, and sorry for the long wait!

For guidance on installation and usage, please visit the Project Page.

We’ve also upgraded WPILib and PathPlanner to their latest versions across all template projects. The AdvantageKit Talon Swerve Template with enhanced CTRE simulation is now fully ready for use! Check out our template projects.

11 Likes

@catrix Hey! My laziness helped (or rather hindered) too!

1 Like