Select urban passage intent from measured world geometry
This commit is contained in:
@@ -10,10 +10,19 @@ import numpy as np
|
||||
from scipy.spatial import cKDTree
|
||||
|
||||
|
||||
def passage_centres(points, pose, target, geometry, obstacles):
|
||||
def passage_centres(points, pose, target, geometry, obstacles, *, travel_direction=None):
|
||||
position = np.asarray(pose[:2])
|
||||
x, y, z, w = pose[3:7]
|
||||
yaw = math.atan2(2*(w*z+x*y), 1-2*(y*y+z*z))
|
||||
# An explicitly selected route continuation stations the observed corridor.
|
||||
# It is a direction, never the vector toward a remote endpoint. Legacy
|
||||
# unrouted tasks retain their body-forward observation convention.
|
||||
if travel_direction is None:
|
||||
x, y, z, w = pose[3:7]
|
||||
yaw = math.atan2(2*(w*z+x*y), 1-2*(y*y+z*z))
|
||||
else:
|
||||
direction = np.asarray(travel_direction, dtype=float)
|
||||
if direction.shape != (2,) or not np.isfinite(direction).all() or np.linalg.norm(direction) <= 1e-9:
|
||||
raise ValueError("Invalid passage travel direction")
|
||||
yaw = math.atan2(direction[1], direction[0])
|
||||
axes = np.array([[math.cos(yaw), -math.sin(yaw)],
|
||||
[math.sin(yaw), math.cos(yaw)]])
|
||||
local = (points[:, :2]-position) @ axes
|
||||
|
||||
Reference in New Issue
Block a user