1313from rcs ._core .common import GripperType , RobotType
1414from torchvision .io import decode_jpeg
1515from torchvision .transforms import v2
16+ import warnings
1617
1718import rcs
1819
@@ -309,8 +310,9 @@ def _convert_action_to_joint_space(self, row: pd.Series) -> np.ndarray:
309310 target_pose , observation_joints_vec , tcp_offset = self .tcp_offset
310311 )
311312 if ik_joints is None :
312- msg = f"IK failed for robot '{ robot_key } ' at step { row ['step' ]} "
313- raise ValueError (msg )
313+ msg = f"IK failed for robot '{ robot_key } ' at step { row ['step' ]} , ignoring step"
314+ warnings .warn (msg )
315+ return None
314316 arm_action_vec = np .asarray (ik_joints , dtype = np .float32 )
315317
316318 actions .append (np .concatenate ([arm_action_vec , action_gripper_vec ]).astype (np .float32 ))
@@ -329,15 +331,19 @@ def _prepare_transition_table(self, table: pd.DataFrame) -> pd.DataFrame:
329331 df ["observation_state" ] = df .apply (self ._build_observation_state , axis = 1 )
330332 df ["action_vector" ] = df .apply (self ._convert_action_to_joint_space , axis = 1 )
331333
334+ df = df [df ["action_vector" ].notna ()]
335+
332336 prev_action : np .ndarray | None = None
333337 keep_mask = []
334338 for action_vec in df ["action_vector" ]:
335339 assert isinstance (action_vec , np .ndarray )
336- keep_mask .append (prev_action is None or not np .array_equal (action_vec , prev_action ))
340+ keep_mask .append (prev_action is None or not np .allclose (action_vec , prev_action , atol = 1e-4 , rtol = 0 ))
337341 prev_action = action_vec
338342
339343 return df .loc [keep_mask ].reset_index (drop = True )
340344
345+
346+
341347 def parse_episode (self , episode_id : str , table : pd .DataFrame , success : bool ):
342348 table = self ._prepare_transition_table (table )
343349 if len (table ) == 0 :
0 commit comments