Skip to content

Commit d37d804

Browse files
authored
refactor(fr3): multi env with dicts (#226)
1 parent 9d81ca1 commit d37d804

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

extensions/rcs_fr3/src/rcs_fr3/creators.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def __call__( # type: ignore
104104

105105
class RCSFR3MultiEnvCreator(RCSHardwareEnvCreator):
106106
def __call__( # type: ignore
107-
ips: list[str],
107+
name2ip: dict[str, str],
108108
control_mode: ControlMode,
109109
robot_cfg: hw.FR3Config,
110110
gripper_cfg: hw.FHConfig | None = None,
@@ -121,21 +121,21 @@ def __call__( # type: ignore
121121
# ik = rcs_robotics_library._core.rl.RoboticsLibraryIK(robot_cfg.kinematic_model_path)
122122

123123
robots: dict[str, hw.Franka] = {}
124-
for ip in ips:
125-
robots[ip] = hw.Franka(ip, ik)
126-
robots[ip].set_config(robot_cfg)
124+
for key, ip in name2ip.items():
125+
robots[key] = hw.Franka(ip, ik)
126+
robots[key].set_config(robot_cfg)
127127

128128
envs = {}
129-
for ip in ips:
130-
env: gym.Env = RobotEnv(robots[ip], control_mode)
129+
for key, ip in name2ip.items():
130+
env: gym.Env = RobotEnv(robots[key], control_mode)
131131
env = FR3HW(env)
132132
if gripper_cfg is not None:
133133
gripper = hw.FrankaHand(ip, gripper_cfg)
134134
env = GripperWrapper(env, gripper, binary=True)
135135

136136
if max_relative_movement is not None:
137137
env = RelativeActionSpace(env, max_mov=max_relative_movement, relative_to=relative_to)
138-
envs[ip] = env
138+
envs[key] = env
139139

140140
env = MultiRobotWrapper(envs)
141141
if camera_set is not None:

0 commit comments

Comments
 (0)