Retain measured local intent support across range resampling
This commit is contained in:
@@ -684,3 +684,32 @@ def test_range_sampling_error_does_not_accumulate_into_lateral_drift(selector, a
|
||||
replacement = selector.choose(points, moved, position+rotation@[6.,0.],goal,
|
||||
(), geometry,2.1,travel_direction=rotation@[1.,0.])
|
||||
assert replacement is None or abs(((np.asarray(replacement[:2])-shift)@rotation)[1])>.3
|
||||
|
||||
|
||||
@pytest.mark.parametrize('yaw,shift', [(0,(0,0)),(73,(42,-17)),(-138,(-250,52))])
|
||||
def test_resampling_semantic_cells_preserves_actual_intent_support(selector,yaw,shift):
|
||||
points,pose,target,_,rotation = road(yaw,shift)
|
||||
selector.observe(np.c_[points,np.ones(len(points))],1.,pose)
|
||||
goal = selector.choose(points,pose,target,None,(),GEOMETRY,1.1)
|
||||
assert goal is not None
|
||||
# A subsequent view samples different positions inside the same semantic
|
||||
# voxels. Keep one actual return per voxel, farthest from the old goal.
|
||||
# The permission has not changed and no new obstacle has appeared.
|
||||
cells = selector.surface.cell_keys(points)
|
||||
selected = {}
|
||||
for cell,point in zip(cells,points):
|
||||
key = tuple(cell)
|
||||
if key not in selected or math.dist(point,goal)>math.dist(selected[key],goal):
|
||||
selected[key] = point
|
||||
resampled = np.array(list(selected.values()))
|
||||
selector.observe(np.c_[resampled,np.ones(len(resampled))],1.2,pose)
|
||||
stamps = dict(selector.surface.cells)
|
||||
retained = selector.choose(resampled,pose,target,goal,(),GEOMETRY,1.3)
|
||||
assert retained == goal
|
||||
assert selector.evidence['source'] == 'retained-observed-passage'
|
||||
assert dict(selector.surface.cells) == stamps
|
||||
assert len(selector.intent_samples) <= math.ceil(GEOMETRY['width_m']/.1)+2
|
||||
# A real new exclusion revokes the retained measured samples as well.
|
||||
for now in [1.4,1.5,1.6]:
|
||||
selector.observe(np.c_[resampled,np.zeros(len(resampled))],now,pose)
|
||||
assert selector.choose(resampled,pose,target,goal,(),GEOMETRY,1.7) is None
|
||||
|
||||
Reference in New Issue
Block a user