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