Repository navigation
Conversation
Mark2000
force-pushed
the
dev/markstph/simulation-task
branch
from
October 28, 2026 23:53
32633de to
3467d0b
Compare
Mark2000
force-pushed
the
dev/markstph/simulation-task
branch
3 times, most recently
from
November 6, 2026 18:20
5ebad2f to
f939004
Compare
The registry is shared by the simulator and the task, so it moves from holosoma.simulator.base_simulator.hooks to a module below both, holosoma/hooks.py, with its tests. frame_base_rates(sim_config) derives the per-phase base rates that every="30Hz" resolves against, replacing BaseSimulator._hook_base_rates. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plugins are constructed as cls(cfg, task) by BaseTask at the end of task setup, instead of cls(cfg, simulator) by BaseSimulator.install_plugins. BaseTask creates the HookRegistry and passes it to the simulator, which registers its own callbacks (sensor render, bridge, gantry, video, contact recording, backend close) on it; plugins register on task.hooks, the same object, and reach the backend through task.simulator. - BaseSimulator takes a required hooks argument and no longer keeps plugin configs or installs plugins. FullSimConfig drops its plugin field. - BaseTask builds plugins after its managers and reset manager, each in its slot's hooks.installing(key) scope, registers its pacing hooks after them so pacing still runs last each substep, then validates the registry. - Consumers validate env ids against task.num_envs. The shared ROS2 runtime is keyed on the task. Shutdown stays on the simulator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each layer emits the phases it owns on the shared registry: - BaseSimulator.simulate_at_each_physics_step() emits PRE_STEP before the substep and POST_STEP after it, so any caller of the physics step gets them. BaseTask's substep loop no longer emits them. - BaseTask emits CLOSE itself, on close() and when setup fails; BaseSimulator.close() is removed. A standalone simulator is closed by emitting CLOSE on the registry it was given. The unreachable simulator fallback in _close_environment goes with it. - The task still emits FRAME_BEGIN, FRAME_END and EPISODE_START/END; motion playback also emits EPISODE_* at clip boundaries, as before. Harnesses that emitted the physics phases by hand around the step stop doing so, since the step now emits them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shutdown stays on the simulator, so the playback harness and the classic MuJoCo playback test read simulator.shutdown_requested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mark2000
force-pushed
the
dev/markstph/task-owned-plugins
branch
from
November 13, 2026 18:58
ac1b862 to
c736484
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plugins now belong to the task rather than the simulator. The hook registry moves to a common module, and each phase is emitted by the layer that owns it: the simulator emits the physics phases, the task emits the task-level ones.
Summary
cls(cfg, task).BaseTaskconstructs each configured plugin at the end of task setup (after its managers and reset manager), each inside its slot'shooks.installing(key)scope, then validates the registry. A plugin can use any part of the task:task.hooks,task.simulator,task.num_envsand, for policy tasks, its managers. It used to becls(cfg, simulator)fromBaseSimulator.install_plugins().BaseTaskcreates theHookRegistryand passes it to the simulator, which takes a new requiredhooksargument and registers its own callbacks on it (sensor render, bridge, virtual gantry, video, contact recording, MuJoCo backend close). Plugins register ontask.hooks, the same object, and keep followingtask.simulator.sensor_render_hook, the bridge'stransport_hookand the ROS2 runtime'sclose_hook.holosoma.hooks(holosoma/hooks.py), below both the simulator and the task, instead ofholosoma.simulator.base_simulator.hooks.frame_base_rates(sim_config)derives the per-phase base rates thatevery="30Hz"resolves against.BaseSimulator.simulate_at_each_physics_step()emitsPRE_STEPbefore each physics substep andPOST_STEPafter it.BaseTaskemitsFRAME_BEGIN,FRAME_END,EPISODE_START/ENDandCLOSE; motion playback also emitsEPISODE_*at clip boundaries, as before.BaseTaskemitsCLOSEonclose()and when setup fails;BaseSimulator.close()is removed.install_plugins(),installed_pluginsandplugin_configare removed, and so isFullSimConfig.plugin. Plugins are read from the task config;task.installed_pluginsholds the instances. Consumers validate env ids againsttask.num_envs, and the shared ROS2 runtime is keyed on the task.task.simulator.request_shutdown(), polled bySimulationTask).Ordering
The resolved order on every phase is unchanged:
after=the handles they follow.CLOSEstill tears plugins down before the simulator's own resources.time_scalerate limiter) are registered after the plugins, so they still run last in each substep.Breaking changes for out-of-tree code
__init__(self, cfg, simulator)takestaskinstead: register ontask.hooks, reach the backend throughtask.simulator.Phase,HookRegistryand the rest of the hooks API import fromholosoma.hooks. The old path is removed, with no re-export.HookRegistryand closes it by emittingCLOSEon that registry.Commits
holosoma.hooks. A pure move plusframe_base_rates.CLOSEfrom the task.Testing
mypy .is clean (564 files).pytest -m no_simfrom the repo root, as CI runs it: 1,771 passed, 62 skipped.-m "mujoco and not multi_gpu"(MUJOCO_GL=egl): 318 passed, 34 skipped, plustest_kinematic_playback_classic.py(5 passed) re-run after commit 4.-m "isaacsim and not multi_gpu": 85 passed, 45 skipped.playback_assert.pypasses on MuJoCo classic (1 env), MuJoCo Warp (2 envs) and IsaacSim (2 envs).Test changes:
simulator/plugins/tests/_task.py::plugin_task().simulator/base_simulator/tests/test_plugins.pymoves toenvs/base_task/tests/test_plugin_install.pyand drives the realBaseTask._install_plugins(): plugins get the task, in config-key order, and slot scoping lets aHookRefbetween two plugins resolve. It previously drove a copy of the install loop.simulator/base_simulator/tests/test_base_simulator_init.pykeeps the real-BaseSimulatortests: sensors render before task plugins consume them, the empty sensor registry, andPRE_STEP→ step →POST_STEPin dynamics and kinematic mode.test_constructor_cleanup.py: plugins are built after the managers and reset manager, pacing hooks resolve after plugin hooks, and setup failure emitsCLOSE.test_frame_egress.py: the fake simulator emits the physics phases itself, as the real one does.launch_simulatorand drop theirinstall_plugins()calls.contact_substep_assertandstate_freshness_assertstop emitting the physics phases by hand. The classic MuJoCo playback test andplayback_assert.pyrun through aSimulationTask.🤖 Generated with Claude Code