JSim 2026.06.01-p(1)
Loading...
Searching...
No Matches
jsim.api.SimRobot Class Reference

Classes

class  RobotState

Public Member Functions

GamepieceZone createGamepieceZone (String name, Transform3d[] zoneDimensions, Rotation3d robotRotation)
GamepieceZone getGamepieceZone (String name)
Map< String, GamepieceZonegetGamepieceZones ()
Pose2d getPose ()
Pose2d getOdometryPose ()
Translation2d[] getFrameVertices ()
ChassisSpeeds getVelocity ()
void resetPose (Pose2d pose)
void setChassisSpeeds (ChassisSpeeds speeds)
void update (double dtSeconds)
RobotID getRobotID ()

Static Public Member Functions

static SimRobot createRobot (RobotID id, Translation2d[] frameDimensions)
static SimRobot getRobot (RobotID id)

Protected Member Functions

 SimRobot (RobotID id, FieldState< RobotState > stateRef)

Detailed Description

External interface for simulated FRC Robots interacting with JSim.

Constructor & Destructor Documentation

◆ SimRobot()

jsim.api.SimRobot.SimRobot ( RobotID id,
FieldState< RobotState > stateRef )
inlineprotected

Protected constructor. Use SimRobot.createRobot().

Parameters
idThe RobotID for this robot.
stateRefThe field state reference for this robot.

Member Function Documentation

◆ createGamepieceZone()

GamepieceZone jsim.api.SimRobot.createGamepieceZone ( String name,
Transform3d[] zoneDimensions,
Rotation3d robotRotation )
inline

Creates a gamepiece zone tied to this robot.

Parameters
namethe zone name used for retrieval
zoneDimensionsthe zone polygon dimensions relative to the robot center
robotRotationthe zone rotation relative to the robot
Returns
a new zone registered for simulation refreshes
Exceptions
IllegalArgumentExceptionif a zone with the same name already exists

◆ createRobot()

SimRobot jsim.api.SimRobot.createRobot ( RobotID id,
Translation2d[] frameDimensions )
inlinestatic

Initializes a new robot via the unified StateManager tracking system.

Parameters
idThe logical driver station id.
frameDimensionsTranslation2d[] for each vertex of the frame perimeter
Returns
the instantiated SimRobot handle.

◆ getFrameVertices()

Translation2d[] jsim.api.SimRobot.getFrameVertices ( )
inline

Returns the robot frame perimeter vertices used to build the robot body.

Returns
cloned frame perimeter vertices

◆ getGamepieceZone()

GamepieceZone jsim.api.SimRobot.getGamepieceZone ( String name)
inline

Retrieves a previously created gamepiece zone by name.

Parameters
namethe zone name
Returns
the registered zone, or null if none exists

◆ getGamepieceZones()

Map< String, GamepieceZone > jsim.api.SimRobot.getGamepieceZones ( )
inline

Returns all gamepiece zones registered on this robot.

Returns
an immutable view of the named zones

◆ getOdometryPose()

Pose2d jsim.api.SimRobot.getOdometryPose ( )
inline

Retrieves the current odometry pose. This is always the commanded pose, not the physics body pose. Used internally for syncing with the physics engine.

Returns
the current odometry pose of the robot.

◆ getPose()

Pose2d jsim.api.SimRobot.getPose ( )
inline

Retrieves the current field-relative physics pose when physics is attached. Falls back to the commanded pose until a physics body is registered.

Returns
the current pose of the robot.

◆ getRobot()

SimRobot jsim.api.SimRobot.getRobot ( RobotID id)
inlinestatic

Retrieves a previously created robot by driver-station id.

Parameters
idthe robot identifier
Returns
the registered robot, or null if none exists

◆ getRobotID()

RobotID jsim.api.SimRobot.getRobotID ( )
inline

Gets the RobotID for this robot.

Returns
the RobotID assigned to this robot.

◆ getVelocity()

ChassisSpeeds jsim.api.SimRobot.getVelocity ( )
inline

Returns the robot's current measured chassis velocity when physics is attached. Falls back to the last commanded chassis speeds until a body is registered.

Returns
the current chassis velocity snapshot

◆ resetPose()

void jsim.api.SimRobot.resetPose ( Pose2d pose)
inline

Hard overrides the state manager's simulation pose for this robot.

Parameters
posethe new pose to set for the robot.

◆ setChassisSpeeds()

void jsim.api.SimRobot.setChassisSpeeds ( ChassisSpeeds speeds)
inline

Applies commanded speeds to the physics solver.

Parameters
speedsthe chassis speeds to apply.

◆ update()

void jsim.api.SimRobot.update ( double dtSeconds)
inline

Advances the robot state by one simulation tick.

Parameters
dtSecondstimestep in seconds

The documentation for this class was generated from the following file: