Align native planning clearance and admit observed tracked pivots
This commit is contained in:
@@ -6,6 +6,8 @@ independent gates keep the existing observed terrain and semantic evidence.
|
||||
import math
|
||||
import struct
|
||||
|
||||
import numpy as np
|
||||
from detector_exclusion import DetectorExclusion
|
||||
from geometry_msgs.msg import TransformStamped
|
||||
from rclpy.time import Time
|
||||
from sensor_msgs.msg import PointCloud2, PointField
|
||||
@@ -26,11 +28,12 @@ def cloud(stamp, frame, points):
|
||||
class ObservedCollision:
|
||||
def __init__(self, node, max_step, origin_count):
|
||||
self.node, self.max_step = node, max_step
|
||||
self.detector_exclusion = DetectorExclusion()
|
||||
self.rays = [node.create_publisher(PointCloud2, '/observed_rays_'+str(i), 2)
|
||||
for i in range(origin_count)]
|
||||
self.hazards = node.create_publisher(PointCloud2, '/observed_hazards', 2)
|
||||
|
||||
def publish(self, request, terrain, elapsed):
|
||||
def publish(self, request, terrain, elapsed, *, detected=()):
|
||||
rays = request['range_rays']
|
||||
age = float(request['geometry_age_seconds'])+elapsed
|
||||
if not math.isfinite(age) or age < 0 or len(rays['origins']) != len(self.rays):
|
||||
@@ -50,5 +53,9 @@ class ObservedCollision:
|
||||
points=[[end[0]-origin[0],end[1]-origin[1]]
|
||||
for end, owner in zip(rays['ends'], rays['origin_indices']) if owner==i]
|
||||
publisher.publish(cloud(stamp,'range'+str(i),points))
|
||||
self.hazards.publish(cloud(stamp,'map',terrain[terrain[:,3]>self.max_step+1e-4]))
|
||||
# Both measured hazards and derived clearance costs belong to search.
|
||||
# Never feed the reserve raster back into raw range or support evidence.
|
||||
hazards = terrain[terrain[:,3]>self.max_step+1e-4,:2]
|
||||
reserve = self.detector_exclusion.points(detected, request['pose'])
|
||||
self.hazards.publish(cloud(stamp,'map',np.concatenate((hazards,reserve))))
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user