Skip to content
Snippets Groups Projects
Commit 3092299c authored by Gaël Cartier-Michaud's avatar Gaël Cartier-Michaud
Browse files

simplify harvest callback

parent 7f9895d1
No related branches found
No related tags found
No related merge requests found
# Configuration pour le laptop
detector:
harvest : False
frame_before_exit : 30
homography_path : './demo/homography_matrix.csv'
cam :
dev_num : 2
img_sz : [1280, 720]
pix_format : 'GREY'
brightness : 15
model :
path : './demo/model/model_demo.pt'
img_sz : [1280,1280]
show : True
verbose : False
ip :
detectorIP : '192.168.125.42'
armIP : '192.168.125.1'
port : 50000
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
detector: detector:
harvest : True harvest : True
frame_before_exit : 30 frame_before_exit : 25
homography_path : './demo/homography_matrix.csv' homography_path : './demo/homography_matrix.csv'
cam : cam :
......
...@@ -27,6 +27,7 @@ class Detector : ...@@ -27,6 +27,7 @@ class Detector :
return config return config
def __harvestCallback( self, predictor ) : def __harvestCallback( self, predictor ) :
if not self.harvest_job.is_alive() :
nothing = True nothing = True
classes, coordinates = predictor.results[0].boxes.cls.cpu().numpy(), predictor.results[0].cpu().boxes.xywh.numpy() classes, coordinates = predictor.results[0].boxes.cls.cpu().numpy(), predictor.results[0].cpu().boxes.xywh.numpy()
for cl, coord in zip( classes, coordinates ) : for cl, coord in zip( classes, coordinates ) :
...@@ -34,7 +35,6 @@ class Detector : ...@@ -34,7 +35,6 @@ class Detector :
if not self.myArm.coordReachable( arm_coord ) or self.myModel.labelNum2Str( cl ) == 'hand' : pass if not self.myArm.coordReachable( arm_coord ) or self.myModel.labelNum2Str( cl ) == 'hand' : pass
else : else :
nothing = False nothing = False
if not self.harvest_job.is_alive() :
print( "\n{} : x: {}, y: {}".format( self.myModel.labelNum2Str(cl), arm_coord[0], arm_coord[1] ) ) print( "\n{} : x: {}, y: {}".format( self.myModel.labelNum2Str(cl), arm_coord[0], arm_coord[1] ) )
self.myArm.target = ( arm_coord[0], arm_coord[1], cl ) self.myArm.target = ( arm_coord[0], arm_coord[1], cl )
self.startHarvestJob() self.startHarvestJob()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment