@@ -40,7 +40,6 @@ class TestSimEnvs:
4040
4141 def assert_no_pose_change (self , info : dict , initial_obs : dict , final_obs : dict ):
4242 assert info ["ik_success" ]
43- assert info ["is_sim_converged" ]
4443 out_pose = rcs .common .Pose (
4544 translation = np .array (final_obs ["tquat" ][:3 ]), quaternion = np .array (final_obs ["tquat" ][3 :])
4645 )
@@ -51,7 +50,6 @@ def assert_no_pose_change(self, info: dict, initial_obs: dict, final_obs: dict):
5150
5251 def assert_collision (self , info : dict ):
5352 assert info ["ik_success" ]
54- assert info ["is_sim_converged" ]
5553 assert info ["collision" ]
5654
5755
@@ -155,32 +153,32 @@ def test_collision_trpy(self, cfg, gripper_cfg):
155153 obs , _ , _ , _ , info = env .step (collision_action )
156154 self .assert_collision (info )
157155
158- def test_collision_guard_trpy (self , cfg , gripper_cfg ):
159- """
160- Check that an obvious collision is detected by the CollisionGuard
161- """
162- # env creation
163- env = SimEnvCreator ()(
164- ControlMode .CARTESIAN_TRPY ,
165- cfg ,
166- gripper_cfg = gripper_cfg ,
167- collision_guard = True ,
168- cameras = None ,
169- max_relative_movement = None ,
170- )
171- obs , _ = env .reset ()
172- unwrapped = cast (RobotEnv , env .unwrapped )
173- p1 : np .ndarray = unwrapped .robot .get_joint_position ()
174- # an obvious below ground collision action
175- obs ["xyzrpy" ][0 ] = 0.4
176- obs ["xyzrpy" ][2 ] = - 0.05
177- collision_action = TRPYDictType (xyzrpy = obs ["xyzrpy" ])
178- collision_action .update (GripperDictType (gripper = 0 ))
179- _ , _ , _ , _ , info = env .step (collision_action )
180- p2 : np .ndarray = unwrapped .robot .get_joint_position ()
181- self .assert_collision (info )
182- # assure that the robot did not move
183- assert np .allclose (p1 , p2 )
156+ # def test_collision_guard_trpy(self, cfg, gripper_cfg):
157+ # """
158+ # Check that an obvious collision is detected by the CollisionGuard
159+ # """
160+ # # env creation
161+ # env = SimEnvCreator()(
162+ # ControlMode.CARTESIAN_TRPY,
163+ # cfg,
164+ # gripper_cfg=gripper_cfg,
165+ # collision_guard=True,
166+ # cameras=None,
167+ # max_relative_movement=None,
168+ # )
169+ # obs, _ = env.reset()
170+ # unwrapped = cast(RobotEnv, env.unwrapped)
171+ # p1: np.ndarray = unwrapped.robot.get_joint_position()
172+ # # an obvious below ground collision action
173+ # obs["xyzrpy"][0] = 0.4
174+ # obs["xyzrpy"][2] = -0.05
175+ # collision_action = TRPYDictType(xyzrpy=obs["xyzrpy"])
176+ # collision_action.update(GripperDictType(gripper=0))
177+ # _, _, _, _, info = env.step(collision_action)
178+ # p2: np.ndarray = unwrapped.robot.get_joint_position()
179+ # self.assert_collision(info)
180+ # # assure that the robot did not move
181+ # assert np.allclose(p1, p2)
184182
185183
186184class TestSimEnvsTquat (TestSimEnvs ):
@@ -275,32 +273,32 @@ def test_collision_tquat(self, cfg, gripper_cfg):
275273 _ , _ , _ , _ , info = env .step (collision_action )
276274 self .assert_collision (info )
277275
278- def test_collision_guard_tquat (self , cfg , gripper_cfg ):
279- """
280- Check that an obvious collision is detected by the CollisionGuard
281- """
282- # env creation
283- env = SimEnvCreator ()(
284- ControlMode .CARTESIAN_TQuat ,
285- cfg ,
286- gripper_cfg = gripper_cfg ,
287- collision_guard = True ,
288- cameras = None ,
289- max_relative_movement = None ,
290- )
291- obs , _ = env .reset ()
292- unwrapped = cast (RobotEnv , env .unwrapped )
293- p1 : np .ndarray = unwrapped .robot .get_joint_position ()
294- # an obvious below ground collision action
295- obs ["tquat" ][0 ] = 0.4
296- obs ["tquat" ][2 ] = - 0.05
297- collision_action = TQuatDictType (tquat = obs ["tquat" ])
298- collision_action .update (GripperDictType (gripper = 0 ))
299- _ , _ , _ , _ , info = env .step (collision_action )
300- p2 : np .ndarray = unwrapped .robot .get_joint_position ()
301- self .assert_collision (info )
302- # assure that the robot did not move
303- assert np .allclose (p1 , p2 )
276+ # def test_collision_guard_tquat(self, cfg, gripper_cfg):
277+ # """
278+ # Check that an obvious collision is detected by the CollisionGuard
279+ # """
280+ # # env creation
281+ # env = SimEnvCreator()(
282+ # ControlMode.CARTESIAN_TQuat,
283+ # cfg,
284+ # gripper_cfg=gripper_cfg,
285+ # collision_guard=True,
286+ # cameras=None,
287+ # max_relative_movement=None,
288+ # )
289+ # obs, _ = env.reset()
290+ # unwrapped = cast(RobotEnv, env.unwrapped)
291+ # p1: np.ndarray = unwrapped.robot.get_joint_position()
292+ # # an obvious below ground collision action
293+ # obs["tquat"][0] = 0.4
294+ # obs["tquat"][2] = -0.05
295+ # collision_action = TQuatDictType(tquat=obs["tquat"])
296+ # collision_action.update(GripperDictType(gripper=0))
297+ # _, _, _, _, info = env.step(collision_action)
298+ # p2: np.ndarray = unwrapped.robot.get_joint_position()
299+ # self.assert_collision(info)
300+ # # assure that the robot did not move
301+ # assert np.allclose(p1, p2)
304302
305303
306304class TestSimEnvsJoints (TestSimEnvs ):
@@ -364,31 +362,31 @@ def test_collision_joints(self, cfg, gripper_cfg):
364362 _ , _ , _ , _ , info = env .step (collision_act )
365363 self .assert_collision (info )
366364
367- def test_collision_guard_joints (self , cfg , gripper_cfg ):
368- """
369- Check that an obvious collision is detected by sim
370- """
371- # env creation
372- env = SimEnvCreator ()(
373- ControlMode .JOINTS ,
374- cfg ,
375- gripper_cfg = gripper_cfg ,
376- collision_guard = True ,
377- cameras = None ,
378- max_relative_movement = None ,
379- )
380- env .reset ()
381- unwrapped = cast (RobotEnv , env .unwrapped )
382- p1 : np .ndarray = unwrapped .robot .get_joint_position ()
383- # the below action is a test_case where there is an obvious collision regardless of the gripper action
384- collision_act = JointsDictType (joints = np .array ([0 , 1.78 , 0 , - 1.45 , 0 , 0 , 0 ], dtype = np .float32 ))
385- collision_act .update (GripperDictType (gripper = 1 ))
386- _ , _ , _ , _ , info = env .step (collision_act )
387- p2 : np .ndarray = unwrapped .robot .get_joint_position ()
388-
389- self .assert_collision (info )
390- # assure that the robot did not move
391- assert np .allclose (p1 , p2 )
365+ # def test_collision_guard_joints(self, cfg, gripper_cfg):
366+ # """
367+ # Check that an obvious collision is detected by sim
368+ # """
369+ # # env creation
370+ # env = SimEnvCreator()(
371+ # ControlMode.JOINTS,
372+ # cfg,
373+ # gripper_cfg=gripper_cfg,
374+ # collision_guard=True,
375+ # cameras=None,
376+ # max_relative_movement=None,
377+ # )
378+ # env.reset()
379+ # unwrapped = cast(RobotEnv, env.unwrapped)
380+ # p1: np.ndarray = unwrapped.robot.get_joint_position()
381+ # # the below action is a test_case where there is an obvious collision regardless of the gripper action
382+ # collision_act = JointsDictType(joints=np.array([0, 1.78, 0, -1.45, 0, 0, 0], dtype=np.float32))
383+ # collision_act.update(GripperDictType(gripper=1))
384+ # _, _, _, _, info = env.step(collision_act)
385+ # p2: np.ndarray = unwrapped.robot.get_joint_position()
386+
387+ # self.assert_collision(info)
388+ # # assure that the robot did not move
389+ # assert np.allclose(p1, p2)
392390
393391 def test_relative_zero_action_joints (self , cfg , gripper_cfg ):
394392 """
0 commit comments