Restore observed recovery through native Nav2
This commit is contained in:
@@ -63,12 +63,13 @@ def main():
|
||||
def controls():
|
||||
try:
|
||||
while running.is_set():
|
||||
with condition:current=dict(state)
|
||||
packet=dict(execution_inputs_sha256=inputs['sha256'],pose=original['pose'],
|
||||
measured_twist=[0.,0.,0.],speed_mps=0.,pose_age_seconds=.01,
|
||||
perception_age_seconds=0.,**current)
|
||||
result=request('/control',packet)
|
||||
responses.append(result)
|
||||
with condition:
|
||||
current=dict(state)
|
||||
packet=dict(execution_inputs_sha256=inputs['sha256'],pose=current.pop('pose',original['pose']),
|
||||
measured_twist=[0.,0.,0.],speed_mps=0.,pose_age_seconds=.01,
|
||||
perception_age_seconds=0.,**current)
|
||||
result=request('/control',packet)
|
||||
responses.append(result)
|
||||
time.sleep(.05)
|
||||
except BaseException as error:errors.append(error)
|
||||
|
||||
@@ -183,6 +184,72 @@ def main():
|
||||
restored=request('/plan',value)
|
||||
assert restored['status']=='path' and restored['controller_goal'][0]=='path',restored
|
||||
with condition:state['observation_id']=value['observation_id']
|
||||
# A separate synthetic, stationary floor checks the actual BackUp ->
|
||||
# rover-gate integration. It does not qualify motion on the city scene.
|
||||
with condition:
|
||||
state.update(enabled=False,pose=[0.,0.,.37,0.,0.,0.,1.])
|
||||
assert request('/reset',{})['reset']
|
||||
ready()
|
||||
floor=[[i*.05,j*.05,0.] for i in range(-40,41) for j in range(-40,41)]
|
||||
front=[p for p in floor if p[0]>.75]
|
||||
retreat=copy.deepcopy(original)
|
||||
retreat.update(pose=[0.,0.,.37,0.,0.,0.,1.],goal=[1.,0.,0.],
|
||||
max_speed_mps=.1,allow_reverse=False,translation_allowed=True,
|
||||
recovery_orientation=False,orientation_target=None,arrival_target=None,
|
||||
detection_point_indices=[],unlocalized_rear_detection=False,
|
||||
geometry_age_seconds=0.,detection_age_seconds=0.,semantic_points=[])
|
||||
retreat['range_rays']=dict(origins=[[0.,0.,.37],[0.,0.,.37]],
|
||||
ends=floor,origin_indices=[0]*len(floor))
|
||||
retreat['semantic_observations']=[dict(frame_id='retreat-floor',age_seconds=0.,
|
||||
samples=[[*p,1.] for p in floor])]
|
||||
retreat['points']=floor
|
||||
deadline=time.monotonic()+15
|
||||
while True:
|
||||
retreat['observation_id']='retreat-bootstrap'
|
||||
result=request('/plan',retreat)
|
||||
if result['status']=='path':break
|
||||
assert time.monotonic()<deadline,result
|
||||
time.sleep(.1)
|
||||
# Warm the costmaps through normal planning before invoking a behavior;
|
||||
# lifecycle activation alone does not publish their first observation.
|
||||
assert result['controller_goal'][0]=='path',result
|
||||
retreat.update(goal=[-1.,0.,0.],allow_reverse=True,observation_id='retreat-full-ground')
|
||||
result=request('/plan',retreat)
|
||||
assert result['status']=='path' and result['controller_goal'][0]=='backup',result
|
||||
with condition:state.update(enabled=True,observation_id=retreat['observation_id'])
|
||||
time.sleep(.15)
|
||||
retreat['points']=front
|
||||
retreat['range_rays'].update(ends=front,origin_indices=[0]*len(front))
|
||||
retreat['semantic_observations']=[]
|
||||
retreat['observation_id']='retreat-retained-ground'
|
||||
result=request('/plan',retreat)
|
||||
assert result['status']=='path',result
|
||||
with condition:state['observation_id']=retreat['observation_id']
|
||||
time.sleep(.2)
|
||||
backward=responses[-1]
|
||||
report['retained_ground_backup']=dict(plan=result,command=backward)
|
||||
assert backward['reason']=='none' and -.1<=backward['speed_mps']<0.,backward
|
||||
assert backward['support_policy']=='observed-static-ground-retreat',backward
|
||||
# Fresh rear returns still veto a previously observed, clear floor.
|
||||
obstacle=[[-.65,j*.05,.3] for j in range(-10,11)]
|
||||
retreat['points']=front+obstacle
|
||||
retreat['range_rays'].update(ends=front+obstacle,origin_indices=[0]*(len(front)+len(obstacle)))
|
||||
retreat['observation_id']='retreat-new-rear-obstacle'
|
||||
request('/plan',retreat)
|
||||
with condition:state['observation_id']=retreat['observation_id']
|
||||
time.sleep(.15)
|
||||
report['new_rear_obstacle_zero']=responses[-1]
|
||||
assert responses[-1]['speed_mps']==responses[-1]['yaw_rate_rps']==0.,responses[-1]
|
||||
# Restore the archived fixture before the existing lease/fault checks.
|
||||
with condition:
|
||||
state.update(enabled=False,pose=original['pose'])
|
||||
assert request('/reset',{})['reset']
|
||||
ready()
|
||||
deadline=time.monotonic()+15
|
||||
while request('/plan',value)['status']!='path':
|
||||
assert time.monotonic()<deadline,'Archived fixture did not restore'
|
||||
time.sleep(.1)
|
||||
with condition:state['observation_id']=value['observation_id']
|
||||
with condition:state['enabled']=False
|
||||
time.sleep(.1)
|
||||
assert responses[-1]['speed_mps']==responses[-1]['yaw_rate_rps']==0.
|
||||
|
||||
Reference in New Issue
Block a user