controller
¶
COMMAND_SUGGESTIONS
module-attribute
¶
COMMAND_SUGGESTIONS = (
"gen",
"run",
"seed ",
"trial ",
"watch",
"record",
"dojo",
"stop",
"help",
"explain ",
"generate",
"quit",
"runtime",
"run until time ",
"run until step ",
"pause",
"step ",
"speed ",
)
Command names offered as completions by the terminal UI.
Outcome
¶
Bases: StrEnum
How the most recent job ended.
-
Reference
mujoco_mojoutilslayersreloadedcontrollerControllerStatus
ControllerStatus
dataclass
¶
ControllerStatus(
state: RunState,
last_command: str,
seed: int | None,
trial_num: int,
playback_speed: float,
watch: bool,
record: bool,
last_duration: float | None,
last_outcome: Outcome | None,
)
Snapshot of everything the terminal UI shows about the session.
-
Reference
mujoco_mojoutilslayersreloadedtui
LogEvent
dataclass
¶
ReloadedSession
¶
Bases: Protocol
The slice of MojoReloaded the controller reads, writes, and calls.
-
Reference
mujoco_mojoutilslayersreloadedcontrollerReloadedController
ReloadedController
dataclass
¶
ReloadedController(
session: ReloadedSession,
backend: ViewerBackend,
*,
watch_path: Path = cwd(),
sink: EventSink = _discard,
)
Holds the state of a Reloaded session and turns commands into jobs, without knowing how either is displayed.
The terminal UI sends typed commands to submit and receives ControllerEvents through the sink. The sink is called from whichever thread produced the event (the caller of submit, the job thread, or the file watcher), so it must be thread safe.
-
Reference
mujoco_mojoutilslayersreloadedtuiReloadedApp
session
instance-attribute
¶
session: ReloadedSession
What the controller reads and changes, and whose generate_construct it runs.
watch_path
class-attribute
instance-attribute
¶
The directory watched for *.py changes when watching is on. Defaults to the current directory.
sink
class-attribute
instance-attribute
¶
sink: EventSink = field(default=_discard, kw_only=True)
Receives every ControllerEvent, from whichever thread produced it.
has_runtime
property
¶
has_runtime: bool
Whether the session was given a runtime function, i.e. whether run has anything to run.
paused
property
¶
paused: bool
Whether the run in progress is being held, which is what a viewer's pause button shows.
speed
property
¶
speed: float
The playback speed, which is what a viewer's speed slider shows.
rerun
¶
Runs the last command again, which is what a viewer's Reset and Reload buttons ask for. A run in progress has to be stopped first.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
help_entries
¶
Command and description pairs for the help screen.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
describe
¶
Says in one very short plain sentence what submitting text would do right now.
It only reads the session's state and changes nothing, so the terminal UI can call it on every keystroke.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
start
¶
Routes the session's own messages to the sink and starts the file watcher if enabled.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
shutdown
¶
Stops the watcher and any run in progress. Safe to call more than once.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
submit
¶
submit(text: str) -> None
Handles one line typed by the user. An empty line repeats the last command.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
on_file_change
¶
on_file_change(count: int) -> None
Reloads with the last command when watched source files change, unless a run is in progress.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
run
¶
run(arg: str = '') -> None
Generates and runs the runtime, or carries a paused run on.
arg is an optional speed followed by an optional target, as in 0.5, until time 3, or 0.5 until step 500. The speed is set first, so run 0.5 is a run at half speed, and the run pauses itself when it reaches the target. For a run that is already going it only changes the speed or sets the target.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
set_seed
¶
set_seed(arg: str) -> None
Sets the seed from text. An empty string, none, or null clears it. Refused while a run is in progress.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
set_trial
¶
set_trial(arg: str) -> None
Sets the trial number from text. Refused while a run is in progress.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
set_speed
¶
set_speed(arg: str) -> None
Sets the playback speed, without starting a run. 1.0 is real time and 0 runs as fast as possible. A run in progress picks the new speed up at its next step.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
| Python | |
|---|---|
pause
¶
Holds a run in progress at its next step.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
resume
¶
Lets a paused run carry on.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
toggle_pause
¶
Pauses a run that is going and resumes one that is paused, which is what a single pause key does.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
step
¶
step(arg: str = '') -> None
Advances a run in progress by arg steps, or by one if it is empty, and leaves it paused. A run that is going is paused first.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
toggle_record
¶
Turns telemetry recording on or off. Refused while a run is in progress.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
toggle_watch
¶
Turns reloading on file changes on or off. Refused while a run is in progress.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
speed_label
¶
A speed as it is written in the status bar and the log: manual for 0, which steps only on Enter, inf for as fast as the machine goes, and otherwise a multiple of real time such as 0.5x.
Source code in src/mujoco_mojo/utils/layers/reloaded/controller.py
connection_lines
¶
connection_lines(info: ConnectionInfo) -> list[str]
How to reach a browser viewer, as rich markup lines for the log: where to open it, how to forward its port from another machine, and the standing warning.