@@ -58,7 +58,10 @@ def __init__(self):
58
58
59
59
self .gauss_sigma = 2.5
60
60
self .z_thresh_offset = 25.
61
- self .min_velocity = 5.
61
+ self .min_velocity = 10.
62
+
63
+ self .velocity_sensitive = True
64
+ self .max_velocity = 120. # anything w/ higher velocity is clipped at this point
62
65
63
66
self .group_min_size = 0.06
64
67
@@ -313,22 +316,34 @@ def tick(self, _):
313
316
# right hand on right
314
317
self .hand_states [0 ].draw_imgui (self .z_thresh_offset , self .dpi_scale , (pos_start_x + (self .width * self .dpi_scale / 2 ), pos_start_y ))
315
318
316
- # per finger calibration
317
319
imgui .new_line ()
320
+ pos_start_x , pos_start_y = imgui .get_cursor_pos ()
321
+
322
+ imgui .push_item_width (200 )
323
+ _ , self .min_velocity = imgui .slider_float ('min velocity' , self .min_velocity , 0. , 50. )
324
+ _ , self .velocity_sensitive = imgui .checkbox ('velocity sensitive' , self .velocity_sensitive )
325
+ if self .velocity_sensitive :
326
+ _ , self .max_velocity = imgui .slider_float ('max velocity' , self .max_velocity , 50. , 200. )
327
+ imgui .pop_item_width ()
328
+
329
+ imgui .set_cursor_pos ((pos_start_x + 400 , pos_start_y ))
330
+
331
+ # per finger calibration
318
332
if imgui .button ('reset fingers' ):
319
333
for h in self .hand_states :
320
334
for f , t in zip (h .fingertips , self .DEFAULT_FINGERTIP_THRESHOLDS ):
321
335
f .z_thresh = t
322
336
323
- imgui .same_line ( )
337
+ imgui .set_cursor_pos (( pos_start_x + 400 , imgui . get_cursor_pos ()[ 1 ]) )
324
338
self .calibrate_next_frame = imgui .button ('recalibrate plane' )
325
339
326
- imgui .new_line ()
340
+ imgui .set_cursor_pos ((pos_start_x + 400 , imgui .get_cursor_pos ()[1 ]))
341
+ imgui .push_item_width (200 )
327
342
self .midi .draw_imgui ()
343
+ imgui .pop_item_width ()
328
344
329
345
imgui .end ()
330
346
331
-
332
347
imgui .set_next_window_position (0 , (self .DIM_Y + 220 ) * self .dpi_scale )
333
348
imgui .set_next_window_size (400 * self .dpi_scale , 124 * self .dpi_scale )
334
349
imgui .set_next_window_bg_alpha (0.3 )
@@ -337,7 +352,6 @@ def tick(self, _):
337
352
imgui .push_item_width (150. * self .dpi_scale )
338
353
_ , self .PLANE_Z_OUTLIER_THRESHOLD = imgui .slider_float ('plane threshold' , self .PLANE_Z_OUTLIER_THRESHOLD , 0. , 100. )
339
354
_ , self .z_thresh_offset = imgui .slider_float ('finger threshold offset' , self .z_thresh_offset , 0. , 100. )
340
- _ , self .min_velocity = imgui .slider_float ('min velocity' , self .min_velocity , 0. , 100. )
341
355
imgui .pop_item_width ()
342
356
343
357
@@ -491,6 +505,10 @@ def run_per_hand_pipeline(self, g_id, flip_x):
491
505
492
506
for i , f_idx in zip (range (len (self .fingertip_idxes )), self .fingertip_idxes ):
493
507
508
+ hand_state .fingertips [i ].velocity_sensitive = self .velocity_sensitive
509
+ hand_state .fingertips [i ].min_velocity = self .min_velocity
510
+ hand_state .fingertips [i ].max_velocity = self .max_velocity
511
+
494
512
px , py = label_means [f_idx - 1 ].astype (np .int32 )
495
513
px *= self .LABELS_REDUCE
496
514
py *= self .LABELS_REDUCE
@@ -504,7 +522,7 @@ def run_per_hand_pipeline(self, g_id, flip_x):
504
522
pt .append (1. )
505
523
pt = self .calibrated_plane .plane @ pt
506
524
pt_z = - pt [2 ]
507
- hand_state .fingertips [i ].next_z_pos (pt_z , self .z_thresh_offset , self . min_velocity )
525
+ hand_state .fingertips [i ].next_z_pos (pt_z , self .z_thresh_offset )
508
526
509
527
if __name__ == '__main__' :
510
528
run_app (App_3d_bz )
0 commit comments