实现行为树执行器、任务协调和技能接口
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
"""Bounded per-camera frame window. No copying of image tensors across the BT API."""
|
||||
from collections import deque
|
||||
class FrameWindow:
|
||||
def __init__(self,maximum=32):self.frames=deque(maxlen=maximum)
|
||||
def add(self,stamp,camera,path):
|
||||
if self.frames and stamp<self.frames[-1]['stamp']:self.frames.clear()
|
||||
if self.frames and stamp==self.frames[-1]['stamp']:
|
||||
views=self.frames[-1]['views']
|
||||
if camera in views or len(views)<3:views[camera]=path
|
||||
else:self.frames.append(dict(stamp=stamp,views={camera:path}))
|
||||
def since(self,after,now):
|
||||
return [dict(stamp=f['stamp'],views=dict(f['views'])) for f in self.frames if after<=f['stamp']<=now and now-f['stamp']<=10]
|
||||
Reference in New Issue
Block a user