System Rules:
- Single source of truth for all simulation state.
- Only system allowed to mutate FieldState<T>.
- External APIs are read/write proxies ONLY through defined methods.
◆ getFieldElements()
| synchronized List< FieldElement > jsim.api.StateManager.getFieldElements |
( |
| ) |
|
|
inline |
Returns an immutable view of the current field elements registered in the simulation.
- Returns
- unmodifiable list of field elements
◆ getInstance()
| StateManager jsim.api.StateManager.getInstance |
( |
| ) |
|
|
inlinestatic |
◆ getPhysicsWorld()
| synchronized PhysicsWorld jsim.api.StateManager.getPhysicsWorld |
( |
| ) |
|
|
inline |
Returns the active physics world used by the simulation layer.
- Returns
- the current physics world, or
null if none is registered
◆ getRobot()
Returns the simulated robot registered for the given driver-station id.
- Parameters
-
- Returns
- the registered robot, or
null if none exists
◆ getRobotBody()
Returns the physics body associated with the given robot id.
- Parameters
-
- Returns
- the tracked physics body, or
null if none exists
◆ getRobotPoses()
| Map< RobotID, Pose2d > jsim.api.StateManager.getRobotPoses |
( |
| ) |
|
|
inline |
Returns a snapshot of all registered robot poses keyed by robot id.
- Returns
- immutable map of robot ids to poses
◆ initializeField()
| void jsim.api.StateManager.initializeField |
( |
FieldConfig | config | ) |
|
|
inline |
Loads JSON field definition and builds all FieldElements and collision zones.
- Parameters
-
| config | The field configuration to initialize. |
◆ initializeRobot()
| SimRobot jsim.api.StateManager.initializeRobot |
( |
RobotID | id, |
|
|
Pose2d | startingPose, |
|
|
Translation2d[] | frameVertices ) |
|
inline |
Creates a robot instance, assigns starting pose, and registers it in the simulation.
- Parameters
-
| id | The RobotID for the robot. |
| startingPose | The initial pose of the robot. |
| frameVertices | The vertices of the robot's frame. |
- Returns
- the initialized SimRobot instance.
◆ registerGamepieceZone()
| synchronized void jsim.api.StateManager.registerGamepieceZone |
( |
GamepieceZone | gamepieceZone | ) |
|
|
inline |
Registers a gamepiece zone to be refreshed on each simulation step.
- Parameters
-
| gamepieceZone | the zone to register |
◆ reset()
| synchronized void jsim.api.StateManager.reset |
( |
| ) |
|
|
inline |
Clears all tracked simulation state and detaches the active physics world.
Primarily used by tests to ensure deterministic, isolated state between runs.
◆ setPhysicsVelocity()
| synchronized void jsim.api.StateManager.setPhysicsVelocity |
( |
RobotID | id, |
|
|
ChassisSpeeds | speeds ) |
|
inline |
Applies a chassis-speed command to the physics body registered for the given robot id.
- Parameters
-
| id | the robot identifier |
| speeds | the commanded chassis speeds |
◆ setPhysicsWorld()
| synchronized void jsim.api.StateManager.setPhysicsWorld |
( |
PhysicsWorld | physicsWorld | ) |
|
|
inline |
Stores the active physics world used by the simulation layer.
- Parameters
-
| physicsWorld | the physics world to store |
◆ setRobotBody()
| synchronized void jsim.api.StateManager.setRobotBody |
( |
RobotID | id, |
|
|
PhysicsBody | robotBody ) |
|
inline |
Associates a native physics body with a robot id.
- Parameters
-
| id | the robot identifier |
| robotBody | the physics body to store, or null to clear the mapping |
◆ stepPhysics()
| synchronized void jsim.api.StateManager.stepPhysics |
( |
| ) |
|
|
inline |
Advances the tracked physics world and refreshes gamepiece zones.
The documentation for this class was generated from the following file: