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