Bound urban route clearance preference and expose Nav2 costmap diagnostics
This commit is contained in:
@@ -64,3 +64,27 @@ def test_goal_on_another_height_layer_does_not_attach_to_street():
|
||||
with pytest.raises(ValueError,match='Endpoint'):
|
||||
route_graph(*field,[[1.,0.,0.],[22.,0.,2.]],
|
||||
dict(provider='synthetic',provider_sha256='a'*64,collider_sha256='b'*64),'c'*64)
|
||||
|
||||
|
||||
def test_sufficient_clearance_does_not_attract_route_to_widest_surface():
|
||||
# A long open street with A/B on the same side. Geometry has no lane labels;
|
||||
# extra width farther away must not bend this otherwise direct intention.
|
||||
origin=np.array([0.,0.]);height=np.zeros((125,65))
|
||||
envelope=np.ones_like(height,dtype=bool);envelope[[0,-1],:]=False;envelope[:,[0,-1]]=False
|
||||
positions=[[2.25,2.25,0.],[58.25,2.25,0.]]
|
||||
graph=route_graph(origin,height,envelope,np.zeros_like(envelope),positions,
|
||||
dict(provider='synthetic',provider_sha256='a'*64,collider_sha256='b'*64),'c'*64,
|
||||
body_extent_m=1.2)
|
||||
route=build_route(dict(routing=graph,mission={'route_xy':[positions[-1][:2]]},
|
||||
robot={'geometry':{'length_m':1.2,'width_m':.9}},sha256='d'*64))['legs'][0]
|
||||
assert route['status']=='ready'
|
||||
assert route['length_m']==pytest.approx(56.)
|
||||
assert all(segment['end_xy'][1]==2.25 for segment in route['segments'])
|
||||
# There is still a real penalty near an envelope boundary; equal straight
|
||||
# edge lengths in already generous space have the same price.
|
||||
nodes={n['id']:n for n in graph['map']['nodes']}
|
||||
for edge in graph['map']['edges']:
|
||||
length=np.linalg.norm(np.array(nodes[edge['start']]['xy'])-nodes[edge['end']]['xy'])
|
||||
assert edge['cost_m'] >= length
|
||||
if edge['half_width_m']>=1.1:
|
||||
assert edge['cost_m']==pytest.approx(length)
|
||||
|
||||
Reference in New Issue
Block a user