Spaces:
Running
Reachy Mini Head Tracking - look_at_image() moves in wrong direction
Hi Pollen Robotics community!
I'm working on a vision-based object tracking project with Reachy Mini Wireless and need help with head movement.
WHAT WORKS PERFECTLY:
- Object detection via OpenCV
- Camera access (mini.media.get_frame())
- Precise pixel position tracking
- Blue object detected reliably at position (cx, cy)
THE PROBLEM:
When I call mini.look_at_image(cx, cy), the head moves in the wrong direction:
- Object detected at right side of image → head rotates LEFT
- Expected: head turns toward object
- Actual: head rotates around left axis, often away from target
APPROACHES TESTED (all failed):
Direct approach:
mini.look_at_image(cx, cy, duration=0.3)
→ Wrong directionTwo-step with perform_movement=False:
target_pose = mini.look_at_image(cx, cy, perform_movement=False)
mini.set_target_head_pose(target_pose)
→ Still wrong directionSmall incremental movements:
Actions: ±5 pixels, duration=1.0s
→ Same issueVarious durations tested:
0.3s, 1.0s, 2.0s → No improvement
OBSERVATIONS:
- Head consistently rotates around wrong axis
- Movement appears to be inverting direction
- Sometimes moves away from target instead of toward it
- Happens with both direct look_at_image() and via pose matrix
MY QUESTIONS:
- Is look_at_image() the correct method for tracking moving objects?
- Could there be a calibration issue with pixel→head coordinate transform?
- Is there a known issue with coordinate systems in current SDK version?
- Do I need to apply any transformation to pixel coordinates first?
- Any example code for smooth object tracking with head movement?
TECHNICAL DETAILS:
- Hardware: Reachy Mini Wireless ($449 version)
- RPi: Raspberry Pi 5
- SDK: reachy-mini from pip (latest)
- Camera resolution: 1280x720
- Image center: (640, 360)
- Typical object position: (700-900, 200-300) when detected right of center
CODE EXAMPLE:
from reachy_mini import ReachyMini
import cv2
import numpy as np
mini = ReachyMini()
frame = mini.media.get_frame()
# Detect blue object (works perfectly)
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, np.array([105, 150, 100]),
np.array([120, 255, 255]))
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_SIMPLE)
if contours:
M = cv2.moments(max(contours, key=cv2.contourArea))
cx = int(M["m10"] / M["m00"])
cy = int(M["m01"] / M["m00"])
# Object detected at (cx, cy)
# Want head to look at this position
mini.look_at_image(cx, cy, duration=0.5) # ← Moves wrong direction
GOAL:
Build a smooth head tracking system where Reachy follows a moving object by keeping it centered in the camera view.
Has anyone successfully implemented object tracking with head movement? Any guidance would be greatly appreciated!
Thanks in advance for your help!
Late to this thread, but the report is specific enough to trace, so I did — through the SDK source, in both the February version (1.3.0, the one current when you filed this) and today's.
The pixel-to-pose computation itself looks sound. I ran its own code on your typical case, a detection at (800, 250) with the head at neutral: the pose it returns turns the head toward its right and pitches it up, toward the object, and projecting that pose back lands within about 7 px of the frame centre. That small residue is a known shortcut in the function — it aims from the head's origin rather than the camera's, a few centimetres away — an accuracy wart, not a direction fault. The camera transform underneath is a proper rotation with image-right landing on the head's right, and nothing in the frame path mirrors the image.
Which suggests the mirror you are seeing could sit one step further down: every approach you tried shares the daemon path that turns a target pose into motor motion, and a flip there would invert the SDK's poses too, exactly as you describe.
One reading would settle which side of that line it sits on. From a neutral head, call look_at_image(800, 250, perform_movement=False) and print the returned matrix: if the SDK side is healthy, its first column reads close to (0.97, −0.19, 0.13). If it does, a hand-built pose turned about ten degrees toward the head's right, sent through goto_target, would show whether the turn itself comes out mirrored. If the printed column differs from those numbers, the fault is in the SDK after all, and that printout is the proof to file.