33
44import gymnasium as gym
55import numpy as np
6- from rcs .envs .base import ControlMode , GripperWrapper , MultiRobotWrapper , RobotEnv
6+ from rcs .envs .base import ControlMode , GripperWrapper , HandWrapper , MultiRobotWrapper , RobotEnv
77from rcs .envs .space_utils import ActObsInfoWrapper
8- from rcs .envs .utils import default_sim_robot_cfg
8+ from rcs .envs .utils import default_sim_robot_cfg , default_sim_tilburg_hand_cfg
99
1010import rcs
1111from rcs import sim
@@ -213,9 +213,10 @@ def env_from_xml_paths(
213213 cls ,
214214 env : gym .Env ,
215215 mjmld : str ,
216- urdf : str ,
216+ cg_kinematics_path : str ,
217217 id : str = "0" ,
218218 gripper : bool = True ,
219+ hand : bool = False ,
219220 check_home_collision : bool = True ,
220221 tcp_offset : rcs .common .Pose | None = None ,
221222 control_mode : ControlMode | None = None ,
@@ -226,7 +227,7 @@ def env_from_xml_paths(
226227 # TODO: this needs to support non FR3 robots
227228 assert isinstance (env .unwrapped , RobotEnv )
228229 simulation = sim .Sim (mjmld )
229- ik = rcs .common .RL ( urdf , max_duration_ms = 300 )
230+ ik = rcs .common .Pin ( cg_kinematics_path , "attachment_site" , False )
230231 cfg = default_sim_robot_cfg (mjmld , id )
231232 cfg .realtime = False
232233 if tcp_offset is not None :
@@ -250,6 +251,13 @@ def env_from_xml_paths(
250251 fh = sim .SimGripper (simulation , gripper_cfg )
251252 c_env = GripperWrapper (c_env , fh )
252253 c_env = GripperWrapperSim (c_env , fh )
254+ if hand :
255+ hand_cfg = default_sim_tilburg_hand_cfg ()
256+ # hand_cfg.add_id(id)
257+ th = sim .SimTilburgHand (simulation , hand_cfg )
258+ c_env = HandWrapper (c_env , th )
259+ c_env = HandWrapperSim (c_env , th )
260+
253261 return cls (
254262 env = env ,
255263 simulation = simulation ,
0 commit comments