Signed-off-by: unknown <ykcheungab@MEE1965.ust.hk>
This commit is contained in:
@@ -12,6 +12,7 @@ import time
|
||||
from scipy.interpolate import griddata
|
||||
from enum import Enum, auto
|
||||
from typing import Optional, Tuple, Union, Any
|
||||
from .getDensity import getFilteredDensity
|
||||
|
||||
class Sensor:
|
||||
"""
|
||||
@@ -83,7 +84,7 @@ class Sensor:
|
||||
self.stitch_valid = False
|
||||
self.n_boxes = None
|
||||
self.stitch_calibration = []
|
||||
self.img = self.flow = self.normal = self.shear = self.force = None
|
||||
self.img = self.flow = self.normal = self.shear = self.force = self.depth = None
|
||||
self.fnormal=self.fshearx=self.fsheary=self.ftor=0.0
|
||||
self.imgupdate = self.vupdate = False
|
||||
self.pos_default = [(260, 56), (577, 62), (897, 69), (1214, 75), (1530, 81), (256, 391), (570, 397), (889, 403), (1208, 409), (1523, 416), (248, 724), (563, 730), (882, 738), (1201, 743), (1516, 751)]
|
||||
@@ -109,6 +110,7 @@ class Sensor:
|
||||
FNORMAL = auto()
|
||||
FSHEARX = auto()
|
||||
FSHEARY = auto()
|
||||
DEPTH = auto()
|
||||
|
||||
|
||||
def get_img(self):
|
||||
@@ -161,9 +163,10 @@ class Sensor:
|
||||
self.normal = self.hhd.get_normal()
|
||||
self.shear = self.hhd.get_shear()
|
||||
flag, [self.fnormal,self.fshearx,self.fsheary,self.ftor] = self.hhd.get_force(flow)
|
||||
|
||||
self.depth = getFilteredDensity(self.flow, use_cuda=self.cuda)
|
||||
self.fps = 1/(time.time() - self.last_log_time)
|
||||
self.last_log_time = time.time()
|
||||
|
||||
|
||||
return self.flow
|
||||
|
||||
@@ -183,6 +186,7 @@ class Sensor:
|
||||
- FSHEAR: Shear force magnitude (float)
|
||||
- FPS: Current frames per second (float)
|
||||
- TIMESTAMP: Current timestamp string (str)
|
||||
- DEPTH: Depth image (np.ndarray)
|
||||
|
||||
Example:
|
||||
normal, shear, fps = sensor.read_info(sensor.info.VNORMAL, sensor.info.VSHEAR, sensor.info.FPS)
|
||||
@@ -215,7 +219,8 @@ class Sensor:
|
||||
results.append(self.fps)
|
||||
elif arg == self.info.TIMESTAMP:
|
||||
results.append(time.strftime('%H:%M:%S'))
|
||||
|
||||
elif arg == self.info.DEPTH:
|
||||
results.append(self.depth if self.depth is not None else np.array([]))
|
||||
return tuple(results) if results else ()
|
||||
|
||||
def disconnect(self):
|
||||
|
||||
Reference in New Issue
Block a user