@@ -341,6 +341,11 @@ def is_successfully_parked(self, final_state: List[float], goal_pose: ObjectPose
341341 # Need exactly 4 cones to form a parking spot
342342 if len (parking_spot_vertices ) != 4 :
343343 print ("Warning: Not exactly 4 cones found for parking spot" )
344+ try :
345+ with open (self .success_file , 'a' ) as f :
346+ f .write ("No Four Cones" )
347+ except Exception as e :
348+ print (f"Error saving parking status: { e } " )
344349 return False
345350
346351 # Order the vertices to form a proper polygon
@@ -360,11 +365,23 @@ def is_successfully_parked(self, final_state: List[float], goal_pose: ObjectPose
360365 # First check if vehicle collides with any cone
361366 for cone_object in cone_objects :
362367 if collisions .polygon_intersects_polygon_2d (vehicle_polygon , cone_object .polygon_parent ()):
368+ try :
369+ with open (self .success_file , 'a' ) as f :
370+ f .write ("Collides with Cone" )
371+ except Exception as e :
372+ print (f"Error saving parking status: { e } " )
363373 print ("Vehicle collides with a cone" )
364374 return False
365375
366376 # Then check if vehicle is contained within parking spot
367377 if not collisions .polygon_contains_polygon_2d (cone_vertices , vehicle_polygon ):
378+ try :
379+ with open (self .success_file , 'a' ) as f :
380+ f .write (f"\n Ordered Vertices{ cone_vertices } " )
381+ f .write (f"\n Vehicle_Polygon{ vehicle_polygon } " )
382+ f .write ("\n Not Contained with parking spot" )
383+ except Exception as e :
384+ print (f"Error saving parking status: { e } " )
368385 print ("Vehicle is not contained within parking spot" )
369386 return False
370387
0 commit comments