mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-16 00:59:46 +00:00
black + isort
This commit is contained in:
@@ -12,11 +12,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from dataclasses import dataclass
|
||||
|
||||
from lerobot.cameras import CameraConfig
|
||||
from lerobot.cameras.reachy2_camera import Reachy2CameraConfig
|
||||
from lerobot.cameras.configs import ColorMode, Cv2Rotation
|
||||
from lerobot.cameras.reachy2_camera import Reachy2CameraConfig
|
||||
|
||||
from ..config import RobotConfig
|
||||
|
||||
@@ -51,33 +51,31 @@ class Reachy2RobotConfig(RobotConfig):
|
||||
with_right_teleop_camera: bool = True
|
||||
with_torso_camera: bool = False
|
||||
|
||||
mock: bool = False
|
||||
|
||||
def __post_init__(self):
|
||||
# Add cameras
|
||||
self.cameras: dict[str, CameraConfig] = {}
|
||||
if self.with_left_teleop_camera:
|
||||
self.cameras["teleop_left"] = Reachy2CameraConfig(
|
||||
name="teleop",
|
||||
image_type="left",
|
||||
ip_address=self.ip_address,
|
||||
fps=30,
|
||||
width=640,
|
||||
height=480,
|
||||
color_mode=ColorMode.RGB,
|
||||
rotation=Cv2Rotation.NO_ROTATION
|
||||
)
|
||||
name="teleop",
|
||||
image_type="left",
|
||||
ip_address=self.ip_address,
|
||||
fps=30,
|
||||
width=640,
|
||||
height=480,
|
||||
color_mode=ColorMode.RGB,
|
||||
rotation=Cv2Rotation.NO_ROTATION,
|
||||
)
|
||||
if self.with_right_teleop_camera:
|
||||
self.cameras["teleop_right"] = Reachy2CameraConfig(
|
||||
name="teleop",
|
||||
image_type="right",
|
||||
ip_address=self.ip_address,
|
||||
fps=30,
|
||||
width=640,
|
||||
height=480,
|
||||
color_mode=ColorMode.RGB,
|
||||
rotation=Cv2Rotation.NO_ROTATION
|
||||
)
|
||||
name="teleop",
|
||||
image_type="right",
|
||||
ip_address=self.ip_address,
|
||||
fps=30,
|
||||
width=640,
|
||||
height=480,
|
||||
color_mode=ColorMode.RGB,
|
||||
rotation=Cv2Rotation.NO_ROTATION,
|
||||
)
|
||||
if self.with_torso_camera:
|
||||
self.cameras["torso_rgb"] = Reachy2CameraConfig(
|
||||
name="depth",
|
||||
@@ -87,7 +85,7 @@ class Reachy2RobotConfig(RobotConfig):
|
||||
width=640,
|
||||
height=480,
|
||||
color_mode=ColorMode.RGB,
|
||||
rotation=Cv2Rotation.NO_ROTATION
|
||||
rotation=Cv2Rotation.NO_ROTATION,
|
||||
)
|
||||
|
||||
super().__post_init__()
|
||||
|
||||
@@ -15,12 +15,11 @@
|
||||
# limitations under the License.
|
||||
|
||||
import time
|
||||
|
||||
import numpy as np
|
||||
from reachy2_sdk import ReachySDK
|
||||
from typing import Any
|
||||
|
||||
import numpy as np
|
||||
from lerobot.cameras.utils import make_cameras_from_configs
|
||||
from reachy2_sdk import ReachySDK
|
||||
|
||||
from ..robot import Robot
|
||||
from .configuration_reachy2 import Reachy2RobotConfig
|
||||
@@ -98,20 +97,21 @@ class Reachy2Robot(Robot):
|
||||
|
||||
@property
|
||||
def camera_features(self) -> dict[str, dict]:
|
||||
return {
|
||||
cam: (self.cameras[cam].height, self.cameras[cam].width, 3) for cam in self.cameras
|
||||
}
|
||||
return {cam: (self.cameras[cam].height, self.cameras[cam].width, 3) for cam in self.cameras}
|
||||
|
||||
@property
|
||||
def motors_features(self) -> dict:
|
||||
if self.config.with_mobile_base:
|
||||
return {**dict.fromkeys(
|
||||
self.joints_dict.keys(),
|
||||
float,
|
||||
), **dict.fromkeys(
|
||||
REACHY2_VEL.keys(),
|
||||
float,
|
||||
)}
|
||||
return {
|
||||
**dict.fromkeys(
|
||||
self.joints_dict.keys(),
|
||||
float,
|
||||
),
|
||||
**dict.fromkeys(
|
||||
REACHY2_VEL.keys(),
|
||||
float,
|
||||
),
|
||||
}
|
||||
else:
|
||||
return dict.fromkeys(self.joints_dict.keys(), float)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from lerobot.robots.reachy2 import Reachy2Robot, Reachy2RobotConfig
|
||||
import time
|
||||
|
||||
from lerobot.robots.reachy2 import Reachy2Robot, Reachy2RobotConfig
|
||||
|
||||
# {lerobot_keys: reachy2_sdk_keys}
|
||||
REACHY2_JOINTS = {
|
||||
"neck_yaw.pos": "head.neck.yaw",
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import threading
|
||||
from lerobot.scripts.server.configs import RobotClientConfig
|
||||
|
||||
from lerobot.robots.reachy2 import Reachy2Robot, Reachy2RobotConfig
|
||||
|
||||
from lerobot.scripts.server.robot_client import RobotClient
|
||||
from lerobot.scripts.server.configs import RobotClientConfig
|
||||
from lerobot.scripts.server.helpers import visualize_action_queue_size
|
||||
|
||||
from lerobot.scripts.server.robot_client import RobotClient
|
||||
|
||||
robot_config = Reachy2RobotConfig(
|
||||
ip_address="192.168.0.199",
|
||||
|
||||
Reference in New Issue
Block a user