Skip to content
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

Adds dataclass replacement for comand-line config overwrite #1567

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Fisher-Wang
Copy link

@Fisher-Wang Fisher-Wang commented Dec 19, 2024

Description

For example, I have a field robot in DirectEnvCfg with default value FRANKA_ISAACLAB_CFG

@configclass
class MyTaskEnvCfg(DirectRLEnvCfg):
    robot: ArticulationCfg = FRANKA_ISAACLAB_CFG

And FRANKA_ISAACLAB_CFG is defined as

@configclass
class FrankaIsaaclabCfg(ArticulationCfg):
    prim_path = "/World/envs/env_.*/Robot"
    spawn = sim_utils.UsdFileCfg(
    ...
FRANKA_ISAACLAB_CFG = FrankaIsaaclabCfg()

When I want to replace the robot config to another one, say FrankaWithGripperExtensionCfg, which is defined as

@configclass
class FrankaWithGripperExtensionCfg(ArticulationCfg):
    prim_path = "/World/envs/env_.*/Robot"
    spawn = sim_utils.UsdFileCfg(
    ...
FRANKA_WITH_GRIPPER_EXTENSION_CFG = FrankaIsaaclabCfg()

I can either run

python my_script.py env.robot=src.cfg.robot.franka:FRANKA_WITH_GRIPPER_EXTENSION_CFG <other_args>

or

python my_script.py env.robot=src.cfg.robot.franka:FrankaWithGripperExtensionCfg <other_args>

Currently I didn't find any support for this functionality in doc, so I implement a prototype, which is tested successfully in my own codebase.

Type of change

  • New feature (non-breaking change which adds functionality)

Screenshots

Run without env.robot=src.cfg.robot.franka:FrankaWithGripperExtensionCfg:
image

Run with env.robot=src.cfg.robot.franka:FrankaWithGripperExtensionCfg:
image

As you can see, the color of two arm is different, since I use two different configuration linked to different usd file.

Checklist

  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

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