@@ -56,6 +56,19 @@ def default_realsense(name2id: dict[str, str]):
5656 return RealSenseCameraSet (cam_cfg )
5757
5858
59+ def get_urdf_path (urdf_path : str | None , allow_none_if_not_found : bool = False ) -> str | None :
60+ if urdf_path is None and "lab" in rcsss .scenes :
61+ urdf_path = str (rcsss .scenes ["lab" ].parent / "fr3.urdf" )
62+ assert os .path .exists (urdf_path ), "Automatic deduced urdf path does not exist. Corrupted models directory."
63+ logger .info ("Using automatic found urdf." )
64+ elif urdf_path is None and not allow_none_if_not_found :
65+ msg = "This pip package was not built with the UTN lab models, please pass the urdf and mjcf path."
66+ raise ValueError (msg )
67+ elif urdf_path is not None :
68+ logger .warning ("No urdf path was found. Proceeding, but set_cartesian methods will result in errors." )
69+ return urdf_path
70+
71+
5972def fr3_hw_env (
6073 ip : str ,
6174 control_mode : ControlMode ,
@@ -66,12 +79,7 @@ def fr3_hw_env(
6679 max_relative_movement : float | None = None ,
6780 urdf_path : str | None = None ,
6881) -> gym .Env :
69- if urdf_path is None and "lab" in rcsss .scenes :
70- urdf_path = str (rcsss .scenes ["lab" ].parent / "fr3.urdf" )
71- assert os .path .exists (urdf_path ), "Automatic deduced urdf path does not exist. Corrupted models directory."
72- logger .info ("Using automatic found urdf." )
73- elif urdf_path is None :
74- logger .warning ("No urdf path was found. Proceeding, but set_cartesian methods will result in errors." )
82+ urdf_path = get_urdf_path (urdf_path , allow_none_if_not_found = True )
7583
7684 ik = rcsss .common .IK (urdf_path ) if urdf_path is not None else None
7785 robot = rcsss .hw .FR3 (ip , ik )
@@ -121,6 +129,7 @@ def default_mujoco_cameraset_cfg():
121129 cameras = {
122130 "wrist" : SimCameraConfig (identifier = "eye-in-hand_0" , type = int (CameraType .fixed )),
123131 "default_free" : SimCameraConfig (identifier = "" , type = int (CameraType .default_free )),
132+ # "bird_eye": SimCameraConfig(identifier="bird-eye-cam", type=int(CameraType.fixed)),
124133 }
125134 return SimCameraSetConfig (cameras = cameras , resolution_width = 1280 , resolution_height = 720 , frame_rate = 10 )
126135
@@ -134,20 +143,13 @@ def fr3_sim_env(
134143 urdf_path : str | None = None ,
135144 mjcf : str | PathLike = "fr3_empty_world" ,
136145) -> gym .Env [ObsArmsGrCam , LimitedJointsRelDictType ]:
137-
138- if urdf_path is None and "lab" in rcsss .scenes :
139- urdf_path = str (rcsss .scenes ["lab" ].parent / "fr3.urdf" )
140- assert os .path .exists (urdf_path ), "Automatic deduced urdf path does not exist. Corrupted models directory."
141- logger .info ("Using automatic found urdf." )
142- elif urdf_path is None :
143- msg = "This pip package was not built with the UTN lab models, please pass the urdf and mjcf path."
144- raise ValueError (msg )
146+ urdf_path = get_urdf_path (urdf_path , allow_none_if_not_found = False )
145147
146148 if mjcf not in rcsss .scenes :
147149 logger .warning ("mjcf not found as key in scenes, interpreting mjcf as path the mujoco scene xml" )
148150
149151 simulation = sim .Sim (rcsss .scenes .get (mjcf , mjcf )) # type: ignore
150- ik = rcsss .common .IK (urdf_path )
152+ ik = rcsss .common .IK (urdf_path ) # type: ignore
151153 robot = rcsss .sim .FR3 (simulation , "0" , ik )
152154 robot .set_parameters (robot_cfg )
153155 env : gym .Env = FR3Env (robot , control_mode )
0 commit comments