11import logging
22import typing
3+ from functools import partial
34from typing import Type
45
56import gymnasium as gym
2728 SimWrapper ,
2829)
2930from rcs .envs .utils import default_sim_gripper_cfg , default_sim_robot_cfg
30- from functools import partial
3131
3232import rcs
3333from rcs import sim
@@ -163,7 +163,7 @@ def __call__( # type: ignore
163163 missing_keys = [key for key in required_keys if key not in random_pos_args ]
164164 logger .warning (f"Missing random position arguments: { missing_keys } ; Defaulting to RandomCubePos" )
165165 random_env = partial (RandomObjectPos , ** random_pos_args )
166-
166+
167167 env_rel = SimEnvCreator ()(
168168 control_mode = control_mode ,
169169 robot_cfg = robot_cfg ,
@@ -192,7 +192,7 @@ def __call__( # type: ignore
192192 resolution : tuple [int , int ] | None = None ,
193193 frame_rate : int = 0 ,
194194 delta_actions : bool = True ,
195- cam_list : list [str ] = ["wrist" , "bird_eye" , "side" , "right_side" , "left_side" , "front" ]
195+ cam_list : list [str ] = ["wrist" , "bird_eye" , "side" , "right_side" , "left_side" , "front" ],
196196 ) -> gym .Env :
197197 if resolution is None :
198198 resolution = (256 , 256 )
@@ -210,6 +210,7 @@ def __call__( # type: ignore
210210
211211 return SimTaskEnvCreator ()(robot_cfg , render_mode , control_mode , delta_actions , cameras )
212212
213+
213214class FR3LabDigitGripperPickUpSimEnvCreator (EnvCreator ):
214215 def __call__ ( # type: ignore
215216 self ,
@@ -219,7 +220,7 @@ def __call__( # type: ignore
219220 frame_rate : int = 0 ,
220221 delta_actions : bool = True ,
221222 cam_list : list [str ] = [],
222- mjcf_path : str = ''
223+ mjcf_path : str = "" ,
223224 ) -> gym .Env :
224225 if resolution is None :
225226 resolution = (256 , 256 )
@@ -237,20 +238,24 @@ def __call__( # type: ignore
237238 for cam in cam_list
238239 }
239240 robot_cfg = rcs .sim .SimRobotConfig ()
240- robot_cfg .tcp_offset = rcs .common .Pose (translation = np .array ([0.0 , 0.0 , 0.15 ]), rotation = np .array ([[0.707 , 0.707 , 0 ], [- 0.707 , 0.707 , 0 ], [0 , 0 , 1 ]]))
241+ robot_cfg .tcp_offset = rcs .common .Pose (
242+ translation = np .array ([0.0 , 0.0 , 0.15 ]),
243+ rotation = np .array ([[0.707 , 0.707 , 0 ], [- 0.707 , 0.707 , 0 ], [0 , 0 , 1 ]]),
244+ )
241245 robot_cfg .robot_type = rcs .common .RobotType .FR3
242246 robot_cfg .realtime = False
243- robot_cfg .add_id ("0" ) # only required for fr3
247+ robot_cfg .add_id ("0" ) # only required for fr3
244248 robot_cfg .mjcf_scene_path = mjcf_path
245- robot_cfg .kinematic_model_path = rcs .scenes ["fr3_empty_world" ].mjcf_robot # .urdf (in case for urdf)
246- print (f"Creating FR3LabDigitGripperPickUpSim with the following parameters: \n "
247- f" render_mode: { render_mode } \n "
248- f" control_mode: { control_mode } \n "
249- f" resolution: { resolution } \n "
250- f" frame_rate: { frame_rate } \n "
251- f" delta_actions: { delta_actions } \n "
252- f" cameras: { cameras } \n "
253- f" mjcf_path: { mjcf_path } \n "
254- )
249+ robot_cfg .kinematic_model_path = rcs .scenes ["fr3_empty_world" ].mjcf_robot # .urdf (in case for urdf)
250+ print (
251+ f"Creating FR3LabDigitGripperPickUpSim with the following parameters: \n "
252+ f" render_mode: { render_mode } \n "
253+ f" control_mode: { control_mode } \n "
254+ f" resolution: { resolution } \n "
255+ f" frame_rate: { frame_rate } \n "
256+ f" delta_actions: { delta_actions } \n "
257+ f" cameras: { cameras } \n "
258+ f" mjcf_path: { mjcf_path } \n "
259+ )
255260
256- return SimTaskEnvCreator ()(robot_cfg , render_mode , control_mode , delta_actions , cameras )
261+ return SimTaskEnvCreator ()(robot_cfg , render_mode , control_mode , delta_actions , cameras )
0 commit comments