Package jsim.wpilib

Class SimulatedField.Builder

java.lang.Object
jsim.wpilib.SimulatedField.Builder
Enclosing class:
SimulatedField

public static final class SimulatedField.Builder extends Object
Builder for SimulatedField that allows customizing robot body dimensions, mass, and intake geometry. All fields default to the same values used by the simple constructor.
  • Method Details

    • withRobotSize

      public SimulatedField.Builder withRobotSize(double halfXMeters, double halfYMeters, double halfZMeters)
      Override the robot chassis half-extents (metres).
      Parameters:
      halfXMeters - half-length along X (forward/back)
      halfYMeters - half-width along Y (left/right)
      halfZMeters - half-height along Z
      Returns:
      this builder
    • withRobotMass

      public SimulatedField.Builder withRobotMass(double massKg)
      Override the robot mass.
      Parameters:
      massKg - total robot mass in kilograms
      Returns:
      this builder
    • withIntake

      public SimulatedField.Builder withIntake(double forwardMeters, double heightMeters, double radiusMeters)
      Override the intake geometry.
      Parameters:
      forwardMeters - distance from robot centre to intake point along the robot's X axis
      heightMeters - height of the intake point above the carpet
      radiusMeters - grab radius — any free piece within this distance is grabbable
      Returns:
      this builder
    • withEjectSpeed

      public SimulatedField.Builder withEjectSpeed(double xyMetersPerSec, double zMetersPerSec)
      Override the eject velocity.
      Parameters:
      xyMetersPerSec - forward speed in the robot's heading direction
      zMetersPerSec - upward loft speed
      Returns:
      this builder
    • build

      public SimulatedField build(Supplier<edu.wpi.first.math.kinematics.ChassisSpeeds> speedsSupplier, Supplier<edu.wpi.first.math.geometry.Pose2d> poseSupplier)
      Build the SimulatedField subsystem.
      Parameters:
      speedsSupplier - supplier of robot-relative chassis speeds
      poseSupplier - supplier of the current robot pose
      Returns:
      a new SimulatedField registered with the CommandScheduler