Keep advisory route joints directional and preserve observed clearance
This commit is contained in:
@@ -321,3 +321,32 @@ def test_advisory_joint_is_never_an_exact_arrival_destination():
|
||||
mission.segment_index=len(mission.leg['segments'])-1
|
||||
mission.route_observation(pose,0.)
|
||||
assert mission.can_query_arrival(pose)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("offset", [-3.,0.,3.])
|
||||
def test_advisory_joint_is_a_direction_not_lateral_attraction(offset):
|
||||
from k1link.simulation.ai_polygon.route_mission import RoutedMission
|
||||
*_,inputs,_=fixture()
|
||||
inputs['routing']['blocked_edges']=['0','1','2']
|
||||
inputs.update(sensors={'schema_version':'missioncore.simulation-sensor-rig/v4'},
|
||||
behavior={'max_speed_mps':1.})
|
||||
mission=RoutedMission(inputs)
|
||||
mission.route_observation([0.,0.,0.,0.,0.,0.,1.],0.)
|
||||
# The actual open passage can pass a map joint on either side. Neither
|
||||
# the goal selector nor the stopped view acquisition should face the joint.
|
||||
for t,y in enumerate([2.,4.,5.,6.],start=10):
|
||||
pose=[offset,y,0.,0.,0.,0.,1.]
|
||||
mission.route_observation(pose,float(t*4))
|
||||
direction=np.array(mission.route_target)-pose[:2]
|
||||
assert direction[0] == pytest.approx(0.) and direction[1] > 3.5
|
||||
assert mission.orientation_target()['xy'] == mission.route_target
|
||||
assert mission.arrival_target() == [0.,5.]
|
||||
assert mission.segment_index == 0 # direction is not a transition receipt
|
||||
assert not mission.can_query_arrival(pose)
|
||||
# A required return anchor and final mission destination retain exact XY.
|
||||
mission.leg['segments'][0]['return_to_anchor']=True
|
||||
mission.route_observation(pose,60.)
|
||||
assert mission.route_target == [0.,5.]
|
||||
mission.segment_index=len(mission.leg['segments'])-1
|
||||
mission.route_observation(pose,61.)
|
||||
assert mission.route_target == mission.leg['goal_xy']
|
||||
|
||||
Reference in New Issue
Block a user