Measure advisory route progress beyond approximate joints
This commit is contained in:
@@ -204,6 +204,20 @@ class RoutedMission(WaypointMission):
|
||||
self.route_target = (np.asarray(pose[:2]) + 6.*direction).tolist()
|
||||
|
||||
def distance_to_target(self, pose, target):
|
||||
if self.advisory_joint():
|
||||
# A map joint is not a local stopping point. Clamping its along
|
||||
# coordinate makes genuine travel beyond an offset joint look like
|
||||
# retreat, provoking recovery while the observed passage is open.
|
||||
# Measure watchdog progress on the same continuing axis as intent.
|
||||
# Best-distance tracking still rejects back/forth cycles; this
|
||||
# neither advances a route joint nor admits terrain or arrival.
|
||||
segment = self.leg["segments"][self.segment_index]
|
||||
axis = np.asarray(segment["end_xy"]) - segment["start_xy"]
|
||||
axis /= np.linalg.norm(axis)
|
||||
delta = np.asarray(pose[:2]) - segment["start_xy"]
|
||||
along = float(delta @ axis)
|
||||
lateral = abs(float(delta[0]*axis[1] - delta[1]*axis[0]))
|
||||
return self.leg["length_m"] - self.completed_length - along + .15*lateral
|
||||
return self.remaining
|
||||
|
||||
def orientation_target(self):
|
||||
|
||||
Reference in New Issue
Block a user