Python SDK /fastsim.extensions
class

ExtensionManager

静态类2 个方法
fastsim.extensions.ExtensionManager

Static manager that enables, wires, and provides access to all configured extensions.

enable_all_extensionsstaticmethod
@staticmethod def enable_all_extensions(sim: FastSim)None

Activate all extensions listed in the extension config.

参数名类型默认值说明
simFastSimThe active FastSim instance to hook extensions into.
Called automatically by setup_all_before_loop().
get_enabled_extensionstaticmethod
@staticmethod def get_enabled_extension(name: str)Extension

Retrieve a running extension instance by name.

参数名类型默认值说明
namestrExtension name as registered (e.g. 'benchmark', 'server').
Extension — The active Extension instance.
class

Extension

抽象类1 个方法
fastsim.extensions.extension.Extension继承自ABC

Abstract base class for all FastSim extensions.

Implement enable(sim) to hook into the FastSim lifecycle (register step callbacks, set up resources, etc.). Extensions are instantiated and enabled by ExtensionManager.

enablemethod
def enable(self, sim: FastSim)None

Activate the extension against the provided FastSim instance.

参数名类型默认值说明
simFastSimThe running FastSim instance.
class

DataCollector

3 个方法
fastsim.extensions.data_collector.DataCollector继承自Extension

Extension that collects observations from registered observers each tick.

enablemethod
def enable(self, sim: FastSim)None

Hook observers into the step loop.

参数名类型默认值说明
simFastSimThe running FastSim instance.
register_observermethod
def register_observer(self, observer: Observer)None

Add an Observer instance to the collection pipeline.

参数名类型默认值说明
observerObserverObserver to register.
register_from_configmethod
def register_from_config(self)None

Instantiate and register all observers defined in the extension config.

继承自Extension1
enablemethod
def enable(self, sim: FastSim)None

Activate the extension against the provided FastSim instance.

class

Recorder

1 个方法
fastsim.extensions.recorder.Recorder继承自Extension

Extension that records simulation data to a configured backend.

enablemethod
def enable(self, sim: FastSim)None

Initialize the backend and start recording on each tick.

参数名类型默认值说明
simFastSimThe running FastSim instance.
继承自Extension1
enablemethod
def enable(self, sim: FastSim)None

Activate the extension against the provided FastSim instance.

class

Replayer

1 个方法
fastsim.extensions.replayer.Replayer继承自Extension

Extension that replays previously recorded trajectory data into the simulation.

enablemethod
def enable(self, sim: FastSim)None

Load trajectory data and begin playback each tick.

参数名类型默认值说明
simFastSimThe running FastSim instance.
继承自Extension1
enablemethod
def enable(self, sim: FastSim)None

Activate the extension against the provided FastSim instance.

class

Benchmark

1 个方法
fastsim.extensions.benchmark.Benchmark继承自Extension

Extension that runs policy benchmark episodes and collects success metrics.

enablemethod
def enable(self, sim: FastSim)None

Wire the benchmark into the step loop and start episode management.

参数名类型默认值说明
simFastSimThe running FastSim instance.
继承自Extension1
enablemethod
def enable(self, sim: FastSim)None

Activate the extension against the provided FastSim instance.

class

Server

1 个方法
fastsim.extensions.server.Server继承自Extension

Extension that exposes a REST HTTP API for remote control of the simulation.

enablemethod
def enable(self, sim: FastSim)None

Start the HTTP server thread and register API routes.

参数名类型默认值说明
simFastSimThe running FastSim instance.
继承自Extension1
enablemethod
def enable(self, sim: FastSim)None

Activate the extension against the provided FastSim instance.

class

Policy

抽象类6 个方法
fastsim.extensions.benchmark.policy.Policy继承自ABC

Abstract base class for benchmark policies. Implement all abstract methods to create a custom policy.

A Policy defines the observe → preprocess → compute → postprocess pipeline that runs each benchmark episode. Override needs_observation() to control when observations are requested.

resetmethod
def reset(self)None

Reset internal policy state at the start of each episode.

warmupmethod
def warmup(self, benchmark_observation: Any)None

Perform any model warm-up using an initial observation.

参数名类型默认值说明
benchmark_observationAnyRaw observation from the benchmark environment.
needs_observationmethod
def needs_observation(self)bool

Return True if the policy requires a fresh observation this step.

bool — True to request a new observation, False to reuse the last.
preprocess_observationmethod
def preprocess_observation(self, benchmark_observation: Any)dict

Convert raw benchmark observation to a model-ready dict.

参数名类型默认值说明
benchmark_observationAnyRaw observation data.
dict — Preprocessed observation dict.
compute_actionmethod
def compute_action(self, observation: dict)dict

Run inference and return a raw action dict.

参数名类型默认值说明
observationdictPreprocessed observation dict.
dict — Raw action dict from the model.
postprocess_actionmethod
def postprocess_action(self, action: dict)BenchmarkAction

Convert raw model output to a BenchmarkAction ready for execution.

参数名类型默认值说明
actiondictRaw action dict from compute_action.
BenchmarkAction — The fully constructed action object.
class

Action

抽象类2 个方法
fastsim.extensions.action.Action继承自ABC

Abstract action executed by the task/benchmark system.

actmethod
def act(self)ActionResultStatus

Execute the action and return a result status.

ActionResultStatus — Result of action execution.
is_goal_satisfiedmethod
def is_goal_satisfied(self)bool

Return True if the post-condition goal of this action is met.

class

GraspAction

0 个方法
fastsim.extensions.action.GraspAction继承自Action

Close the gripper to grasp a target object.

继承自Action2
actmethod
def act(self)ActionResultStatus

Execute the action and return a result status.

is_goal_satisfiedmethod
def is_goal_satisfied(self)bool

Return True if the post-condition goal of this action is met.

class

MoveAction

0 个方法
fastsim.extensions.action.MoveAction继承自Action

Move the end-effector to a target pose.

继承自Action2
actmethod
def act(self)ActionResultStatus

Execute the action and return a result status.

is_goal_satisfiedmethod
def is_goal_satisfied(self)bool

Return True if the post-condition goal of this action is met.

class

ReleaseAction

0 个方法
fastsim.extensions.action.ReleaseAction继承自Action

Open the gripper to release a currently held object.

继承自Action2
actmethod
def act(self)ActionResultStatus

Execute the action and return a result status.

is_goal_satisfiedmethod
def is_goal_satisfied(self)bool

Return True if the post-condition goal of this action is met.

class

AcquireAction

0 个方法
fastsim.extensions.action.AcquireAction继承自GraspAction,MoveAction

Combined move-to + grasp action for acquiring an object.

该类通过继承使用,无独立方法文档。方法同GraspAction/MoveAction
class

PickAction

0 个方法
fastsim.extensions.action.PickAction继承自AcquireAction

Pick up an object from its current location.

该类通过继承使用,无独立方法文档。方法同AcquireAction
class

PlaceAction

0 个方法
fastsim.extensions.action.PlaceAction继承自ReleaseAction,MoveAction

Move to a target pose and release the held object.

该类通过继承使用,无独立方法文档。方法同ReleaseAction/MoveAction
class

PushAction

0 个方法
fastsim.extensions.action.PushAction继承自GraspAction,MoveAction

Push an object by contacting and driving it to a new location.

该类通过继承使用,无独立方法文档。方法同GraspAction/MoveAction
class

PullAction

0 个方法
fastsim.extensions.action.PullAction继承自AcquireAction

Pull an object toward the robot.

该类通过继承使用,无独立方法文档。方法同AcquireAction
class

InsertAction

0 个方法
fastsim.extensions.action.InsertAction继承自PlaceAction

Insert an object into a slot or receptacle.

该类通过继承使用,无独立方法文档。方法同PlaceAction
class

ClickAction

0 个方法
fastsim.extensions.action.ClickAction继承自PushAction

Click or press a button/switch by making contact and applying force.

该类通过继承使用,无独立方法文档。方法同PushAction
class

TwistAction

0 个方法
fastsim.extensions.action.TwistAction继承自AcquireAction

Grasp and rotate an object (e.g. turn a knob or open a jar).

该类通过继承使用,无独立方法文档。方法同AcquireAction
class

ActionFactory

静态类1 个方法
fastsim.extensions.action.ActionFactory

Static factory for creating Action instances from a config dict.

createstaticmethod
@staticmethod def create(action_type: str, config: dict)Action

Instantiate an Action by type name and config parameters.

参数名类型默认值说明
action_typestrRegistered action type name (e.g. 'pick', 'place').
configdictAction configuration parameters.
Action — Constructed Action instance.
class

Goal

抽象类1 个方法
fastsim.extensions.goal.Goal继承自ABC

Abstract goal condition evaluated after an action to determine task success.

is_satisfiedmethod
def is_satisfied(self)bool

Evaluate the goal condition and return True if it is met.

class

PoseGoal

0 个方法
fastsim.extensions.goal.PoseGoal继承自Goal

Goal satisfied when an entity reaches a target pose within a tolerance.

继承自Goal1
is_satisfiedmethod
def is_satisfied(self)bool

Evaluate the goal condition and return True if it is met.

class

OnTopGoal

0 个方法
fastsim.extensions.goal.OnTopGoal继承自Goal

Goal satisfied when a target object is resting on top of a reference object.

继承自Goal1
is_satisfiedmethod
def is_satisfied(self)bool

Evaluate the goal condition and return True if it is met.

class

InsideGoal

0 个方法
fastsim.extensions.goal.InsideGoal继承自Goal

Goal satisfied when a target object is contained inside a specified container.

继承自Goal1
is_satisfiedmethod
def is_satisfied(self)bool

Evaluate the goal condition and return True if it is met.

class

GoalFactory

静态类1 个方法
fastsim.extensions.goal.GoalFactory

Static factory for creating Goal instances from a config dict.

createstaticmethod
@staticmethod def create(goal_type: str, config: dict)Goal

Instantiate a Goal by type name and config parameters.

参数名类型默认值说明
goal_typestrRegistered goal type name (e.g. 'pose', 'on_top').
configdictGoal configuration parameters.
Goal — Constructed Goal instance.
class

Observer

抽象类1 个方法
fastsim.extensions.observer.Observer继承自ABC

Abstract data observer that collects state information each tick.

observemethod
def observe(self)Observation

Sample the current state and return an Observation.

Observation — Collected observation snapshot.
class

RobotObserver

0 个方法
fastsim.extensions.observer.RobotObserver继承自Observer

Observes robot joint positions, velocities, and EE pose.

继承自Observer1
observemethod
def observe(self)Observation

Sample the current state and return an Observation.

class

SensorObserver

0 个方法
fastsim.extensions.observer.SensorObserver继承自Observer

Observes raw data from a named sensor entity.

继承自Observer1
observemethod
def observe(self)Observation

Sample the current state and return an Observation.

class

ObjectObserver

0 个方法
fastsim.extensions.observer.ObjectObserver继承自Observer

Observes the pose and state of a named object entity.

继承自Observer1
observemethod
def observe(self)Observation

Sample the current state and return an Observation.

class

TaskObserver

0 个方法
fastsim.extensions.observer.TaskObserver继承自Observer

Observes task execution status (current action, progress, success flag).

继承自Observer1
observemethod
def observe(self)Observation

Sample the current state and return an Observation.

class

ObserverFactory

静态类1 个方法
fastsim.extensions.observer.ObserverFactory

Static factory for creating Observer instances from a config dict.

createstaticmethod
@staticmethod def create(observer_type: str, config: dict)Observer

Instantiate an Observer by type name and config parameters.

参数名类型默认值说明
observer_typestrRegistered observer type name (e.g. 'robot', 'sensor').
configdictObserver configuration parameters.
Observer — Constructed Observer instance.
class

Observation

1 个方法
fastsim.extensions.observer.Observation继承自dict

Dict-like container for a single observation snapshot from one or more observers.

Observation subclasses dict, so all standard dict operations are available. Keys are observer-defined channel names; values are the sampled data arrays or scalars.

mergemethod
def merge(self, other: Observation)None

Merge another Observation into this one (in-place union of keys).

参数名类型默认值说明
otherObservationObservation to merge.
class

Postprocessor

抽象类1 个方法
fastsim.extensions.postprocessor.Postprocessor继承自ABC

Abstract post-processing step applied to recorded trajectory data.

postprocessmethod
def postprocess(self, trajectory: Trajectory)None

Apply this post-processing step to a trajectory.

参数名类型默认值说明
trajectoryTrajectoryTrajectory to process.
class

ExportHdf5

0 个方法
fastsim.extensions.postprocessor.ExportHdf5继承自Postprocessor

Post-processor that exports trajectory data to an HDF5 file.

继承自Postprocessor1
postprocessmethod
def postprocess(self, trajectory: Trajectory)None

Apply this post-processing step to a trajectory.

class

ExportVideo

0 个方法
fastsim.extensions.postprocessor.ExportVideo继承自Postprocessor

Post-processor that renders recorded camera frames as an MP4 video.

继承自Postprocessor1
postprocessmethod
def postprocess(self, trajectory: Trajectory)None

Apply this post-processing step to a trajectory.

class

ExportPngDepth

0 个方法
fastsim.extensions.postprocessor.ExportPngDepth继承自Postprocessor

Post-processor that saves recorded depth frames as individual PNG images.

继承自Postprocessor1
postprocessmethod
def postprocess(self, trajectory: Trajectory)None

Apply this post-processing step to a trajectory.

class

ExportPreviewVideo

0 个方法
fastsim.extensions.postprocessor.ExportPreviewVideo继承自Postprocessor

Post-processor that produces a compact preview video from recorded data.

继承自Postprocessor1
postprocessmethod
def postprocess(self, trajectory: Trajectory)None

Apply this post-processing step to a trajectory.

class

PostprocessorFactory

静态类1 个方法
fastsim.extensions.postprocessor.PostprocessorFactory

Static factory for creating Postprocessor instances from a config dict.

createstaticmethod
@staticmethod def create(postprocessor_type: str, config: dict)Postprocessor

Instantiate a Postprocessor by type name and config parameters.

参数名类型默认值说明
postprocessor_typestrRegistered postprocessor type name (e.g. 'hdf5', 'video').
configdictPostprocessor configuration parameters.
Postprocessor — Constructed Postprocessor instance.
class

Backend

抽象类1 个方法
fastsim.extensions.backend.Backend继承自ABC

Abstract storage/transport backend used by Recorder to persist trajectory data.

writemethod
def write(self, trajectory: Trajectory)None

Write a trajectory to the backend.

参数名类型默认值说明
trajectoryTrajectoryTrajectory data to persist.
class

LocalFileSystemBackend

0 个方法
fastsim.extensions.backend.LocalFileSystemBackend继承自Backend

Saves trajectory data to the local filesystem.

继承自Backend1
writemethod
def write(self, trajectory: Trajectory)None

Write a trajectory to the backend.

class

Ros2Backend

0 个方法
fastsim.extensions.backend.Ros2Backend继承自Backend

Publishes trajectory data as ROS2 topic messages.

继承自Backend1
writemethod
def write(self, trajectory: Trajectory)None

Write a trajectory to the backend.

class

BackendFactory

静态类1 个方法
fastsim.extensions.backend.BackendFactory

Static factory for creating Backend instances from a config dict.

createstaticmethod
@staticmethod def create(backend_type: str, config: dict)Backend

Instantiate a Backend by type name and config parameters.

参数名类型默认值说明
backend_typestrRegistered backend type (e.g. 'local', 'ros2').
configdictBackend configuration parameters.
Backend — Constructed Backend instance.
class

TrajectoryTrack

2 个方法
fastsim.extensions.trajectory.TrajectoryTrack

A single named data stream (channel) within a trajectory.

Each TrajectoryTrack holds a sequence of timestamped samples for one observable (e.g. joint positions, camera frames). Multiple tracks combine to form a Trajectory.

appendmethod
def append(self, timestamp: float, data: Any)None

Append a timestamped sample to this track.

参数名类型默认值说明
timestampfloatSimulation time in seconds.
dataAnySample data (array, scalar, or dict).
get_samplesmethod
def get_samples(self)list

Return all samples as a list of (timestamp, data) tuples.

list — List of (timestamp, data) pairs.
class

Trajectory

3 个方法
fastsim.extensions.trajectory.Trajectory

Container for multiple TrajectoryTracks forming a complete episode recording.

add_trackmethod
def add_track(self, name: str, track: TrajectoryTrack)None

Register a named track into this trajectory.

参数名类型默认值说明
namestrChannel name for the track.
trackTrajectoryTrackTrack instance to add.
get_trackmethod
def get_track(self, name: str)TrajectoryTrack

Retrieve a named track.

参数名类型默认值说明
namestrTrack channel name.
TrajectoryTrack — The track associated with the given name.
get_track_namesmethod
def get_track_names(self)list

Return all registered track channel names.

list — List of track name strings.
class

TrajectoryLoader

静态类1 个方法
fastsim.extensions.trajectory.TrajectoryLoader

Loads Trajectory objects from a storage backend.

loadmethod
def load(self, source: str)Trajectory

Load a trajectory from a path or identifier.

参数名类型默认值说明
sourcestrFile path or backend identifier for the trajectory.
Trajectory — Loaded Trajectory object.