Add Motor in dxl robots
This commit is contained in:
parent
e047074825
commit
1f1e1bcfe8
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from ..motors_bus import MotorsBus
|
from ..motors_bus import Motor, MotorsBus
|
||||||
from .tables import MODEL_BAUDRATE_TABLE, MODEL_CONTROL_TABLE, MODEL_RESOLUTION
|
from .tables import MODEL_BAUDRATE_TABLE, MODEL_CONTROL_TABLE, MODEL_RESOLUTION
|
||||||
|
|
||||||
PROTOCOL_VERSION = 2.0
|
PROTOCOL_VERSION = 2.0
|
||||||
|
@ -48,7 +48,7 @@ class DynamixelMotorsBus(MotorsBus):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
port: str,
|
port: str,
|
||||||
motors: dict[str, tuple[int, str]],
|
motors: dict[str, Motor],
|
||||||
):
|
):
|
||||||
super().__init__(port, motors)
|
super().__init__(port, motors)
|
||||||
import dynamixel_sdk as dxl
|
import dynamixel_sdk as dxl
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from ..motors_bus import MotorsBus
|
from ..motors_bus import Motor, MotorsBus
|
||||||
from .tables import (
|
from .tables import (
|
||||||
CALIBRATION_REQUIRED,
|
CALIBRATION_REQUIRED,
|
||||||
MODEL_BAUDRATE_TABLE,
|
MODEL_BAUDRATE_TABLE,
|
||||||
|
@ -44,7 +44,7 @@ class FeetechMotorsBus(MotorsBus):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
port: str,
|
port: str,
|
||||||
motors: dict[str, tuple[int, str]],
|
motors: dict[str, Motor],
|
||||||
):
|
):
|
||||||
super().__init__(port, motors)
|
super().__init__(port, motors)
|
||||||
import scservo_sdk as scs
|
import scservo_sdk as scs
|
||||||
|
|
|
@ -23,7 +23,7 @@ import numpy as np
|
||||||
from lerobot.common.cameras.utils import make_cameras_from_configs
|
from lerobot.common.cameras.utils import make_cameras_from_configs
|
||||||
from lerobot.common.constants import OBS_IMAGES, OBS_STATE
|
from lerobot.common.constants import OBS_IMAGES, OBS_STATE
|
||||||
from lerobot.common.errors import DeviceAlreadyConnectedError, DeviceNotConnectedError
|
from lerobot.common.errors import DeviceAlreadyConnectedError, DeviceNotConnectedError
|
||||||
from lerobot.common.motors import TorqueMode
|
from lerobot.common.motors import CalibrationMode, Motor, TorqueMode
|
||||||
from lerobot.common.motors.dynamixel import (
|
from lerobot.common.motors.dynamixel import (
|
||||||
DynamixelMotorsBus,
|
DynamixelMotorsBus,
|
||||||
run_arm_calibration,
|
run_arm_calibration,
|
||||||
|
@ -52,12 +52,12 @@ class KochRobot(Robot):
|
||||||
self.arm = DynamixelMotorsBus(
|
self.arm = DynamixelMotorsBus(
|
||||||
port=self.config.port,
|
port=self.config.port,
|
||||||
motors={
|
motors={
|
||||||
"shoulder_pan": (1, "xl430-w250"),
|
"shoulder_pan": Motor(1, "xl430-w250", CalibrationMode.RANGE_M100_100),
|
||||||
"shoulder_lift": (2, "xl430-w250"),
|
"shoulder_lift": Motor(2, "xl430-w250", CalibrationMode.RANGE_M100_100),
|
||||||
"elbow_flex": (3, "xl330-m288"),
|
"elbow_flex": Motor(3, "xl330-m288", CalibrationMode.RANGE_M100_100),
|
||||||
"wrist_flex": (4, "xl330-m288"),
|
"wrist_flex": Motor(4, "xl330-m288", CalibrationMode.RANGE_M100_100),
|
||||||
"wrist_roll": (5, "xl330-m288"),
|
"wrist_roll": Motor(5, "xl330-m288", CalibrationMode.RANGE_M100_100),
|
||||||
"gripper": (6, "xl330-m288"),
|
"gripper": Motor(6, "xl330-m288", CalibrationMode.RANGE_0_100),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.cameras = make_cameras_from_configs(config.cameras)
|
self.cameras = make_cameras_from_configs(config.cameras)
|
||||||
|
|
|
@ -20,20 +20,8 @@ class ViperXRobotConfig(RobotConfig):
|
||||||
# then to gradually add more motors (by uncommenting), until you can teleoperate both arms fully
|
# then to gradually add more motors (by uncommenting), until you can teleoperate both arms fully
|
||||||
max_relative_target: int | None = 5
|
max_relative_target: int | None = 5
|
||||||
|
|
||||||
waist: tuple = (1, "xm540-w270")
|
|
||||||
shoulder: tuple = (2, "xm540-w270")
|
|
||||||
shoulder_shadow: tuple = (3, "xm540-w270")
|
|
||||||
elbow: tuple = (4, "xm540-w270")
|
|
||||||
elbow_shadow: tuple = (5, "xm540-w270")
|
|
||||||
forearm_roll: tuple = (6, "xm540-w270")
|
|
||||||
wrist_angle: tuple = (7, "xm540-w270")
|
|
||||||
wrist_rotate: tuple = (8, "xm430-w350")
|
|
||||||
gripper: tuple = (9, "xm430-w350")
|
|
||||||
|
|
||||||
# cameras
|
# cameras
|
||||||
cameras: dict[str, CameraConfig] = field(default_factory=dict)
|
cameras: dict[str, CameraConfig] = field(default_factory=dict)
|
||||||
# Troubleshooting: If one of your IntelRealSense cameras freeze during
|
# Troubleshooting: If one of your IntelRealSense cameras freeze during
|
||||||
# data recording due to bandwidth limit, you might need to plug the camera
|
# data recording due to bandwidth limit, you might need to plug the camera
|
||||||
# on another USB hub or PCIe card.
|
# on another USB hub or PCIe card.
|
||||||
|
|
||||||
mock: bool = False
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import numpy as np
|
||||||
from lerobot.common.cameras.utils import make_cameras_from_configs
|
from lerobot.common.cameras.utils import make_cameras_from_configs
|
||||||
from lerobot.common.constants import OBS_IMAGES, OBS_STATE
|
from lerobot.common.constants import OBS_IMAGES, OBS_STATE
|
||||||
from lerobot.common.errors import DeviceAlreadyConnectedError, DeviceNotConnectedError
|
from lerobot.common.errors import DeviceAlreadyConnectedError, DeviceNotConnectedError
|
||||||
from lerobot.common.motors import TorqueMode
|
from lerobot.common.motors import CalibrationMode, Motor, TorqueMode
|
||||||
from lerobot.common.motors.dynamixel import (
|
from lerobot.common.motors.dynamixel import (
|
||||||
DynamixelMotorsBus,
|
DynamixelMotorsBus,
|
||||||
run_arm_calibration,
|
run_arm_calibration,
|
||||||
|
@ -43,15 +43,15 @@ class ViperXRobot(Robot):
|
||||||
self.arm = DynamixelMotorsBus(
|
self.arm = DynamixelMotorsBus(
|
||||||
port=self.config.port,
|
port=self.config.port,
|
||||||
motors={
|
motors={
|
||||||
"waist": config.waist,
|
"waist": Motor(1, "xm540-w270", CalibrationMode.RANGE_M100_100),
|
||||||
"shoulder": config.shoulder,
|
"shoulder": Motor(2, "xm540-w270", CalibrationMode.RANGE_M100_100),
|
||||||
"shoulder_shadow": config.shoulder_shadow,
|
"shoulder_shadow": Motor(3, "xm540-w270", CalibrationMode.RANGE_M100_100),
|
||||||
"elbow": config.elbow,
|
"elbow": Motor(4, "xm540-w270", CalibrationMode.RANGE_M100_100),
|
||||||
"elbow_shadow": config.elbow_shadow,
|
"elbow_shadow": Motor(5, "xm540-w270", CalibrationMode.RANGE_M100_100),
|
||||||
"forearm_roll": config.forearm_roll,
|
"forearm_roll": Motor(6, "xm540-w270", CalibrationMode.RANGE_M100_100),
|
||||||
"wrist_angle": config.wrist_angle,
|
"wrist_angle": Motor(7, "xm540-w270", CalibrationMode.RANGE_M100_100),
|
||||||
"wrist_rotate": config.wrist_rotate,
|
"wrist_rotate": Motor(8, "xm430-w350", CalibrationMode.RANGE_M100_100),
|
||||||
"gripper": config.gripper,
|
"gripper": Motor(9, "xm430-w350", CalibrationMode.RANGE_0_100),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.cameras = make_cameras_from_configs(config.cameras)
|
self.cameras = make_cameras_from_configs(config.cameras)
|
||||||
|
|
|
@ -21,7 +21,7 @@ import time
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from lerobot.common.errors import DeviceAlreadyConnectedError, DeviceNotConnectedError
|
from lerobot.common.errors import DeviceAlreadyConnectedError, DeviceNotConnectedError
|
||||||
from lerobot.common.motors import TorqueMode
|
from lerobot.common.motors import CalibrationMode, Motor, TorqueMode
|
||||||
from lerobot.common.motors.dynamixel import (
|
from lerobot.common.motors.dynamixel import (
|
||||||
DynamixelMotorsBus,
|
DynamixelMotorsBus,
|
||||||
run_arm_calibration,
|
run_arm_calibration,
|
||||||
|
@ -49,12 +49,12 @@ class KochTeleop(Teleoperator):
|
||||||
self.arm = DynamixelMotorsBus(
|
self.arm = DynamixelMotorsBus(
|
||||||
port=self.config.port,
|
port=self.config.port,
|
||||||
motors={
|
motors={
|
||||||
"shoulder_pan": (1, "xl330-m077"),
|
"shoulder_pan": Motor(1, "xl330-m077", CalibrationMode.RANGE_M100_100),
|
||||||
"shoulder_lift": (2, "xl330-m077"),
|
"shoulder_lift": Motor(2, "xl330-m077", CalibrationMode.RANGE_M100_100),
|
||||||
"elbow_flex": (3, "xl330-m077"),
|
"elbow_flex": Motor(3, "xl330-m077", CalibrationMode.RANGE_M100_100),
|
||||||
"wrist_flex": (4, "xl330-m077"),
|
"wrist_flex": Motor(4, "xl330-m077", CalibrationMode.RANGE_M100_100),
|
||||||
"wrist_roll": (5, "xl330-m077"),
|
"wrist_roll": Motor(5, "xl330-m077", CalibrationMode.RANGE_M100_100),
|
||||||
"gripper": (6, "xl330-m077"),
|
"gripper": Motor(6, "xl330-m077", CalibrationMode.RANGE_0_100),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -36,14 +36,3 @@ class WidowXTeleopConfig(TeleoperatorConfig):
|
||||||
# first try to teleoperate the grippers only (by commenting out the rest of the motors in this yaml),
|
# first try to teleoperate the grippers only (by commenting out the rest of the motors in this yaml),
|
||||||
# then to gradually add more motors (by uncommenting), until you can teleoperate both arms fully
|
# then to gradually add more motors (by uncommenting), until you can teleoperate both arms fully
|
||||||
max_relative_target: int | None = 5
|
max_relative_target: int | None = 5
|
||||||
|
|
||||||
# motors
|
|
||||||
waist: tuple = (1, "xm430-w350")
|
|
||||||
shoulder: tuple = (2, "xm430-w350")
|
|
||||||
shoulder_shadow: tuple = (3, "xm430-w350")
|
|
||||||
elbow: tuple = (4, "xm430-w350")
|
|
||||||
elbow_shadow: tuple = (5, "xm430-w350")
|
|
||||||
forearm_roll: tuple = (6, "xm430-w350")
|
|
||||||
wrist_angle: tuple = (7, "xm430-w350")
|
|
||||||
wrist_rotate: tuple = (8, "xl430-w250")
|
|
||||||
gripper: tuple = (9, "xc430-w150")
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import time
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from lerobot.common.errors import DeviceAlreadyConnectedError, DeviceNotConnectedError
|
from lerobot.common.errors import DeviceAlreadyConnectedError, DeviceNotConnectedError
|
||||||
from lerobot.common.motors import TorqueMode
|
from lerobot.common.motors import CalibrationMode, Motor, TorqueMode
|
||||||
from lerobot.common.motors.dynamixel import (
|
from lerobot.common.motors.dynamixel import (
|
||||||
DynamixelMotorsBus,
|
DynamixelMotorsBus,
|
||||||
run_arm_calibration,
|
run_arm_calibration,
|
||||||
|
@ -47,15 +47,15 @@ class WidowXTeleop(Teleoperator):
|
||||||
self.arm = DynamixelMotorsBus(
|
self.arm = DynamixelMotorsBus(
|
||||||
port=self.config.port,
|
port=self.config.port,
|
||||||
motors={
|
motors={
|
||||||
"waist": config.waist,
|
"waist": Motor(1, "xm430-w350", CalibrationMode.RANGE_M100_100),
|
||||||
"shoulder": config.shoulder,
|
"shoulder": Motor(2, "xm430-w350", CalibrationMode.RANGE_M100_100),
|
||||||
"shoulder_shadow": config.shoulder_shadow,
|
"shoulder_shadow": Motor(3, "xm430-w350", CalibrationMode.RANGE_M100_100),
|
||||||
"elbow": config.elbow,
|
"elbow": Motor(4, "xm430-w350", CalibrationMode.RANGE_M100_100),
|
||||||
"elbow_shadow": config.elbow_shadow,
|
"elbow_shadow": Motor(5, "xm430-w350", CalibrationMode.RANGE_M100_100),
|
||||||
"forearm_roll": config.forearm_roll,
|
"forearm_roll": Motor(6, "xm430-w350", CalibrationMode.RANGE_M100_100),
|
||||||
"wrist_angle": config.wrist_angle,
|
"wrist_angle": Motor(7, "xm430-w350", CalibrationMode.RANGE_M100_100),
|
||||||
"wrist_rotate": config.wrist_rotate,
|
"wrist_rotate": Motor(8, "xl430-w250", CalibrationMode.RANGE_M100_100),
|
||||||
"gripper": config.gripper,
|
"gripper": Motor(9, "xc430-w150", CalibrationMode.RANGE_0_100),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue