mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-15 08:39:49 +00:00
Rename reachy2_teleoperator
This commit is contained in:
@@ -64,7 +64,7 @@ python -m lerobot.record \
|
||||
--robot.id=r2-0000 \
|
||||
--robot.use_external_commands=true \
|
||||
--robot.with_mobile_base=false \
|
||||
--teleop.type=reachy2_fake_teleoperator \
|
||||
--teleop.type=reachy2_teleoperator \
|
||||
--teleop.ip_address=192.168.0.200 \
|
||||
--teleop.with_mobile_base=false \
|
||||
--dataset.repo_id=pollen_robotics/record_test \
|
||||
@@ -116,7 +116,7 @@ python -m lerobot.record \
|
||||
--robot.with_left_teleop_camera=true \
|
||||
--robot.with_right_teleop_camera=true \
|
||||
--robot.with_torso_camera=true \
|
||||
--teleop.type=reachy2_fake_teleoperator \
|
||||
--teleop.type=reachy2_teleoperator \
|
||||
--teleop.ip_address=192.168.0.200 \
|
||||
--teleop.with_mobile_base=false \
|
||||
--teleop.with_l_arm=true \
|
||||
|
||||
+2
-2
@@ -14,5 +14,5 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from .config_reachy2_fake_teleoperator import Reachy2FakeTeleoperatorConfig
|
||||
from .reachy2_fake_teleoperator import Reachy2FakeTeleoperator
|
||||
from .config_reachy2_teleoperator import Reachy2TeleoperatorConfig
|
||||
from .reachy2_teleoperator import Reachy2Teleoperator
|
||||
+2
-2
@@ -19,9 +19,9 @@ from dataclasses import dataclass
|
||||
from ..config import TeleoperatorConfig
|
||||
|
||||
|
||||
@TeleoperatorConfig.register_subclass("reachy2_fake_teleoperator")
|
||||
@TeleoperatorConfig.register_subclass("reachy2_teleoperator")
|
||||
@dataclass
|
||||
class Reachy2FakeTeleoperatorConfig(TeleoperatorConfig):
|
||||
class Reachy2TeleoperatorConfig(TeleoperatorConfig):
|
||||
# Port to connect to the arm
|
||||
ip_address: str | None = "localhost"
|
||||
with_mobile_base: bool = True
|
||||
+12
-6
@@ -26,7 +26,7 @@ import time
|
||||
from reachy2_sdk import ReachySDK
|
||||
|
||||
from ..teleoperator import Teleoperator
|
||||
from .config_reachy2_fake_teleoperator import Reachy2FakeTeleoperatorConfig
|
||||
from .config_reachy2_teleoperator import Reachy2TeleoperatorConfig
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -71,15 +71,15 @@ REACHY2_VEL = {
|
||||
}
|
||||
|
||||
|
||||
class Reachy2FakeTeleoperator(Teleoperator):
|
||||
class Reachy2Teleoperator(Teleoperator):
|
||||
"""
|
||||
[Reachy 2](https://www.pollen-robotics.com/reachy/), by Pollen Robotics.
|
||||
"""
|
||||
|
||||
config_class = Reachy2FakeTeleoperatorConfig
|
||||
config_class = Reachy2TeleoperatorConfig
|
||||
name = "reachy2_specific"
|
||||
|
||||
def __init__(self, config: Reachy2FakeTeleoperatorConfig):
|
||||
def __init__(self, config: Reachy2TeleoperatorConfig):
|
||||
super().__init__(config)
|
||||
self.config = config
|
||||
self.reachy: None | ReachySDK = None
|
||||
@@ -142,12 +142,18 @@ class Reachy2FakeTeleoperator(Teleoperator):
|
||||
start = time.perf_counter()
|
||||
|
||||
if self.reachy and self.is_connected:
|
||||
joint_action = {k: self.reachy.joints_dict[v].goal_position for k, v in self.joints_dict.items()}
|
||||
joint_action = {
|
||||
k: self.reachy.joints[v].goal_position
|
||||
for k, v in self.joints_dict.items()
|
||||
}
|
||||
if not self.config.with_mobile_base:
|
||||
dt_ms = (time.perf_counter() - start) * 1e3
|
||||
logger.debug(f"{self} read action: {dt_ms:.1f}ms")
|
||||
return joint_action
|
||||
vel_action = {k: self.reachy.mobile_base.last_cmd_vel[v] for k, v in REACHY2_VEL.items()}
|
||||
vel_action = {
|
||||
k: self.reachy.mobile_base.last_cmd_vel[v]
|
||||
for k, v in REACHY2_VEL.items()
|
||||
}
|
||||
dt_ms = (time.perf_counter() - start) * 1e3
|
||||
logger.debug(f"{self} read action: {dt_ms:.1f}ms")
|
||||
return {**joint_action, **vel_action}
|
||||
@@ -65,9 +65,9 @@ def make_teleoperator_from_config(config: TeleoperatorConfig) -> Teleoperator:
|
||||
from .bi_so100_leader import BiSO100Leader
|
||||
|
||||
return BiSO100Leader(config)
|
||||
elif config.type == "reachy2_fake_teleoperator":
|
||||
from .reachy2_fake_teleoperator import Reachy2FakeTeleoperator
|
||||
elif config.type == "reachy2_teleoperator":
|
||||
from .reachy2_teleoperator import Reachy2Teleoperator
|
||||
|
||||
return Reachy2FakeTeleoperator(config)
|
||||
return Reachy2Teleoperator(config)
|
||||
else:
|
||||
raise ValueError(config.type)
|
||||
|
||||
Reference in New Issue
Block a user