Version urban lidar horizon and retain measured crossing exits
This commit is contained in:
@@ -24,11 +24,13 @@ class ContinuousComposition(ComposedInference):
|
||||
self.recovery_view_request = None
|
||||
self.recovery_detection_view = None
|
||||
self.last_supplement = -math.inf
|
||||
self.crossing = MarkedCrossing(self.geometry)
|
||||
self.crossing = MarkedCrossing(self.geometry, observation_range_m=max(
|
||||
12., self.inputs["sensors"]["mounts"]["k1"]["range_m"][1]))
|
||||
|
||||
def reset(self):
|
||||
super().reset()
|
||||
self.crossing = MarkedCrossing(self.geometry)
|
||||
self.crossing = MarkedCrossing(self.geometry, observation_range_m=max(
|
||||
12., self.inputs["sensors"]["mounts"]["k1"]["range_m"][1]))
|
||||
self.recovery_view_request = None
|
||||
self.recovery_detection_view = None
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ def mounted_range_returns(query, origin, directions, key, spec, forward, *,
|
||||
itself is scalar, avoiding thousands of tiny NumPy allocations per frame.
|
||||
"""
|
||||
count = len(directions)
|
||||
maximum = np.full(count, 8.0) if key == "k1" else np.minimum(8.0, 6.0 / forward)
|
||||
maximum = np.full(count, spec["range_m"][1]) if key == "k1" else np.minimum(8.0, 6.0 / forward)
|
||||
# PhysX consumes Float3 internally. Native callers avoid repeated pybind
|
||||
# sequence conversion; portable checks can use the identical tuple contract.
|
||||
mount = query_vector(origin)
|
||||
@@ -304,7 +304,8 @@ def mounted_range_returns(query, origin, directions, key, spec, forward, *,
|
||||
distances = np.linalg.norm(positions - origin, axis=1)
|
||||
depth = np.full(count, np.nan, np.float32)
|
||||
if key == "k1":
|
||||
valid = np.isfinite(distances) & (distances >= spec["range_m"][0])
|
||||
valid = (np.isfinite(distances) & (distances >= spec["range_m"][0])
|
||||
& (distances <= spec["range_m"][1]))
|
||||
positions[no_hit] = origin + directions[no_hit] * maximum[no_hit, None]
|
||||
clear = valid | no_hit
|
||||
else:
|
||||
|
||||
@@ -20,7 +20,10 @@ class MarkedCrossing:
|
||||
grid_m = .2
|
||||
ground_tolerance_m = .1
|
||||
|
||||
def __init__(self, geometry):
|
||||
def __init__(self, geometry, *, observation_range_m=12.):
|
||||
if not math.isfinite(observation_range_m) or not 12 <= observation_range_m <= 40:
|
||||
raise ValueError("Invalid crossing observation range")
|
||||
self.observation_range_m = observation_range_m
|
||||
self.geometry = geometry
|
||||
self.previous = self.stopped_since = self.active = None
|
||||
self.measured = OrderedDict()
|
||||
@@ -32,7 +35,7 @@ class MarkedCrossing:
|
||||
This bounded static-scene semantic evidence supplies no ground/support
|
||||
certificate. Current range and objects still veto every commanded sweep.
|
||||
"""
|
||||
near = np.linalg.norm(points[:, :2]-pose[:2], axis=1) < 12
|
||||
near = np.linalg.norm(points[:, :2]-pose[:2], axis=1) < self.observation_range_m
|
||||
for point, label in zip(points[near & ground], sampled[near & ground]):
|
||||
key = tuple(np.floor(point / [.2, .2, .06]).astype(int))
|
||||
if label in (1, 3):
|
||||
@@ -41,7 +44,7 @@ class MarkedCrossing:
|
||||
elif label in (4, 5):
|
||||
self.measured.pop(key, None)
|
||||
for key, (point, _) in list(self.measured.items()):
|
||||
if np.linalg.norm(point[:2]-pose[:2]) >= 12:
|
||||
if np.linalg.norm(point[:2]-pose[:2]) >= self.observation_range_m:
|
||||
del self.measured[key]
|
||||
while len(self.measured) > 6000:
|
||||
self.measured.popitem(last=False)
|
||||
@@ -173,7 +176,7 @@ class MarkedCrossing:
|
||||
# Completion and abandonment revoke this manoeuvre. It cannot
|
||||
# expand indefinitely by following unrelated new yellow pixels.
|
||||
if (relative[0] > a['exit_forward']+self.geometry['length_m']/2
|
||||
or np.linalg.norm(relative) > 16):
|
||||
or np.linalg.norm(relative) > max(16., self.observation_range_m+self.geometry["length_m"])):
|
||||
self.active = None
|
||||
self.stopped_since = None
|
||||
self.measured.clear()
|
||||
@@ -189,7 +192,7 @@ class MarkedCrossing:
|
||||
distance = np.linalg.norm(relative, axis=1)
|
||||
height = (remembered-pose[:3]) @ up + self.geometry['body_contact_height_m']
|
||||
on_ground = np.abs(height) <= .1+distance*math.tan(math.radians(self.geometry['max_slope_degrees']))
|
||||
paint = (classes == 3) & on_ground & (relative[:, 0] > 0) & (distance < 12)
|
||||
paint = (classes == 3) & on_ground & (relative[:, 0] > 0) & (distance < self.observation_range_m)
|
||||
state.update(self._admit(remembered, relative, classes, on_ground,
|
||||
paint, pose, axes, now))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user