Browse Source

Rotate wrist camera images: left 90° CCW, right 90° CCW

Wrist cameras are mounted sideways on the robot, so the raw images
need rotation to display upright in the Quest VR camera dashboard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
master
melancholytron 3 weeks ago
parent
commit
85ff08537b
  1. 14
      server/retarget_bridge.py

14
server/retarget_bridge.py

@ -624,11 +624,11 @@ def start_camera_relay(server, zmq_port=55555):
except Exception: except Exception:
pass pass
# SHM name -> (camera_id, jpeg_quality)
# SHM name -> (camera_id, jpeg_quality, cv2_rotation or None)
CAMERAS = [ CAMERAS = [
("head", 0, 85),
("left", 1, 70),
("right", 2, 70),
("head", 0, 85, None),
("left", 1, 70, cv2.ROTATE_90_COUNTERCLOCKWISE),
("right", 2, 70, cv2.ROTATE_90_COUNTERCLOCKWISE),
] ]
def _relay_loop(): def _relay_loop():
@ -640,7 +640,7 @@ def start_camera_relay(server, zmq_port=55555):
logger.info("Camera relay: waiting for Isaac Sim shared memory...") logger.info("Camera relay: waiting for Isaac Sim shared memory...")
# Wait for at least one camera # Wait for at least one camera
while not active_cameras: while not active_cameras:
for name, cam_id, quality in CAMERAS:
for name, cam_id, quality, rotation in CAMERAS:
img = reader.read_single_image(name) img = reader.read_single_image(name)
if img is not None: if img is not None:
active_cameras.add(name) active_cameras.add(name)
@ -654,7 +654,7 @@ def start_camera_relay(server, zmq_port=55555):
while True: while True:
try: try:
for name, cam_id, quality in CAMERAS:
for name, cam_id, quality, rotation in CAMERAS:
if name not in active_cameras: if name not in active_cameras:
# Periodically retry missing cameras # Periodically retry missing cameras
if frame_counts["head"] % 150 == 0: if frame_counts["head"] % 150 == 0:
@ -671,6 +671,8 @@ def start_camera_relay(server, zmq_port=55555):
cur_ts = reader.last_timestamps.get(name, 0) cur_ts = reader.last_timestamps.get(name, 0)
if cur_ts > last_ts[name]: if cur_ts > last_ts[name]:
last_ts[name] = cur_ts last_ts[name] = cur_ts
if rotation is not None:
img = cv2.rotate(img, rotation)
ok, buf = cv2.imencode(".jpg", img, [cv2.IMWRITE_JPEG_QUALITY, quality]) ok, buf = cv2.imencode(".jpg", img, [cv2.IMWRITE_JPEG_QUALITY, quality])
if ok: if ok:
server.set_webcam_frame(buf.tobytes(), camera_id=cam_id) server.set_webcam_frame(buf.tobytes(), camera_id=cam_id)

Loading…
Cancel
Save