@@ -43,13 +43,14 @@ def __call__( # type: ignore
4343 self ,
4444 control_mode : ControlMode ,
4545 robot_cfg : rcs .sim .SimRobotConfig ,
46+ robot_kinematics_path : str | PathLike ,
47+ mjcf : str | PathLike ,
48+ kinematics_frame_id : str = "attachment_site" ,
4649 collision_guard : bool = False ,
4750 gripper_cfg : rcs .sim .SimGripperConfig | None = None ,
4851 cameras : dict [str , SimCameraConfig ] | None = None ,
4952 max_relative_movement : float | tuple [float , float ] | None = None ,
5053 relative_to : RelativeTo = RelativeTo .LAST_STEP ,
51- urdf_path : str | PathLike | None = None ,
52- mjcf : str | PathLike = "fr3_empty_world" ,
5354 sim_wrapper : Type [SimWrapper ] | None = None ,
5455 ) -> gym .Env :
5556 """
@@ -64,28 +65,28 @@ def __call__( # type: ignore
6465 max_relative_movement (float | tuple[float, float] | None): Maximum allowed movement. If float, it restricts
6566 translational movement in meters. If tuple, it restricts both translational (in meters) and rotational
6667 (in radians) movements. If None, no restriction is applied.
68+ kinematics_frame_id (str): Frame name of the flange. Defaults to "attachment_site". Note: if name doesnt exist
69+ then pinocchio just segfaults.
6770 relative_to (RelativeTo): Specifies whether the movement is relative to a configured origin or the last step.
68- urdf_path (str | PathLike | None): Path to the URDF file. If None, the URDF file is automatically deduced
69- which requires a UTN compatible lab scene to be present .
71+ robot_kinematics_path (str | PathLike | None): Path to either urdf or mjcf file that describes the robot kinematic.
72+ This is used for ik .
7073 mjcf (str | PathLike): Path to the Mujoco scene XML file. Defaults to "fr3_empty_world".
7174 sim_wrapper (Type[SimWrapper] | None): Wrapper to be applied before the simulation wrapper. This is useful
7275 for reset management e.g. resetting objects in the scene with correct observations. Defaults to None.
7376
7477 Returns:
7578 gym.Env: The configured simulation environment for the FR3 robot.
7679 """
77- if urdf_path is None :
78- urdf_path = rcs .scenes ["fr3_empty_world" ]["urdf" ]
7980 if mjcf not in rcs .scenes :
8081 logger .info ("mjcf not found as key in scenes, interpreting mjcf as path the mujoco scene xml" )
8182 if mjcf in rcs .scenes :
8283 assert isinstance (mjcf , str )
8384 mjcf = rcs .scenes [mjcf ]["mjb" ]
8485 simulation = sim .Sim (mjcf )
8586
86- # ik = rcs.common.Pin("/home/juelg/code/internal_rcs/assets/scenes/fr3_empty_world/fr3_0.xml", "attachment_site_0", urdf=False)
87- # ik = rcs.common.Pin( str(urdf_path) )
88- ik = rcs . common . RL ( str ( urdf_path ) )
87+ ik = rcs .common .Pin (
88+ str (robot_kinematics_path ), kinematics_frame_id , urdf = robot_kinematics_path . endswith ( ".urdf" )
89+ )
8990
9091 robot = rcs .sim .SimRobot (simulation , ik , robot_cfg )
9192 env : gym .Env = RobotEnv (robot , control_mode )
@@ -106,7 +107,7 @@ def __call__( # type: ignore
106107 env = CollisionGuard .env_from_xml_paths (
107108 env ,
108109 str (rcs .scenes .get (str (mjcf ), mjcf )),
109- str (urdf_path ),
110+ str (robot_kinematics_path ),
110111 gripper = gripper_cfg is not None ,
111112 check_home_collision = False ,
112113 control_mode = control_mode ,
@@ -132,14 +133,15 @@ def __call__( # type: ignore
132133
133134 env_rel = SimEnvCreator ()(
134135 control_mode = control_mode ,
135- robot_cfg = default_sim_robot_cfg (mjcf ),
136+ robot_cfg = default_sim_robot_cfg (rcs . scenes [ mjcf ][ "mjcf_scene" ] ),
136137 collision_guard = False ,
137138 gripper_cfg = default_sim_gripper_cfg (),
138139 cameras = cameras ,
139140 max_relative_movement = (0.2 , np .deg2rad (45 )) if delta_actions else None ,
140141 relative_to = RelativeTo .LAST_STEP ,
141- mjcf = mjcf ,
142+ mjcf = rcs . scenes [ mjcf ][ "mjcf_scene" ] ,
142143 sim_wrapper = RandomCubePos ,
144+ robot_kinematics_path = rcs .scenes [mjcf ]["mjcf_robot" ],
143145 )
144146 env_rel = PickCubeSuccessWrapper (env_rel )
145147 if render_mode == "human" :
0 commit comments