apirrone
commited on
Commit
·
941d913
1
Parent(s):
525d61d
ability to choose between mediapipe head tracker and yolo head tracker. Not working yet, must uniformize the outputs of the trackers (?) and waiting for remi's movement manager update
Browse files
pyproject.toml
CHANGED
|
@@ -21,6 +21,7 @@ dependencies = [
|
|
| 21 |
"dotenv",
|
| 22 |
"ultralytics",
|
| 23 |
"supervision",
|
|
|
|
| 24 |
]
|
| 25 |
|
| 26 |
|
|
|
|
| 21 |
"dotenv",
|
| 22 |
"ultralytics",
|
| 23 |
"supervision",
|
| 24 |
+
"reachy_mini_toolbox@git+ssh://git@github.com/pollen-robotics/reachy_mini_toolbox@main"
|
| 25 |
]
|
| 26 |
|
| 27 |
|
src/reachy_mini_conversation_demo/main.py
CHANGED
|
@@ -11,7 +11,10 @@ from reachy_mini import ReachyMini
|
|
| 11 |
from reachy_mini.utils import create_head_pose
|
| 12 |
|
| 13 |
from reachy_mini_conversation_demo.config import config
|
| 14 |
-
from reachy_mini_conversation_demo.vision.yolo_head_tracker import
|
|
|
|
|
|
|
|
|
|
| 15 |
from reachy_mini_conversation_demo.openai_realtime import OpenAIRealtimeHandler
|
| 16 |
from reachy_mini_conversation_demo.prompts import SESSION_INSTRUCTIONS
|
| 17 |
from reachy_mini_conversation_demo.tools import (
|
|
@@ -30,7 +33,13 @@ from reachy_mini_conversation_demo.vision.processors import (
|
|
| 30 |
parser = argparse.ArgumentParser(description="Reachy Mini Conversation Demo")
|
| 31 |
parser.add_argument("--sim", action="store_true", help="Run in simulation mode")
|
| 32 |
parser.add_argument("--vision", action="store_true", help="Enable vision")
|
| 33 |
-
parser.add_argument("--head-tracking", action="store_true", help="Enable head tracking")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
parser.add_argument(
|
| 35 |
"--vision-provider",
|
| 36 |
choices=["openai", "local"],
|
|
@@ -54,7 +63,7 @@ API_KEY = config.OPENAI_API_KEY
|
|
| 54 |
# Defaults are all False unless CLI flags are passed
|
| 55 |
SIM = args.sim
|
| 56 |
VISION_ENABLED = args.vision
|
| 57 |
-
|
| 58 |
LOG_LEVEL = "DEBUG" if args.debug else "INFO"
|
| 59 |
NO_INTERRUPUTIONS = args.no_interruptions
|
| 60 |
|
|
@@ -68,7 +77,7 @@ logger.info(
|
|
| 68 |
"Runtime toggles: SIM=%s VISION_ENABLED=%s HEAD_TRACKING=%s LOG_LEVEL=%s",
|
| 69 |
SIM,
|
| 70 |
VISION_ENABLED,
|
| 71 |
-
|
| 72 |
LOG_LEVEL,
|
| 73 |
)
|
| 74 |
|
|
@@ -158,11 +167,15 @@ async def loop():
|
|
| 158 |
|
| 159 |
current_robot = ReachyMini()
|
| 160 |
|
| 161 |
-
head_tracker
|
| 162 |
-
if
|
| 163 |
-
head_tracker
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
logger.warning("Head tracking disabled while in Simulation")
|
| 167 |
else:
|
| 168 |
logger.warning("Head tracking disabled")
|
|
|
|
| 11 |
from reachy_mini.utils import create_head_pose
|
| 12 |
|
| 13 |
from reachy_mini_conversation_demo.config import config
|
| 14 |
+
from reachy_mini_conversation_demo.vision.yolo_head_tracker import (
|
| 15 |
+
HeadTracker as YoloHeadTracker,
|
| 16 |
+
)
|
| 17 |
+
from reachy_mini_toolbox.vision import HeadTracker as MediapipeHeadTracker
|
| 18 |
from reachy_mini_conversation_demo.openai_realtime import OpenAIRealtimeHandler
|
| 19 |
from reachy_mini_conversation_demo.prompts import SESSION_INSTRUCTIONS
|
| 20 |
from reachy_mini_conversation_demo.tools import (
|
|
|
|
| 33 |
parser = argparse.ArgumentParser(description="Reachy Mini Conversation Demo")
|
| 34 |
parser.add_argument("--sim", action="store_true", help="Run in simulation mode")
|
| 35 |
parser.add_argument("--vision", action="store_true", help="Enable vision")
|
| 36 |
+
# parser.add_argument("--head-tracking", action="store_true", help="Enable head tracking")
|
| 37 |
+
parser.add_argument(
|
| 38 |
+
"--head-tracker",
|
| 39 |
+
choices=["yolo", "mediapipe", None],
|
| 40 |
+
default=None,
|
| 41 |
+
help="Choose head tracker (default: None)",
|
| 42 |
+
)
|
| 43 |
parser.add_argument(
|
| 44 |
"--vision-provider",
|
| 45 |
choices=["openai", "local"],
|
|
|
|
| 63 |
# Defaults are all False unless CLI flags are passed
|
| 64 |
SIM = args.sim
|
| 65 |
VISION_ENABLED = args.vision
|
| 66 |
+
HEAD_TRACKING_ENABLED = args.head_tracker is not None
|
| 67 |
LOG_LEVEL = "DEBUG" if args.debug else "INFO"
|
| 68 |
NO_INTERRUPUTIONS = args.no_interruptions
|
| 69 |
|
|
|
|
| 77 |
"Runtime toggles: SIM=%s VISION_ENABLED=%s HEAD_TRACKING=%s LOG_LEVEL=%s",
|
| 78 |
SIM,
|
| 79 |
VISION_ENABLED,
|
| 80 |
+
HEAD_TRACKING_ENABLED,
|
| 81 |
LOG_LEVEL,
|
| 82 |
)
|
| 83 |
|
|
|
|
| 167 |
|
| 168 |
current_robot = ReachyMini()
|
| 169 |
|
| 170 |
+
head_tracker = None
|
| 171 |
+
if HEAD_TRACKING_ENABLED and not SIM:
|
| 172 |
+
if args.head_tracker == "mediapipe":
|
| 173 |
+
head_tracker = MediapipeHeadTracker()
|
| 174 |
+
logger.info("Head tracking enabled with Mediapipe")
|
| 175 |
+
elif args.head_tracker == "yolo":
|
| 176 |
+
head_tracker = YoloHeadTracker()
|
| 177 |
+
logger.info("Head tracking enabled with YOLO")
|
| 178 |
+
elif HEAD_TRACKING_ENABLED and SIM:
|
| 179 |
logger.warning("Head tracking disabled while in Simulation")
|
| 180 |
else:
|
| 181 |
logger.warning("Head tracking disabled")
|
src/reachy_mini_conversation_demo/movement.py
CHANGED
|
@@ -9,7 +9,6 @@ import cv2
|
|
| 9 |
from reachy_mini import ReachyMini
|
| 10 |
from reachy_mini.reachy_mini import IMAGE_SIZE
|
| 11 |
from reachy_mini.utils import create_head_pose
|
| 12 |
-
from reachy_mini_conversation_demo.vision.yolo_head_tracker import HeadTracker
|
| 13 |
|
| 14 |
logger = logging.getLogger(__name__)
|
| 15 |
|
|
@@ -18,7 +17,7 @@ class MovementManager:
|
|
| 18 |
def __init__(
|
| 19 |
self,
|
| 20 |
current_robot: ReachyMini,
|
| 21 |
-
head_tracker
|
| 22 |
camera: cv2.VideoCapture | None,
|
| 23 |
):
|
| 24 |
self.current_robot = current_robot
|
|
|
|
| 9 |
from reachy_mini import ReachyMini
|
| 10 |
from reachy_mini.reachy_mini import IMAGE_SIZE
|
| 11 |
from reachy_mini.utils import create_head_pose
|
|
|
|
| 12 |
|
| 13 |
logger = logging.getLogger(__name__)
|
| 14 |
|
|
|
|
| 17 |
def __init__(
|
| 18 |
self,
|
| 19 |
current_robot: ReachyMini,
|
| 20 |
+
head_tracker,
|
| 21 |
camera: cv2.VideoCapture | None,
|
| 22 |
):
|
| 23 |
self.current_robot = current_robot
|
src/reachy_mini_conversation_demo/vision/mediapipe_head_tracker.py
DELETED
|
File without changes
|