Skip to content

Conversation

@yuecideng
Copy link
Contributor

@yuecideng yuecideng commented Feb 9, 2026

Description

This PR modularize the env launching function.

  • Add a args augmentation function that adds default augments.
  • Organize the config to cfg fucntion such that it can be reused in different places.

Type of change

  • Enhancement (non-breaking change which improves an existing functionality)

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Dependencies have been updated, if applicable.

Copilot AI review requested due to automatic review settings February 9, 2026 15:31
@yuecideng yuecideng added refactor gym robot learning env and its related features labels Feb 9, 2026
Copy link

Copilot AI left a comment

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 refactors environment launcher scripts by centralizing common CLI argument wiring and environment-config construction into shared helpers, and folds the previous standalone preview script functionality into run_env.py.

Changes:

  • Introduces add_env_launcher_args_to_parser() and build_env_cfg_from_args() in gym_utils.py to share launcher argument/config logic.
  • Updates run_env.py and run_agent.py to use the shared helpers and adds an interactive preview path in run_env.py.
  • Updates a sample gym config to include a camera recording event; removes the old preview_env.py script.

Reviewed changes

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

Show a summary per file
File Description
embodichain/lab/scripts/run_env.py Switches to shared launcher helpers and adds interactive preview mode.
embodichain/lab/scripts/run_agent.py Switches to shared launcher helpers for env cfg creation.
embodichain/lab/scripts/preview_env.py Removed (preview functionality moved into run_env.py).
embodichain/lab/gym/utils/gym_utils.py Adds shared argparse/env-cfg builder helpers for launchers.
configs/gym/pour_water/gym_config_simple.json Adds a record_camera interval event to record camera data.
Comments suppressed due to low confidence (1)

embodichain/lab/scripts/run_agent.py:74

  • build_env_cfg_from_args() returns action_config, and the shared launcher args now include --action_config, but gymnasium.make(...) here doesn’t pass it through. If tasks rely on kwargs.get("action_config") (e.g., action bank configs), --action_config will have no effect in run_agent.py. Pass it along (e.g., via **action_config or action_config=... depending on the expected API).
    # Load configurations
    env_cfg, gym_config, action_config = build_env_cfg_from_args(args)
    agent_config = load_json(args.agent_config)

    # Create environment
    env = gymnasium.make(
        id=gym_config["id"],
        cfg=env_cfg,
        agent_config=agent_config,
        agent_config_path=args.agent_config,
        task_name=args.task_name,
    )

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

@yuecideng yuecideng merged commit 3eb881e into main Feb 10, 2026
9 of 10 checks passed
@yuecideng yuecideng deleted the yueci/refactor-env-launch branch February 10, 2026 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gym robot learning env and its related features refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant