Prevent goal oscillation and unintended differential drive arcs
This commit is contained in:
@@ -258,7 +258,18 @@ class ObservedGoals:
|
||||
and (candidate_mask is None or candidate_mask(before[None])[0])
|
||||
and supported(before)):
|
||||
return before.tolist()
|
||||
distance_to_target = np.linalg.norm(candidates[:, :2] - target, axis=1)
|
||||
# Score the task direction at the existing 3.5 m observation horizon.
|
||||
# Distance to a remote endpoint mostly rewards longitudinal advance:
|
||||
# slightly farther side returns can beat a clear straight destination
|
||||
# and make successive measured goals oscillate across the corridor.
|
||||
# This reference only ranks actual permitted returns. It is never a
|
||||
# generated drive goal, a straight-line route or a clearance receipt.
|
||||
horizon = min(remaining, 3.5)
|
||||
reference = pose[:2] + forward * horizon
|
||||
# A smooth local attraction, normalized to metres like boundary_cost.
|
||||
# Its gradient diminishes near the reference so centimetres of extra
|
||||
# advance cannot outweigh clearance from an observed corridor edge.
|
||||
distance_to_target = np.sum((candidates[:, :2] - reference)**2, axis=1) / horizon
|
||||
# The declared task, not the selected lens, owns the preferred direction.
|
||||
x,y,z,w = pose[3:7]
|
||||
heading = math.atan2(2*(w*z+x*y),1-2*(y*y+z*z))
|
||||
|
||||
Reference in New Issue
Block a user