From 039beb20de25552e93d69d1455a545a23c801e5c Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 18 Nov 2024 18:28:57 +0100 Subject: [PATCH] simulated camera seems ok --- lerobot/common/robot_devices/robots/reachy2.py | 4 ++-- lerobot/scripts/test_reachy.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lerobot/common/robot_devices/robots/reachy2.py b/lerobot/common/robot_devices/robots/reachy2.py index cdbd00dd..e7cf3901 100644 --- a/lerobot/common/robot_devices/robots/reachy2.py +++ b/lerobot/common/robot_devices/robots/reachy2.py @@ -21,7 +21,7 @@ import numpy as np import torch from lerobot.common.robot_devices.cameras.utils import Camera from reachy2_sdk import ReachySDK - +from copy import copy @@ -122,7 +122,7 @@ class ReachyRobot(): images[name] = self.cameras[name].read() #Reachy cameras read() is not blocking? print(f'name: {name} img: {images[name]}') if images[name] is not None: - images[name] = torch.from_numpy(images[name][0]) + images[name] = torch.from_numpy(copy(images[name][0])) #seems like I need to copy? self.logs[f"read_camera_{name}_dt_s"] = images[name][1] #full timestamp, TODO dt # Populate output dictionnaries diff --git a/lerobot/scripts/test_reachy.py b/lerobot/scripts/test_reachy.py index 0d939d28..97e1cca8 100644 --- a/lerobot/scripts/test_reachy.py +++ b/lerobot/scripts/test_reachy.py @@ -22,6 +22,7 @@ from lerobot.common.utils.utils import (init_hydra_config, init_logging, log_say, none_or_int) +import time import cv2 if __name__ == '__main__': init_logging() @@ -35,3 +36,4 @@ if __name__ == '__main__': print(robot.get_state()) print(robot.capture_observation()) + time.sleep(6)