mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-23 04:30:10 +00:00
Update with use_external_commands
This commit is contained in:
@@ -30,6 +30,7 @@ class Reachy2RobotConfig(RobotConfig):
|
|||||||
# the number of motors in your follower arms.
|
# the number of motors in your follower arms.
|
||||||
max_relative_target: int | None = None
|
max_relative_target: int | None = None
|
||||||
ip_address: str | None = "localhost"
|
ip_address: str | None = "localhost"
|
||||||
|
use_external_commands: bool = False
|
||||||
|
|
||||||
# cameras
|
# cameras
|
||||||
cameras: dict[str, CameraConfig] = field(
|
cameras: dict[str, CameraConfig] = field(
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ class DataAcquisitionServicer():
|
|||||||
self.robot_config = Reachy2RobotConfig(
|
self.robot_config = Reachy2RobotConfig(
|
||||||
ip_address=request.robot.ip_address,
|
ip_address=request.robot.ip_address,
|
||||||
id=request.robot.robot_id,
|
id=request.robot.robot_id,
|
||||||
|
use_external_commands=True,
|
||||||
)
|
)
|
||||||
self.teleop_config = Reachy2FakeTeleoperatorConfig(
|
self.teleop_config = Reachy2FakeTeleoperatorConfig(
|
||||||
ip_address=request.robot.ip_address,
|
ip_address=request.robot.ip_address,
|
||||||
@@ -328,10 +329,10 @@ class DataAcquisitionServicer():
|
|||||||
if not dataset_found:
|
if not dataset_found:
|
||||||
print(f"No dataset with name '{dataset.dataset_name}' found.")
|
print(f"No dataset with name '{dataset.dataset_name}' found.")
|
||||||
return
|
return
|
||||||
|
|
||||||
with open(json_filename, "w") as f:
|
with open(json_filename, "w") as f:
|
||||||
json.dump(data, f, indent=2)
|
json.dump(data, f, indent=2)
|
||||||
|
|
||||||
print(f"Dataset '{dataset.dataset_name}' updated successfully.")
|
print(f"Dataset '{dataset.dataset_name}' updated successfully.")
|
||||||
|
|
||||||
def dict_to_dataset(self, d: Dict) -> Dataset:
|
def dict_to_dataset(self, d: Dict) -> Dataset:
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ class Reachy2Robot(Robot):
|
|||||||
|
|
||||||
self.config = config
|
self.config = config
|
||||||
self.robot_type = self.config.type
|
self.robot_type = self.config.type
|
||||||
|
self.use_external_commands = self.config.use_external_commands
|
||||||
|
|
||||||
self.reachy: None | ReachySDK = None
|
self.reachy: None | ReachySDK = None
|
||||||
self.cameras = make_cameras_from_configs(config.cameras)
|
self.cameras = make_cameras_from_configs(config.cameras)
|
||||||
@@ -166,9 +167,10 @@ class Reachy2Robot(Robot):
|
|||||||
self.reachy.joints[REACHY2_JOINTS[key]].goal_position = val
|
self.reachy.joints[REACHY2_JOINTS[key]].goal_position = val
|
||||||
self.reachy.mobile_base.set_goal_speed(vel["vx"], vel["vy"], vel["vtheta"])
|
self.reachy.mobile_base.set_goal_speed(vel["vx"], vel["vy"], vel["vtheta"])
|
||||||
|
|
||||||
# # We don't want the teleoperator reachy2_specific to send the goal positions
|
# We don't send the goal positions if we control Reachy 2 externally
|
||||||
# self.reachy.send_goal_positions()
|
if not self.use_external_commands:
|
||||||
# self.reachy.send_speed_command()
|
self.reachy.send_goal_positions()
|
||||||
|
self.reachy.mobile_base.send_speed_command()
|
||||||
|
|
||||||
self.logs["write_pos_dt_s"] = time.perf_counter() - before_write_t
|
self.logs["write_pos_dt_s"] = time.perf_counter() - before_write_t
|
||||||
return action
|
return action
|
||||||
|
|||||||
Reference in New Issue
Block a user