signal_manager
¶
SignalManager
dataclass
¶
SignalManager(
export_path: Path,
target_buffer_bytes: int = 8 * 1024 * 1024,
record_decimation: int = 1,
unit_system: UnitSystem | None = None,
_buffer_row_idx: int = 0,
_step_count: int = -1,
_n_cols: int = 0,
)
-
Code Reference
mujoco_mojoruntimesignal_managerresolve_signal_manager
-
Code Reference
mujoco_mojo-
runtime-
ActuatorControlrequest -
BodyReactionForcerequest -
GeneralLoadrequest -
JointFrictionrequest -
PointToPointForcerequest -
RuntimeManager -
ScalarForcerequest -
ScalarTorquerequest -
SiteLoadrequest -
VectorForcerequest -
VectorTorquerequest -
load -
requirements_managerRequirementsManager -
runtime_managerRuntimeManager -
signal_managerresolve_signal_manager
-
-
utils
-
target_buffer_bytes
class-attribute
instance-attribute
¶
target_buffer_bytes: int = 8 * 1024 * 1024
Approximate in-memory buffer size, in bytes, before flushing to a part file. The actual row capacity is derived from this and the current column count (see _recompute_capacity), so flush frequency stays roughly memory/file-size bounded as signals are registered, rather than fixed at a row count regardless of width. Defaults to 8 MB.
record_decimation
class-attribute
instance-attribute
¶
record_decimation: int = 1
How many steps between each recording should be performed.
unit_system
class-attribute
instance-attribute
¶
When set, the time column's concrete unit is resolved from unit_system.time (e.g. "second", "millisecond"). Always tagged with dimension="[time]" regardless.
track
¶
Registers getter to be called and posted on every recorded step, under column.
getter is called fresh on every recorded step, so it should look up a value that changes over the course of the simulation (e.g. a variable updated each step, an attribute, or an indexing operation) rather than a constant computed once. If the underlying value never changes after registration, track will simply keep posting that same value every step.
Examples:
| Python Console Session | |
|---|---|
| Python Console Session | |
|---|---|
Source code in src/mujoco_mojo/runtime/signal_manager.py
post
¶
Injects a value into the telemetry ledger under column.
The column's name places the signal in a hierarchical namespace that the dashboard uses to build a navigable tree view. Its metadata is persisted into the telemetry file's footer, but only the first time a column with this name is registered (metadata on later columns with the same name is ignored).
This is called for every column on every timestep, so build each Column once and reuse it rather than constructing one per call. A Column with the same parts as one already seen still works, but is looked up by comparing its fields instead of by identity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
The numeric data to record. |
required |
column
|
Column
|
Where to record it: the category, subgroups, and attr that make up the column's name, plus its metadata. See |
required |
Examples:
| Python Console Session | |
|---|---|
| Python Console Session | |
|---|---|
Source code in src/mujoco_mojo/runtime/signal_manager.py
record
¶
record(state: MjState) -> None
Executes all samplers and advances the buffer index. Flushes if due.
Source code in src/mujoco_mojo/runtime/signal_manager.py
flush
¶
Writes the memory buffer to a new part file; parts are merged into export_path on close().
Source code in src/mujoco_mojo/runtime/signal_manager.py
resolve_signal_manager
¶
resolve_signal_manager(
signal_manager: SignalManager | None,
) -> SignalManager | None
Returns signal_manager if given, otherwise falls back to the SignalManager of the innermost enclosing RuntimeManager with block.
The result may still be None if that RuntimeManager simply has no SignalManager configured (telemetry recording disabled for this trial). Callers should treat None as "nothing to record to" rather than an error. Raises only if there is no active RuntimeManager context at all.