Class Arena2026Rebuilt

java.lang.Object
org.ironmaple.simulation.SimulatedArena
org.ironmaple.simulation.seasonspecific.rebuilt2026.Arena2026Rebuilt

public class Arena2026Rebuilt extends SimulatedArena
  • Field Details

    • shouldClock

      protected boolean shouldClock
    • clock

      protected double clock
    • blueIsOnClock

      protected boolean blueIsOnClock
    • phaseClockPublisher

      protected DoublePublisher phaseClockPublisher
    • redActivePublisher

      protected BooleanPublisher redActivePublisher
    • blueActivePublisher

      protected BooleanPublisher blueActivePublisher
    • blueHub

      protected RebuiltHub blueHub
    • redHub

      protected RebuiltHub redHub
    • blueOutpost

      protected RebuiltOutpost blueOutpost
    • redOutpost

      protected RebuiltOutpost redOutpost
    • isInEfficiencyMode

      protected boolean isInEfficiencyMode
    • centerPieceBottomRightCorner

      protected static Translation2d centerPieceBottomRightCorner
    • redDepotBottomRightCorner

      protected static Translation2d redDepotBottomRightCorner
    • blueDepotBottomRightCorner

      protected static Translation2d blueDepotBottomRightCorner
  • Constructor Details

    • Arena2026Rebuilt

      public Arena2026Rebuilt()

      Creates an Arena for the 2026 FRC game rebuilt

      This will create an Arena with the ramp areas marked as inaccessible. If you would like to change that use Arena2026Rebuilt(boolean). Additionally due to performance issues the arena will not spawn all fuel by default. If you would like to change this use setEfficiencyMode(boolean)

    • Arena2026Rebuilt

      public Arena2026Rebuilt(boolean AddRampCollider)

      Creates an Arena for the 2026 FRC game rebuilt

      Due to the nature of maple sim they can not be fully simulated and so either must be non existent or treated as full colliders. This behavior can be changed with the AddRampCollider variable. Additionally due to performance issues the arena will not spawn all fuel by default. If you would like to change this use setEfficiencyMode(boolean)

      Parameters:
      AddRampCollider - Whether or not the ramps should be added as colliders.
  • Method Details

    • randomInRange

      public static double randomInRange(double variance)

      Generates a random number within a range centered on 0 with a variance set by the parameter.

      Parameters:
      variance - the length of range used to generate the random number.
      Returns:
      A random number in range.
    • addPieceWithVariance

      public void addPieceWithVariance(Translation2d piecePose, Rotation2d yaw, Distance height, LinearVelocity speed, Angle pitch, double xVariance, double yVariance, double yawVariance, double speedVariance, double pitchVariance)

      Adds a game piece too the arena with a certain random variance.

      This method is useful for certain spawners like the return cutes on the hub to prevent the game pieces from being returned to the exact same position every time.
      Parameters:
      info - the info of the game piece
      robotPosition - the position of the robot (not the shooter) at the time of launching the game piece
      shooterPositionOnRobot - the translation from the shooter's position to the robot's center, in the robot's frame of reference
      chassisSpeedsFieldRelative - the field-relative velocity of the robot chassis when launching the game piece, influencing the initial velocity of the game piece
      shooterFacing - the direction in which the shooter is facing at launch
      initialHeight - the initial height of the game piece when launched, i.e., the height of the shooter from the ground
      launchingSpeed - the speed at which the game piece is launch
      shooterAngle - the pitch angle of the shooter when launching
      xVariance - The max amount of variance that should be added too the x coordinate of the game piece.
      yVariance - The max amount of variance that should be added too the y coordinate of the game piece.
      yawVariance - The max amount of variance that should be added too the yaw of the game piece.
      speedVariance - The max amount of variance that should be added too the speed of the game piece.
      pitchVariance - The max amount of variance that should be added too the pitch of the game piece.
    • placeGamePiecesOnField

      public void placeGamePiecesOnField()
      Description copied from class: SimulatedArena

      Places Game Pieces on the Field for Autonomous Mode.

      This method sets up the game pieces on the field, typically in their starting positions for autonomous mode.

      It should be implemented differently for each season-specific subclass of SimulatedArena to reflect the unique game piece placements for that season's game.

      Specified by:
      placeGamePiecesOnField in class SimulatedArena
    • getGamePiecesPosesByType

      public List<Pose3d> getGamePiecesPosesByType(String type)
      Description copied from class: SimulatedArena

      Obtains the 3D Poses of a Specific Type of Game Piece.

      This method is used to visualize the positions of game pieces

      Also, if you have a game-piece detection vision system (wow!), this is the how you can simulate it.

      Both GamePieceOnFieldSimulation and GamePieceProjectile of the specified type will be included.

      Overrides:
      getGamePiecesPosesByType in class SimulatedArena
      Parameters:
      type - the type of game piece, as determined by the constructor of GamePieceOnFieldSimulation
      Returns:
      a List of Pose3d objects representing the 3D positions of the game pieces
    • simulationSubTick

      public void simulationSubTick(int tickNum)
      Description copied from class: SimulatedArena

      Processes a Single Simulation Sub-Tick.

      This method performs the actions for each sub-tick of the simulation, including:

      Overrides:
      simulationSubTick in class SimulatedArena
    • isActive

      public boolean isActive(boolean isBlue)

      Returns wether the specified team currently has an active HUB

      This function returns true during autonomous or when shouldClock (set by setShouldRunClock(boolean)) is false.
      Parameters:
      isBlue - Wether to check the blue or red alliance.
      Returns:
      Wether the specified alliance's HUB is currently active
    • setShouldRunClock

      public void setShouldRunClock(boolean shouldRunClock)

      Used to determine wether the arena should time which goal is active.

      When this is set too false both goals will always be set to active. Ths can be useful for testing or too simulate endgame.
      Parameters:
      shouldRunClock -
    • outpostDump

      public void outpostDump(boolean isBlue)

      Dumps game pieces from the specified outpost.

      This function will dump up to 24 game pieces, dependent on how many game pieces are currently stored in the outpost. For more manual control of the game pieces in the outpost use outpostThrow(boolean, Rotation2d, Angle, LinearVelocity). To have a human player attempt to throw a game piece into the hub use outpostThrowForGoal(boolean).
      Parameters:
      isBlue - wether to dump the blue or red outpost
    • outpostThrowForGoal

      public void outpostThrowForGoal(boolean isBlue)

      Attempts too throw a game piece at the specified goal.

      This method comes with variance built in (to simulate human inconsistency) and will therefore only hit about half the time. Additionally if the hub does not have game pieces stored this method will not do anything. If you would like to manually control how the human player throws game pieces use outpostThrow(boolean, Rotation2d, Angle, LinearVelocity)

      Parameters:
      isBlue - whether too throw for the blue or red HUB.
    • outpostThrow

      public void outpostThrow(boolean isBlue, Rotation2d throwYaw, Angle throwPitch, LinearVelocity speed)

      Throws a game piece from the outpost at the specified angle and speed.

      This method comes with variance built in (to simulate human inconsistency). Additionally if the hub does not have game pieces stored this method will not do anything. If you would like to have the human player throw at the hub use outpostThrowForGoal(boolean)

      Parameters:
      isBlue - Wether too throw from the blue or red OUTPOST.
      throwYaw - The yaw at which too throw the ball.
      throwPitch - The pitch at which too throw the ball.
      speed - The speed at which too throw the ball.
    • setEfficiencyMode

      public void setEfficiencyMode(boolean efficiencyMode)

      Determines wether the arena is in efficiency mode

      For changes too take effect call SimulatedArena.resetFieldForAuto().

      Efficiency mode reduces the amount of game pieces on the field too increase performance. MapleSim was not designed with 400 game pieces in mind and so can struggle with the large number of game pieces present in rebuilt.

      Parameters:
      efficiencyMode - Wether efficiency mode should be on or off.
    • getEfficiencyMode

      public boolean getEfficiencyMode()

      Returns wether or not the arena is in Efficiency mode

      For more information see setEfficiencyMode(boolean)
      Returns:
      Wether or not the Arena is in efficiency mode.