Add CalibrationMode
This commit is contained in:
parent
c2e761437d
commit
e047074825
|
@ -74,10 +74,17 @@ class DriveMode(Enum):
|
|||
|
||||
|
||||
class CalibrationMode(Enum):
|
||||
# Joints with rotational motions are expressed in degrees in nominal range of [-180, 180]
|
||||
DEGREE = 0
|
||||
# Joints with liner motions (like gripper of Aloha) are expressed in nominal range of [0, 100]
|
||||
LINEAR = 1
|
||||
RANGE_0_100 = 1
|
||||
RANGE_M100_100 = 2
|
||||
VELOCITY = 3
|
||||
|
||||
|
||||
@dataclass
|
||||
class Motor:
|
||||
id: int
|
||||
model: str
|
||||
calibration: CalibrationMode
|
||||
|
||||
|
||||
class JointOutOfRangeError(Exception):
|
||||
|
@ -190,12 +197,6 @@ class GroupSyncWrite(Protocol):
|
|||
def txPacket(self): ...
|
||||
|
||||
|
||||
@dataclass
|
||||
class Motor:
|
||||
id: int
|
||||
model: str
|
||||
|
||||
|
||||
class MotorsBus(abc.ABC):
|
||||
"""The main LeRobot class for implementing motors buses.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from unittest.mock import patch
|
|||
import dynamixel_sdk as dxl
|
||||
import pytest
|
||||
|
||||
from lerobot.common.motors import Motor
|
||||
from lerobot.common.motors import CalibrationMode, Motor
|
||||
from lerobot.common.motors.dynamixel import DynamixelMotorsBus
|
||||
from tests.mocks.mock_dynamixel import MockMotors, MockPortHandler
|
||||
|
||||
|
@ -30,9 +30,9 @@ def mock_motors() -> Generator[MockMotors, None, None]:
|
|||
@pytest.fixture
|
||||
def dummy_motors() -> dict[str, Motor]:
|
||||
return {
|
||||
"dummy_1": Motor(id=1, model="xl430-w250"),
|
||||
"dummy_2": Motor(id=2, model="xm540-w270"),
|
||||
"dummy_3": Motor(id=3, model="xl330-m077"),
|
||||
"dummy_1": Motor(1, "xl430-w250", CalibrationMode.RANGE_M100_100),
|
||||
"dummy_2": Motor(2, "xm540-w270", CalibrationMode.RANGE_M100_100),
|
||||
"dummy_3": Motor(3, "xl330-m077", CalibrationMode.RANGE_M100_100),
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from unittest.mock import patch
|
|||
import pytest
|
||||
import scservo_sdk as scs
|
||||
|
||||
from lerobot.common.motors import Motor
|
||||
from lerobot.common.motors import CalibrationMode, Motor
|
||||
from lerobot.common.motors.feetech import FeetechMotorsBus
|
||||
from tests.mocks.mock_feetech import MockMotors, MockPortHandler
|
||||
|
||||
|
@ -30,9 +30,9 @@ def mock_motors() -> Generator[MockMotors, None, None]:
|
|||
@pytest.fixture
|
||||
def dummy_motors() -> dict[str, Motor]:
|
||||
return {
|
||||
"dummy_1": Motor(id=1, model="sts3215"),
|
||||
"dummy_2": Motor(id=2, model="sts3215"),
|
||||
"dummy_3": Motor(id=3, model="sts3215"),
|
||||
"dummy_1": Motor(1, "sts3215", CalibrationMode.RANGE_M100_100),
|
||||
"dummy_2": Motor(2, "sts3215", CalibrationMode.RANGE_M100_100),
|
||||
"dummy_3": Motor(3, "sts3215", CalibrationMode.RANGE_M100_100),
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue