Package frc.rebuilt

Class RobotBumpSim

java.lang.Object
frc.rebuilt.RobotBumpSim

public class RobotBumpSim extends Object
Bump physics for the 2026 REBUILT field, to run alongside MapleSim. Tracks the robot's Z height, pitch, and roll over the raised bumps, and takes over field X while the robot is on a ramp so it slides back rather than ghosting through.

Cresting a bump needs 1.8 m/s, from sqrt(2 * g * 0.165).

While isOnRamp() is true the caller must push getSimWorldPose(edu.wpi.first.math.geometry.Pose2d) into MapleSim. Positions are in metres, with the origin at the blue alliance driver-station corner.

  • Constructor Details

    • RobotBumpSim

      public RobotBumpSim(Translation2d[] moduleOffsets)
      Parameters:
      moduleOffsets - robot-relative module positions, in FL, FR, BL, BR order (metres).
  • Method Details

    • isOnRamp

      public boolean isOnRamp()
      While this returns true the caller must push getSimWorldPose(edu.wpi.first.math.geometry.Pose2d) into MapleSim, so the robot slides back instead of only appearing to.
    • getSimWorldPose

      public Pose2d getSimWorldPose(Pose2d latestMaplePose)
      X comes from the ramp model; Y and rotation pass through from latestMaplePose so MapleSim keeps owning lateral motion.
      Returns:
      the pose to pass to setSimulationWorldPose
    • update

      public Pose3d update(Pose2d robotPose2d, ChassisSpeeds fieldRelativeSpeeds, int subticks)
      Advances the sim by one PERIOD and returns the robot's 3D pose. X is the ramp model's position while on the ramp, so the caller must also push getSimWorldPose(edu.wpi.first.math.geometry.Pose2d) into MapleSim.
      Parameters:
      subticks - physics sub-steps per period, which must match the value a companion ball sim uses. 5 gives 4 ms sub-steps in a 20 ms loop
      Returns:
      the robot's 3D pose