Skip to content

refactor(robocasa): switch env_server to rlinf Robocasa365Env - #83

Draft
qurakchin wants to merge 7 commits into
RLinf:mainfrom
qurakchin:adapt/robocasa_5
Draft

refactor(robocasa): switch env_server to rlinf Robocasa365Env#83
qurakchin wants to merge 7 commits into
RLinf:mainfrom
qurakchin:adapt/robocasa_5

Conversation

@qurakchin

Copy link
Copy Markdown
Collaborator

Summary

  • Replace direct robocasa/robosuite usage in robots/robocasa/env_server.py with rlinf's Robocasa365Env wrapper. The raw env now lives in an rlinf subprocess (RobocasaSubprocEnv); the facade translates env.* RPC calls into Robocasa365Env method calls.
  • Add _resolve_rlinf_repo_path() (env var → sibling rlinf → in-repo rlinf_robocasa) and mirror it onto PYTHONPATH so macOS spawn'd workers can import rlinf.
  • Build the Robocasa365Env OmegaConf cfg in build_env_cfg(); --split all maps to pretrain. Fall back to max_episode_steps=600 when --max-episode-steps=0 so the episode_horizon_source validation passes.

Depends on

Blocks on #82 landing first. This branch is built on top of #82 (refactor(rpc): add per-client session isolation + lock-protected dispatch) and the new env_server relies on the RPC facade shape introduced there. Do not merge until #82 is in main.

Test plan

  • Launch env_server.py against a RoboCasa365 task and verify reset/step/render_raw round-trip via RPC.
  • Confirm RLDX_RESET_SEED reproduces the fullshot eval scene (paired comparison).
  • Verify --cuda-device pins EGL + torch on multi-GPU boxes without crashing.

qurakchin and others added 7 commits August 11, 2026 01:51
…ll docs

  - Split `_init_runtime` into `init_shared_runtime` (session VLA) and
    `init_task_runtime` (task env) with a dashboard spec, matching the
    LIBERO pattern; `_init_runtime` stays as the CLI fallback.
  - Thread `check_cancelled` through primitives/rldx_skill/toolkit so an
    interrupted tool stops promptly instead of draining the episode.
  - Pin torch/torchvision/numpy/transformers/rldx in the robocasa extra;
    relax protobuf to <4 for tianshou.
  - Switch vla_server to CUDA_VISIBLE_DEVICES pinning (RLDX hardcodes
    device=0 internally now).
  - Rewrite robocasa install docs (prereqs, 3-step post-install, RLDX-1
    checkpoint, 50-task list); trim installation.rst to a pointer.
  - Remove obsolete scripts/robocasa/ and tests/test_api_dashboard_session.py.
Rebase onto main brought RLinf#73's EnvState + Toolkit.get_env_state
abstraction; LIBERO was adapted upstream but RoboCasa still used
hand-rolled flat-file IO (_append_state/_load_states/_load_image)
and a manual _step dispatcher. This puts RoboCasa on the same
EnvState + StepRecord + _publish_step path so the dashboard frame /
action-video / timeline wiring works for both envs.

- toolkit.py: rewrite to mirror libero — EnvState bound in __init__,
  _FRAME_ARTIFACTS {camera, wrist}, get_env_state() captures frame
  slice + dumps state + writes action_{}.mp4 via env_state.save,
  init_primitives_clean() publishes step 0 + success_criteria.md,
  close() flushes episode.mp4, write_recipe() reads state.records()
- tools.py: dump_state(primitives, env_state, log) goes through
  env_state.record_step + _save_observation_artifacts +
  _prune_heavy_artifacts (npy pruning via artifact_path().unlink);
  readonly perception tools take state: EnvState kwarg;
  write_recipe_from_states(state, tag) walks state.records()
- primitives.py: replace save_frame_slice / stop_recording_and_save
  with frame_slice / stop_recording; drop dump_state(step_idx) file
  writes; add current_state_dict(); dump_success_criteria() returns
  text for the toolkit to save
- __init__.py: drop video_path from get_toolkit (callers never
  passed it)
- delete legacy file-protocol driver (interactive_driver.py,
  main_robocasa.py) — superseded by the centralized Toolkit path

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: qurakchin <czzcy3832515@hotmail.com>
Signed-off-by: qurakchin <czzcy3832515@hotmail.com>
…atch

- RpcFacade: per-session bookkeeping with idle-timeout sweep thread;
  _on_session_drop hook for policy-state cleanup; serve() requires
  session_sweep_s > 0 when sessions are enabled.
- RpcClient: owns a private session id + atexit close; wait_for_ready
  registers it on connect.
- http/socket transports: thread session_id through dispatch.
- libero/robocasa servers: _dispatch now takes _lock around the body
  and accepts session_id; robocasa VLA enables sessions and injects
  the caller's sid into predict (rejects caller-supplied session_ids).
- rldx_skill: drop hardcoded sid; rely on server-side injection.
- docs (en/zh): document session lifecycle in add_robot / add_primitive
  / interfaces.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replace direct robocasa/robosuite usage with rlinf's Robocasa365Env
wrapper. The raw env now lives in an rlinf subprocess owned by
RobocasaSubprocEnv; the facade translates env.* RPC calls into
Robocasa365Env method calls.

- Add _resolve_rlinf_repo_path() to locate the rlinf checkout (env var
  → sibling rlinf → in-repo rlinf_robocasa) and mirror it onto
  PYTHONPATH so macOS spawn'd workers can import rlinf.
- Build the Robocasa365Env OmegaConf cfg in build_env_cfg(); --split
  all maps to pretrain (RoboCasa365 only knows pretrain/target).
- Fall back to max_episode_steps=600 when --max-episode-steps is 0 so
  RoboCasa365's episode_horizon_source validation passes.
- Delegate reset/step/render_raw/camera_meta/grasp_contact/etc. to the
  matching Robocasa365Env methods (RLDX_RESET_SEED flows through
  set_seed into the subprocess).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant