Skip to content

Add tiptop-rerun CLI and extract run_tiptop - #16

Merged
williamshen-nz merged 29 commits into
mainfrom
will/tiptop-rerun
Jun 5, 2026
Merged

Add tiptop-rerun CLI and extract run_tiptop#16
williamshen-nz merged 29 commits into
mainfrom
will/tiptop-rerun

Conversation

@williamshen-nz

@williamshen-nz williamshen-nz commented Apr 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • New tiptop-rerun CLI re-runs TiPToP from a saved run directory (rgb, depth, intrinsics, metadata, gripper mask). Task instruction and planning params (num_particles, max_planning_time, opt_steps_per_skeleton) default to the original run's values but can be overridden via flags.
  • Extract run_tiptop() from tiptop_h5.py into a new tiptop/tiptop_offline.py module that takes an Observation and runs perception + planning. run_tiptop_h5 is now a thin wrapper, and run_tiptop_rerun reuses the same core. Split offline output dirs per command (tiptop_h5_outputs/, tiptop_rerun_outputs/).
  • Rename save_dirrun_dir in viz-tiptop-run for consistency with the new CLI.
  • Save the source tiptop.yml (via shutil.copy2, preserving comments) into each run dir for reproducibility, and have tiptop-rerun load it via a new set_tiptop_cfg_from_file() helper so downstream consumers see the original run's values. Falls back to the current config / built-in cuTAMP defaults with a warning when saved files are missing.
  • Simplify logging setup: root logger pinned at DEBUG, console handler level configurable per entrypoint. Per-run file handler captures DEBUG for post-mortem while console stays at INFO for tiptop-h5 / tiptop-rerun.
  • Replace assert with raise ValueError in run_tiptop() so input checks survive python -O.

Test plan

  • pixi run test-integration passes on the rebased branch
  • Syntax-checked tiptop_offline.py, config/__init__.py, utils.py
  • Smoke-tested the logging split: root=DEBUG, stdout=INFO, file=DEBUG → DEBUG records reach the file but not the console
  • Manually reviewed rerun path defaults with and without run_dir/tiptop.yml and run_dir/cutamp/config.yml present

🤖 Generated with Claude Code

williamshen-nz and others added 8 commits April 10, 2026 13:26
Extract run_tiptop() as a general-purpose function that takes an Observation
and runs perception + planning, making it reusable beyond H5 files. Add
tiptop_rerun.py which loads observations from saved run directories and feeds
them into run_tiptop, with planning parameters defaulting to the original
run's cuTAMP config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both viz_tiptop_run and tiptop_rerun load from a previous run directory,
so use run_dir consistently instead of save_dir.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add command reference documentation for the new tiptop-rerun CLI.
Update viz-tiptop-run docs to reflect the save-dir → run-dir rename
for consistency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both share run_tiptop() and only differ in how they load the observation.
Merging them into a single module reduces duplication and keeps all offline
(no real robot) pipeline code together.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both tiptop-h5 and tiptop-rerun now default to tiptop_offline_outputs/.
Simplify gitignore with tiptop_*_outputs/ glob to cover all variants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
More realistic to show rerunning from a live robot run directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Follows the run_tiptop / run_tiptop_h5 / run_tiptop_rerun naming pattern.
Also fixes stale tiptop_rerun_outputs default that was missed earlier.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
That's what TiPToP is — no need to spell it out every time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
williamshen-nz and others added 2 commits April 10, 2026 14:26
The module has two entrypoints (h5, rerun) — picking one for __main__
is misleading. Use the CLI commands instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Simplify tiptop_offline.py by removing unnecessary section divider
comments and inlining the 3-line _load_cutamp_config helper into its
sole caller.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@NishanthJKumar
NishanthJKumar marked this pull request as ready for review April 13, 2026 20:29
@NishanthJKumar
NishanthJKumar marked this pull request as draft April 13, 2026 20:37
@williamshen-nz
williamshen-nz requested a review from Copilot April 13, 2026 20:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates TiPToP’s offline execution paths by extracting a reusable run_tiptop() pipeline function and adding a new tiptop-rerun CLI to re-run from previously saved run directories.

Changes:

  • Added tiptop/tiptop_offline.py with run_tiptop(), plus tiptop-h5 and new tiptop-rerun CLI entrypoints.
  • Removed the old tiptop/tiptop_h5.py implementation and rewired entrypoints/tests to the new module.
  • Updated run visualization CLI/docs to use run_dir naming and documented the new tiptop-rerun command.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tiptop/tiptop_offline.py New shared offline pipeline + H5 loader + rerun loader/CLI entrypoints
tiptop/tiptop_h5.py Deleted legacy H5-only runner in favor of consolidated offline module
tiptop/scripts/viz_tiptop_run.py Renamed CLI arg to run_dir and made point cloud logging static
tests/test_tiptop_h5.py Updated import path for run_tiptop_h5
pyproject.toml Added tiptop-rerun entrypoint and repointed tiptop-h5 to new module
docs/command-reference.md Updated tiptop-h5 defaults and added tiptop-rerun docs + run_dir rename
.gitignore Generalized ignore pattern for tiptop_*_outputs/

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tiptop/tiptop_offline.py Outdated
Comment thread tiptop/tiptop_offline.py
Comment thread tiptop/tiptop_offline.py Outdated
Comment thread tiptop/tiptop_offline.py Outdated
Comment thread tiptop/tiptop_offline.py
- Replace asserts in run_tiptop() with explicit ValueError so validation
  survives python -O
- Fix H5 loader docstring: pi-sim-evals -> droid-sim-evals to match the
  rest of the docs
- run_tiptop_rerun now loads the saved tiptop.yml from the run directory
  via new set_tiptop_cfg_from_file() helper, so downstream tiptop_cfg()
  consumers see the original run's robot/perception settings instead of
  drifting with the local config
Older runs (or runs where planning failed before the config was written)
may not have a cutamp/config.yml. Instead of hard-failing, run_tiptop_rerun
now warns and uses the same defaults as tiptop-h5. Defaults are lifted
into module-level constants so both entrypoints share a single source of
truth.
Comment thread docs/command-reference.md Outdated
Comment thread tiptop/tiptop_offline.py Outdated
Comment thread tiptop/tiptop_offline.py Outdated
- Split offline output dirs per command: tiptop-h5 -> tiptop_h5_outputs,
  tiptop-rerun -> tiptop_rerun_outputs. Both still covered by the
  tiptop_*_outputs/ gitignore glob. Easier to tell at a glance which
  command produced which run.
- Drop DEFAULT_* module-level constants; inline 60.0/500/256 in
  run_tiptop_h5 signature and in the rerun fallback with a comment
  pointing at tiptop-h5 as the source of truth. Matches the
  magic-number pattern used in tiptop_run.py.
- Make console and file log levels separable: setup_logging now pins
  its stdout handler to the requested level explicitly, and
  add_file_handler lowers the root logger when the file handler is
  more verbose. Net for tiptop-h5 / tiptop-rerun: console stays at
  INFO, the run log captures DEBUG detail for post-mortem.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tiptop/utils.py Outdated
Comment thread tiptop/tiptop_offline.py
Comment thread tiptop/tiptop_offline.py
williamshen-nz and others added 5 commits April 21, 2026 15:50
Split logging responsibilities cleanly: `setup_logging()` + banner are now
called once per entrypoint (`h5_entrypoint`, `rerun_entrypoint`) with
`root_level=DEBUG` so the later-added file handler captures debug, while
the stdout handler stays at INFO. `add_file_handler` / `remove_file_handler`
are back to simple add/remove pairs with no root-level juggling.

`save_run_outputs` now writes the effective merged OmegaConf to
`run_dir/tiptop.yml` instead of copying the file on disk, so CLI overrides
are captured and reproducible via `tiptop-rerun`.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Drop the `root_level` parameter. Root is pinned at DEBUG so later-added
handlers (per-run file handler) can filter at their own level — the
standard Python logging idiom per the cookbook. `level` only controls
the stdout console handler, which is what callers actually care about.

Net effect across call sites:
- `tiptop-h5` / `tiptop-rerun`: console=INFO, file=DEBUG (unchanged)
- `tiptop_run`: setup_logging(DEBUG) → console=DEBUG, file=DEBUG (unchanged)
- `tiptop_websocket_server`: setup_logging() → console=INFO, file now
  correctly captures DEBUG (was silently dropped before)
- All script entrypoints: identical console output (no file handler)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ents

`tiptop_cfg()` and `set_tiptop_cfg_from_file()` now stash the source path
alongside the cached config, exposed via `get_tiptop_cfg_path()`.
`save_run_outputs` uses `shutil.copy2` on that cached path so:

- Comments and formatting in `tiptop.yml` are preserved in the run dir.
- Rerun-of-a-rerun chains forward the original source file correctly
  (previously the hardcoded `tiptop_config_path` would always copy the
  repo default, masking the actual config used).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Keep `_cached_cfg` and `_cached_cfg_path` in sync via a single
`_load_and_cache()` helper so both globals can only be set together.
`tiptop_cfg()` and `set_tiptop_cfg_from_file()` become thin wrappers.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Only referenced inside config/__init__.py now — callers go through
get_tiptop_cfg_path(), which respects set_tiptop_cfg_from_file() overrides.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
williamshen-nz and others added 3 commits April 21, 2026 21:32
Only one reference now — no reason to keep a module-level variable.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Drop the private `_load_and_cache` helper; `set_tiptop_cfg_from_file`
is the cache mutator, and `tiptop_cfg` delegates to it for the default
path. One function, not two, does the work.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tiptop/recording.py
williamshen-nz and others added 3 commits April 21, 2026 21:51
All entrypoints use tyro; no one feeds CLI args into OmegaConf, so the
merge was a no-op. Removing it makes the loader's behaviour honest and
confirms the cached cfg always equals the source file.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tiptop/tiptop_offline.py
Comment thread tiptop/config/__init__.py
@williamshen-nz
williamshen-nz marked this pull request as ready for review April 22, 2026 02:09
williamshen-nz and others added 2 commits May 30, 2026 18:21
Document all changes since v0.1.0, including the breaking CLI/API
changes (viz-tiptop-run --save-dir -> --run-dir, tiptop_cfg() dropping
force_reload and OmegaConf.from_cli) and the new tiptop-rerun CLI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread tiptop/tiptop_offline.py
Comment thread tiptop/tiptop_offline.py
Comment thread CHANGELOG.md
…released

Address PR #16 feedback on changelog hygiene:
- Convert #NN references to reference-style links that work in rendered md
- Collect the two breaks into a dedicated Breaking Changes section
- Set the release date instead of "Unreleased" (tagged on merge)
- Verified coverage of all PRs since v0.1.0 (#14, #19, #20, #21, #23, #26, #27)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.

@williamshen-nz
williamshen-nz merged commit 371374d into main Jun 5, 2026
1 check passed
@williamshen-nz
williamshen-nz deleted the will/tiptop-rerun branch June 5, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants