MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / reroute

Method reroute

agents/navigation/behavior_agent.py:123–137  ·  view source on GitHub ↗

This method implements re-routing for vehicles approaching its destination. It finds a new target and computes another path to reach it. :param spawn_points: list of possible destinations for the agent

(self, spawn_points)

Source from the content-addressed store, hash-verified

121 self._local_planner.set_global_plan(route_trace, clean)
122
123 def reroute(self, spawn_points):
124 """
125 This method implements re-routing for vehicles approaching its destination.
126 It finds a new target and computes another path to reach it.
127
128 :param spawn_points: list of possible destinations for the agent
129 """
130
131 print("Target almost reached, setting new destination...")
132 random.shuffle(spawn_points)
133 new_start = self._local_planner.waypoints_queue[-1][0].transform.location
134 destination = spawn_points[0].location if spawn_points[0].location != new_start else spawn_points[1].location
135 print("New destination: " + str(destination))
136
137 self.set_destination(new_start, destination)
138
139 def _trace_route(self, start_waypoint, end_waypoint):
140 """

Callers

nothing calls this directly

Calls 1

set_destinationMethod · 0.95

Tested by

no test coverage detected