Keep passage clearance tied to observed spatial geometry

This commit is contained in:
DCCONSTRUCTIONS
2026-10-10 00:12:01 +03:00
parent 8bd2a9967a
commit daabdb9450
3 changed files with 66 additions and 9 deletions
+28
View File
@@ -482,3 +482,31 @@ def test_route_selects_the_relevant_observed_branch(selector):
goal=selector.choose(points,pose,[8,sign*5],None,(),GEOMETRY,1.)
assert goal is not None and sign*goal[1]>1.5
assert np.min(np.linalg.norm(points-goal,axis=1))<1e-9
@pytest.mark.parametrize("heading", [-25, 0, 25])
@pytest.mark.parametrize("yaw,shift", [(0,(0,0)),(73,(42,-17))])
def test_corridor_boundaries_do_not_rotate_with_the_rover(selector,heading,yaw,shift):
_,_,_,_,rotation=road(yaw,shift)
xy=np.array([[x,y] for x in np.arange(.4,6.,.07)
for y in np.arange(-1.5,1.51,.07)])
points=np.c_[xy@rotation.T+shift,np.zeros(len(xy))]
angle=math.radians(yaw+heading)
pose=[*shift,.37,0,0,math.sin(angle/2),math.cos(angle/2)]
selector.observe(np.c_[points,np.ones(len(points))],1,pose)
wall=np.array([[x,y] for x in np.arange(-.5,6.,.07) for y in [-1.6,1.6]])
selector.observe_navigation(clearance_receipt(pose,(wall@rotation.T+shift).tolist()),
pose,1,'run',1.)
goal=selector.choose(points,pose,np.array(shift)+rotation@[12,0],None,(),GEOMETRY,1.1)
assert goal is not None
local=(np.array(goal[:2])-shift)@rotation
assert local[0]>2.5 and abs(local[1])<.2
def test_symmetric_obstacle_does_not_average_two_passages_through_its_centre(selector):
points,pose,target,_,_=road()
selector.observe(np.c_[points,np.ones(len(points))],1,pose)
selector.observe_navigation(clearance_receipt(pose,[[1.6,0.]]),pose,1,'run',1.)
goal=selector.choose(points,pose,target,None,(),GEOMETRY,1.1)
assert goal is not None and abs(goal[1])>.35
assert selector.approach_clearance(np.array([goal]),pose,GEOMETRY,1.1)[0]>.2