-
Notifications
You must be signed in to change notification settings - Fork 10
Refactor env launcher scripts #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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()andbuild_env_cfg_from_args()ingym_utils.pyto share launcher argument/config logic. - Updates
run_env.pyandrun_agent.pyto use the shared helpers and adds an interactive preview path inrun_env.py. - Updates a sample gym config to include a camera recording event; removes the old
preview_env.pyscript.
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()returnsaction_config, and the shared launcher args now include--action_config, butgymnasium.make(...)here doesn’t pass it through. If tasks rely onkwargs.get("action_config")(e.g., action bank configs),--action_configwill have no effect inrun_agent.py. Pass it along (e.g., via**action_configoraction_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.
…ce/EmbodiChain into yueci/refactor-env-launch
Description
This PR modularize the env launching function.
Type of change
Checklist
black .command to format the code base.