apirrone
commited on
Commit
·
60505d3
1
Parent(s):
17f1ee9
update
Browse files- hand_tracker_app/main.py +3 -7
- pyproject.toml +2 -2
hand_tracker_app/main.py
CHANGED
|
@@ -11,13 +11,13 @@ import threading
|
|
| 11 |
import cv2
|
| 12 |
import numpy as np
|
| 13 |
from reachy_mini import ReachyMini, ReachyMiniApp
|
| 14 |
-
from reachy_mini.utils.camera import find_camera
|
| 15 |
from scipy.spatial.transform import Rotation as R
|
| 16 |
|
| 17 |
from 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
|
| 23 |
# Reduce/Increase to make the head movement smoother or more responsive)
|
|
@@ -32,19 +32,15 @@ class HandTrackerApp(ReachyMiniApp):
|
|
| 32 |
kz = 0.04
|
| 33 |
|
| 34 |
def run(self, reachy_mini: ReachyMini, stop_event: threading.Event):
|
| 35 |
-
cap = find_camera()
|
| 36 |
-
if cap is None:
|
| 37 |
-
raise RuntimeError("No camera found. Please connect a camera.")
|
| 38 |
-
|
| 39 |
hand_tracker = HandTracker()
|
| 40 |
|
| 41 |
head_pose = np.eye(4)
|
| 42 |
euler_rot = np.array([0.0, 0.0, 0.0])
|
| 43 |
|
| 44 |
while not stop_event.is_set():
|
| 45 |
-
|
| 46 |
|
| 47 |
-
if
|
| 48 |
print("Failed to capture image from camera.")
|
| 49 |
continue
|
| 50 |
|
|
|
|
| 11 |
import cv2
|
| 12 |
import numpy as np
|
| 13 |
from reachy_mini import ReachyMini, ReachyMiniApp
|
|
|
|
| 14 |
from scipy.spatial.transform import Rotation as R
|
| 15 |
|
| 16 |
from hand_tracker_app.hand_tracker import HandTracker
|
| 17 |
|
| 18 |
gui = False # Set to True if you want to use the GUI for debugging
|
| 19 |
|
| 20 |
+
|
| 21 |
class HandTrackerApp(ReachyMiniApp):
|
| 22 |
# Proportional gain for the controller
|
| 23 |
# Reduce/Increase to make the head movement smoother or more responsive)
|
|
|
|
| 32 |
kz = 0.04
|
| 33 |
|
| 34 |
def run(self, reachy_mini: ReachyMini, stop_event: threading.Event):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
hand_tracker = HandTracker()
|
| 36 |
|
| 37 |
head_pose = np.eye(4)
|
| 38 |
euler_rot = np.array([0.0, 0.0, 0.0])
|
| 39 |
|
| 40 |
while not stop_event.is_set():
|
| 41 |
+
img = reachy_mini.media.get_frame()
|
| 42 |
|
| 43 |
+
if img is None:
|
| 44 |
print("Failed to capture image from camera.")
|
| 45 |
continue
|
| 46 |
|
pyproject.toml
CHANGED
|
@@ -11,8 +11,8 @@ readme = "README.md"
|
|
| 11 |
requires-python = ">=3.8"
|
| 12 |
# dependencies = ["reachy-mini"]
|
| 13 |
dependencies = [
|
| 14 |
-
"reachy-mini
|
| 15 |
-
"
|
| 16 |
]
|
| 17 |
|
| 18 |
[project.entry-points."reachy_mini_apps"]
|
|
|
|
| 11 |
requires-python = ">=3.8"
|
| 12 |
# dependencies = ["reachy-mini"]
|
| 13 |
dependencies = [
|
| 14 |
+
"reachy-mini",
|
| 15 |
+
"reachy-mini-toolbox[vision]>=1.0.1"
|
| 16 |
]
|
| 17 |
|
| 18 |
[project.entry-points."reachy_mini_apps"]
|