Rename Koch classes
This commit is contained in:
parent
28cd3a6f3a
commit
2971bdfed5
|
@ -1,4 +1,2 @@
|
|||
from .configuration_koch import KochRobotConfig
|
||||
from .robot_koch import KochRobot
|
||||
|
||||
__all__ = ["KochRobotConfig", "KochRobot"]
|
||||
from .config_koch_follower import KochFollowerConfig
|
||||
from .koch_follower import KochFollower
|
||||
|
|
|
@ -5,10 +5,10 @@ from lerobot.common.cameras import CameraConfig
|
|||
from ..config import RobotConfig
|
||||
|
||||
|
||||
@RobotConfig.register_subclass("koch")
|
||||
@RobotConfig.register_subclass("koch_follower")
|
||||
@dataclass
|
||||
class KochRobotConfig(RobotConfig):
|
||||
# Port to connect to the robot
|
||||
class KochFollowerConfig(RobotConfig):
|
||||
# Port to connect to the arm
|
||||
port: str
|
||||
|
||||
disable_torque_on_disconnect: bool = True
|
|
@ -29,22 +29,22 @@ from lerobot.common.motors.dynamixel import (
|
|||
|
||||
from ..robot import Robot
|
||||
from ..utils import ensure_safe_goal_position
|
||||
from .configuration_koch import KochRobotConfig
|
||||
from .config_koch_follower import KochFollowerConfig
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class KochRobot(Robot):
|
||||
class KochFollower(Robot):
|
||||
"""
|
||||
- [Koch v1.0](https://github.com/AlexanderKoch-Koch/low_cost_robot), with and without the wrist-to-elbow
|
||||
expansion, developed by Alexander Koch from [Tau Robotics](https://tau-robotics.com)
|
||||
- [Koch v1.1](https://github.com/jess-moss/koch-v1-1) developed by Jess Moss
|
||||
"""
|
||||
|
||||
config_class = KochRobotConfig
|
||||
name = "koch"
|
||||
config_class = KochFollowerConfig
|
||||
name = "koch_follower"
|
||||
|
||||
def __init__(self, config: KochRobotConfig):
|
||||
def __init__(self, config: KochFollowerConfig):
|
||||
super().__init__(config)
|
||||
self.config = config
|
||||
self.arm = DynamixelMotorsBus(
|
||||
|
@ -222,9 +222,7 @@ class KochRobot(Robot):
|
|||
|
||||
def disconnect(self):
|
||||
if not self.is_connected:
|
||||
raise DeviceNotConnectedError(
|
||||
"ManipulatorRobot is not connected. You need to run `robot.connect()` before disconnecting."
|
||||
)
|
||||
raise DeviceNotConnectedError(f"{self} is not connected.")
|
||||
|
||||
self.arm.disconnect(self.config.disable_torque_on_disconnect)
|
||||
for cam in self.cameras.values():
|
|
@ -30,10 +30,10 @@ def make_robot_config(robot_type: str, **kwargs) -> RobotConfig:
|
|||
from .aloha.configuration_aloha import AlohaRobotConfig
|
||||
|
||||
return AlohaRobotConfig(**kwargs)
|
||||
elif robot_type == "koch":
|
||||
from .koch.configuration_koch import KochRobotConfig
|
||||
elif robot_type == "koch_follower":
|
||||
from .koch.config_koch_follower import KochFollowerConfig
|
||||
|
||||
return KochRobotConfig(**kwargs)
|
||||
return KochFollowerConfig(**kwargs)
|
||||
# elif robot_type == "koch_bimanual":
|
||||
# return KochBimanualRobotConfig(**kwargs)
|
||||
elif robot_type == "moss":
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
from .configuration_koch import KochTeleopConfig
|
||||
from .teleop_koch import KochTeleop
|
||||
|
||||
__all__ = ["KochTeleopConfig", "KochTeleop"]
|
||||
from .config_koch_leader import KochLeaderConfig
|
||||
from .koch_leader import KochLeader
|
||||
|
|
|
@ -19,10 +19,10 @@ from dataclasses import dataclass
|
|||
from ..config import TeleoperatorConfig
|
||||
|
||||
|
||||
@TeleoperatorConfig.register_subclass("koch")
|
||||
@TeleoperatorConfig.register_subclass("koch_leader")
|
||||
@dataclass
|
||||
class KochTeleopConfig(TeleoperatorConfig):
|
||||
# Port to connect to the teloperator
|
||||
class KochLeaderConfig(TeleoperatorConfig):
|
||||
# Port to connect to the arm
|
||||
port: str
|
||||
|
||||
# Sets the arm in torque mode with the gripper motor set to this value. This makes it possible to squeeze
|
|
@ -26,22 +26,22 @@ from lerobot.common.motors.dynamixel import (
|
|||
)
|
||||
|
||||
from ..teleoperator import Teleoperator
|
||||
from .configuration_koch import KochTeleopConfig
|
||||
from .config_koch_leader import KochLeaderConfig
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class KochTeleop(Teleoperator):
|
||||
class KochLeader(Teleoperator):
|
||||
"""
|
||||
- [Koch v1.0](https://github.com/AlexanderKoch-Koch/low_cost_robot), with and without the wrist-to-elbow
|
||||
expansion, developed by Alexander Koch from [Tau Robotics](https://tau-robotics.com)
|
||||
- [Koch v1.1](https://github.com/jess-moss/koch-v1-1) developed by Jess Moss
|
||||
"""
|
||||
|
||||
config_class = KochTeleopConfig
|
||||
name = "koch"
|
||||
config_class = KochLeaderConfig
|
||||
name = "koch_leader"
|
||||
|
||||
def __init__(self, config: KochTeleopConfig):
|
||||
def __init__(self, config: KochLeaderConfig):
|
||||
super().__init__(config)
|
||||
self.config = config
|
||||
self.arm = DynamixelMotorsBus(
|
||||
|
@ -147,6 +147,9 @@ class KochTeleop(Teleoperator):
|
|||
self.arm.write("Goal_Position", "gripper", self.config.gripper_open_pos)
|
||||
|
||||
def get_action(self) -> dict[str, float]:
|
||||
if not self.is_connected:
|
||||
raise DeviceNotConnectedError(f"{self} is not connected.")
|
||||
|
||||
start = time.perf_counter()
|
||||
action = self.arm.sync_read("Present_Position")
|
||||
dt_ms = (time.perf_counter() - start) * 1e3
|
||||
|
@ -159,9 +162,7 @@ class KochTeleop(Teleoperator):
|
|||
|
||||
def disconnect(self) -> None:
|
||||
if not self.is_connected:
|
||||
raise DeviceNotConnectedError(
|
||||
"ManipulatorRobot is not connected. You need to run `robot.connect()` before disconnecting."
|
||||
)
|
||||
raise DeviceNotConnectedError(f"{self} is not connected.")
|
||||
|
||||
self.arm.disconnect()
|
||||
logger.info(f"{self} disconnected.")
|
Loading…
Reference in New Issue