@@ -280,17 +280,27 @@ def update(self, state: AllState):
280280 else :
281281 # COMMENT OUT BECAUSE SOMETIMES REROUTES COMPLETELY DIFFERENT PATHS
282282 # self.reedssheppparking.find_collision_free_trajectory(self.parked_cars, self.current_pose, True)
283- self .waypoints_to_go = self .reedssheppparking .waypoints_to_go
283+
284+ self .waypoints_to_go = self .reedssheppparking .waypoints_to_go
284285 self .route = Route (frame = ObjectFrameEnum .START , points = self .waypoints_to_go .tolist ())
285- # print("Route:", self.route)
286286
287- print (state .trajectory )
287+ # waypoints_to_go = self.reedssheppparking.waypoints_to_go
288+ # # Remove the waypoints from the beginning to the current position
289+ # current_closest_index = 0
290+ # for i, waypoint in enumerate(waypoints_to_go):
291+ # if math.dist((state.vehicle.pose.x, state.vehicle.pose.y), waypoint[:2]) < 1.0:
292+ # current_closest_index = i
293+ # self.waypoints_to_go = waypoints_to_go[current_closest_index:]
294+
295+ # self.route = Route(frame=ObjectFrameEnum.START, points=self.waypoints_to_go.tolist())
296+ # print("Route:", self.route)
288297
289298 # Stop if the current state is close to the goal
290299 # TODO: Move the parameter to config file
291- if (state .vehicle .pose .x - self .waypoints_to_go [- 1 ][0 ])** 2 < 1.0 :
292- print ("I am close to the goal, stop." )
293- self .parking_finished = True
300+ # if (state.vehicle.pose.x - self.waypoints_to_go[-1][0])**2 < 0.5:
301+ # if len(self.waypoints_to_go) < 3:
302+ # print("I am close to the goal, stop.")
303+ # self.parking_finished = True
294304
295305
296306 else :
0 commit comments