Skip to content

Commit

Permalink
Fix load robot cfg inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
Danfoa committed Oct 27, 2023
1 parent 4c74823 commit ca1eead
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions morpho_symm/cfg/robot/anymal_b-c2.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defaults:
- anymal_b
- _self_

name: anymal_b

Expand Down
1 change: 1 addition & 0 deletions morpho_symm/cfg/robot/anymal_c-c2.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defaults:
- anymal_c
- _self_

group_label: C2
1 change: 1 addition & 0 deletions morpho_symm/cfg/robot/hyq-c2.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

defaults:
- hyq
- _self_

group_label: C2

Expand Down
1 change: 1 addition & 0 deletions morpho_symm/cfg/robot/mini_cheetah-c2.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

defaults:
- mini_cheetah
- _self_

group_label: C2
1 change: 1 addition & 0 deletions morpho_symm/cfg/robot/mini_cheetah-k4.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

defaults:
- mini_cheetah
- _self_

group_label: K4
1 change: 1 addition & 0 deletions morpho_symm/cfg/robot/solo-c2.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

defaults:
- solo
- _self_

group_label: C2

Expand Down
2 changes: 2 additions & 0 deletions morpho_symm/cfg/robot/solo-k4.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
defaults:
- solo
- _self_

seed: 40

group_label: K4
Expand Down
1 change: 1 addition & 0 deletions morpho_symm/cfg/robot/ur10.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defaults:
- ur5
- _self_

name: ur10

Expand Down
1 change: 1 addition & 0 deletions morpho_symm/cfg/robot/ur3.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defaults:
- ur5
- _self_

name: ur3
11 changes: 5 additions & 6 deletions morpho_symm/utils/robot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,12 @@ def load_symmetric_system(
assert robot_cfg is not None or robot_name is not None, \
"Either a robot configuration file or a robot name must be provided."
if robot_cfg is None:
# Only robot name is provided. Load the robot configuration file using compose API from hydra.
# This allows to load the parent configuration files automatically.
path_cfg = Path(morpho_symm.__file__).parent / 'cfg' / 'robot'
path_robot_cfg = path_cfg / f'{robot_name}.yaml'
assert path_robot_cfg.exists(), \
f"Robot configuration {path_robot_cfg} does not exist."
base_cfg = OmegaConf.load(path_cfg / 'base_robot.yaml')
robot_cfg = OmegaConf.load(path_robot_cfg)
robot_cfg = OmegaConf.merge(base_cfg, robot_cfg)
from hydra import compose, initialize_config_dir
with initialize_config_dir(config_dir=str(path_cfg)):
robot_cfg = compose(config_name=robot_name)

robot_name = str.lower(robot_cfg.name)
# We allow symbolic expressions (e.g. `np.pi/2`) in the `q_zero` and `init_q`.
Expand Down

0 comments on commit ca1eead

Please sign in to comment.