Commit
·
ed7d49e
1
Parent(s):
68ffbbe
Update main.py
Browse files
reachy_mini_hand_tracker_app/main.py
CHANGED
@@ -16,6 +16,7 @@ from scipy.spatial.transform import Rotation as R
|
|
16 |
|
17 |
from reachy_mini_hand_tracker_app.hand_tracker import HandTracker
|
18 |
|
|
|
19 |
|
20 |
class HandTrackerApp(ReachyMiniApp):
|
21 |
# Proportional gain for the controller
|
@@ -50,7 +51,9 @@ class HandTrackerApp(ReachyMiniApp):
|
|
50 |
hands = hand_tracker.get_hands_positions(img)
|
51 |
if hands:
|
52 |
hand = hands[0] # Assuming we only track the first detected hand
|
53 |
-
|
|
|
|
|
54 |
|
55 |
error = np.array([0, 0]) - hand
|
56 |
error = np.clip(
|
@@ -69,9 +72,10 @@ class HandTrackerApp(ReachyMiniApp):
|
|
69 |
|
70 |
reachy_mini.set_target(head=head_pose)
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
75 |
|
76 |
|
77 |
def draw_hand(img, hand):
|
|
|
16 |
|
17 |
from reachy_mini_hand_tracker_app.hand_tracker import HandTracker
|
18 |
|
19 |
+
gui = False # Set to True if you want to use the GUI for debugging
|
20 |
|
21 |
class HandTrackerApp(ReachyMiniApp):
|
22 |
# Proportional gain for the controller
|
|
|
51 |
hands = hand_tracker.get_hands_positions(img)
|
52 |
if hands:
|
53 |
hand = hands[0] # Assuming we only track the first detected hand
|
54 |
+
|
55 |
+
if gui:
|
56 |
+
draw_hand(img, hand)
|
57 |
|
58 |
error = np.array([0, 0]) - hand
|
59 |
error = np.clip(
|
|
|
72 |
|
73 |
reachy_mini.set_target(head=head_pose)
|
74 |
|
75 |
+
if gui:
|
76 |
+
cv2.imshow("Reachy Mini Hand Tracker App", img)
|
77 |
+
if cv2.waitKey(1) & 0xFF == ord("q"):
|
78 |
+
break
|
79 |
|
80 |
|
81 |
def draw_hand(img, hand):
|