44import gymnasium as gym
55import rcsss
66from rcsss import sim
7- from rcsss ._core .sim import CameraType
8- from rcsss .camera .sim import SimCameraConfig , SimCameraSet , SimCameraSetConfig
9- from rcsss .envs .base import CameraSetWrapper , ControlMode , FR3Env , GripperWrapper
7+ from rcsss .envs .base import ControlMode , FR3Env , GripperWrapper
108
119
1210class FR3Sim (gym .Wrapper ):
@@ -50,6 +48,7 @@ def __init__(
5048 collision_env : gym .Env ,
5149 check_home_collision : bool = True ,
5250 to_joint_control : bool = False ,
51+ sim_gui : bool = True ,
5352 ):
5453 super ().__init__ (env )
5554 self .unwrapped : FR3Env
@@ -65,6 +64,8 @@ def __init__(
6564 ), "Previous control mode must be joints"
6665 # change action space
6766 self .action_space = self .collision_env .action_space
67+ if sim_gui :
68+ self .sim .open_gui ()
6869
6970 def step (self , action : dict [str , Any ]) -> tuple [dict [str , Any ], SupportsFloat , bool , bool , dict [str , Any ]]:
7071 # TODO: we should set the state of the sim to the state of the real robot
@@ -112,12 +113,12 @@ def env_from_xml_paths(
112113 env : gym .Env ,
113114 mjmld : str ,
114115 urdf : str ,
115- id = "0" ,
116- gripper = True ,
117- check_home_collision = True ,
118- tcp_offset = None ,
116+ id : str = "0" ,
117+ gripper : bool = True ,
118+ check_home_collision : bool = True ,
119+ tcp_offset : rcsss . common . Pose | None = None ,
119120 control_mode : ControlMode | None = None ,
120- camera = False ,
121+ sim_gui : bool = True ,
121122 ) -> "CollisionGuard" :
122123 assert isinstance (env .unwrapped , FR3Env )
123124 simulation = sim .Sim (mjmld )
@@ -142,14 +143,6 @@ def env_from_xml_paths(
142143 c_env = FR3Sim (c_env , simulation )
143144 if gripper :
144145 gripper_cfg = sim .FHConfig ()
145- gripper = sim .FrankaHand (simulation , "0" , gripper_cfg )
146- c_env = GripperWrapper (c_env , gripper )
147- if camera :
148- cameras = {
149- "wrist" : SimCameraConfig (identifier = "eye-in-hand_0" , type = int (CameraType .fixed )),
150- "default_free" : SimCameraConfig (identifier = "" , type = int (CameraType .default_free )),
151- }
152- cam_cfg = SimCameraSetConfig (cameras = cameras , resolution_width = 640 , resolution_height = 480 , frame_rate = 5 )
153- camera_set = SimCameraSet (simulation , cam_cfg )
154- c_env = CameraSetWrapper (c_env , camera_set )
155- return cls (env , simulation , c_env , check_home_collision , to_joint_control )
146+ fh = sim .FrankaHand (simulation , id , gripper_cfg )
147+ c_env = GripperWrapper (c_env , fh )
148+ return cls (env , simulation , c_env , check_home_collision , to_joint_control , sim_gui )
0 commit comments