1515)
1616from rcs .envs .creators import SimMultiEnvCreator
1717from rcs .envs .storage_wrapper import StorageWrapper
18- from rcs .envs .utils import default_sim_gripper_cfg , default_sim_robot_cfg
18+ from rcs .envs .utils import default_digit , default_sim_gripper_cfg , default_sim_robot_cfg
1919from rcs .utils import SimpleFrameRate
2020from rcs_fr3 .creators import RCSFR3MultiEnvCreator
2121from rcs_fr3 .utils import default_fr3_hw_gripper_cfg , default_fr3_hw_robot_cfg
2525from simpub .sim .mj_publisher import MujocoPublisher
2626from simpub .xr_device .meta_quest3 import MetaQuest3
2727
28- # from rcs_xarm7.creators import RCSXArm7EnvCreator
29-
3028logger = logging .getLogger (__name__ )
3129
3230# download the iris apk from the following repo release: https://github.com/intuitive-robots/IRIS-Meta-Quest3
3836
3937INCLUDE_ROTATION = True
4038ROBOT2IP = {
41- "left" : "192.168.102.1" ,
39+ # "left": "192.168.102.1",
4240 "right" : "192.168.101.1" ,
4341}
4442
4846RECORD_FPS = 30
4947# set camera dict to none disable cameras
5048# CAMERA_DICT = {
51- # "side_right": "244222071045",
49+ # "left_wrist": "230422272017",
50+ # "right_wrist": "230422271040",
51+ # "side": "243522070385",
5252# "bird_eye": "243522070364",
53- # "arro": "243522070385",
5453# }
5554CAMERA_DICT = None
5655MQ3_ADDR = "10.42.0.1"
56+ # DIGIT_DICT = {
57+ # "digit_right_left": "D21182",
58+ # "digit_right_right": "D21193"
59+ # }
60+ DIGIT_DICT = None
5761
58- DATASET_PATH = "test_data_iris_dual_arm "
62+ DATASET_PATH = "test_data_iris_dual_arm14 "
5963INSTRUCTION = "build a tower with the blocks in front of you"
6064
6165
@@ -80,6 +84,7 @@ def __init__(self, env: RelativeActionSpace):
8084
8185 self ._resource_lock = threading .Lock ()
8286 self ._env_lock = threading .Lock ()
87+ self ._reset_lock = threading .Lock ()
8388 self ._env = env
8489
8590 self .controller_names = ROBOT2IP .keys () if ROBOT_INSTANCE == RobotPlatform .HARDWARE else ["right" ]
@@ -155,11 +160,18 @@ def run(self):
155160
156161 if input_data [self ._stop_btn ] and (self ._prev_data is None or not self ._prev_data [self ._stop_btn ]):
157162 print ("reset successful pressed: resetting env" )
158- with self ._env_lock :
163+ with self ._reset_lock :
159164 # set successful
160165 self ._env .get_wrapper_attr ("success" )()
166+ # sleep to allow to let the robot reach the goal
167+ sleep (1 )
161168 # this might also move the robot to the home position
162169 self ._env .reset ()
170+ for controller in self .controller_names :
171+ self ._offset_pose [controller ] = Pose ()
172+ self ._last_controller_pose [controller ] = Pose ()
173+ self ._grp_pos [controller ] = 1
174+ continue
163175
164176 # reset unsuccessful
165177 if input_data [self ._unsuccessful_btn ] and (
@@ -261,25 +273,25 @@ def environment_step_loop(self):
261273 if self ._exit_requested :
262274 self ._step_env = False
263275 break
264- transforms , grippers = self .next_action ()
265- actions = {}
266- for robot , transform in transforms .items ():
267- action = dict (
268- LimitedTQuatRelDictType (tquat = np .concatenate ([transform .translation (), transform .rotation_q ()])) # type: ignore
269- )
276+ with self ._reset_lock :
277+ transforms , grippers = self .next_action ()
278+ actions = {}
279+ for robot , transform in transforms .items ():
280+ action = dict (
281+ LimitedTQuatRelDictType (tquat = np .concatenate ([transform .translation (), transform .rotation_q ()])) # type: ignore
282+ )
270283
271- action .update (GripperDictType (gripper = grippers [robot ]))
272- actions [robot ] = action
284+ action .update (GripperDictType (gripper = grippers [robot ]))
285+ actions [robot ] = action
273286
274- with self ._env_lock :
275287 self ._env .step (actions )
276288 rate_limiter ()
277289
278290
279291def main ():
280292 if ROBOT_INSTANCE == RobotPlatform .HARDWARE :
281293
282- camera_set = HardwareCameraSet ([default_realsense (CAMERA_DICT )]) if CAMERA_DICT is not None else None # type: ignore
294+ camera_set = HardwareCameraSet ([default_realsense (CAMERA_DICT ), default_digit ( DIGIT_DICT ) ]) if CAMERA_DICT is not None else None # type: ignore
283295 env_rel = RCSFR3MultiEnvCreator ()(
284296 name2ip = ROBOT2IP ,
285297 camera_set = camera_set ,
0 commit comments