Separate Nav2 body collision from ground search costs
This commit is contained in:
@@ -32,8 +32,9 @@ class ObservedCollision:
|
||||
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)
|
||||
self.search = node.create_publisher(PointCloud2, '/observed_search_hazards', 2)
|
||||
|
||||
def publish(self, request, terrain, elapsed, *, detected=()):
|
||||
def publish(self, request, terrain, elapsed, *, search_terrain, 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):
|
||||
@@ -53,9 +54,14 @@ 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))
|
||||
# Both measured hazards and derived clearance costs belong to search.
|
||||
# Never feed the reserve raster back into raw range or support evidence.
|
||||
# The body collision map contains physical/detector obstacles. Ground
|
||||
# permission and rejected support patches are search costs: treating
|
||||
# them as solid objects blocks an overhanging camera during BackUp/Spin.
|
||||
# Smac retains both; every native proposal still passes the separate
|
||||
# full ground-contact/semantic gates before reaching the actuator.
|
||||
hazards = terrain[terrain[:,3]>self.max_step+1e-4,:2]
|
||||
search = search_terrain[search_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))))
|
||||
self.search.publish(cloud(stamp,'map',np.concatenate((search,reserve))))
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user