mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-22 12:09:42 +00:00
fix(robots): openarm features with openarmmini (#3524)
This commit is contained in:
@@ -54,6 +54,7 @@ class BiOpenArmFollower(Robot):
|
|||||||
calibration_dir=config.calibration_dir,
|
calibration_dir=config.calibration_dir,
|
||||||
port=config.left_arm_config.port,
|
port=config.left_arm_config.port,
|
||||||
disable_torque_on_disconnect=config.left_arm_config.disable_torque_on_disconnect,
|
disable_torque_on_disconnect=config.left_arm_config.disable_torque_on_disconnect,
|
||||||
|
use_velocity_and_torque=config.left_arm_config.use_velocity_and_torque,
|
||||||
max_relative_target=config.left_arm_config.max_relative_target,
|
max_relative_target=config.left_arm_config.max_relative_target,
|
||||||
cameras=left_cameras,
|
cameras=left_cameras,
|
||||||
side=config.left_arm_config.side,
|
side=config.left_arm_config.side,
|
||||||
@@ -72,6 +73,7 @@ class BiOpenArmFollower(Robot):
|
|||||||
calibration_dir=config.calibration_dir,
|
calibration_dir=config.calibration_dir,
|
||||||
port=config.right_arm_config.port,
|
port=config.right_arm_config.port,
|
||||||
disable_torque_on_disconnect=config.right_arm_config.disable_torque_on_disconnect,
|
disable_torque_on_disconnect=config.right_arm_config.disable_torque_on_disconnect,
|
||||||
|
use_velocity_and_torque=config.right_arm_config.use_velocity_and_torque,
|
||||||
max_relative_target=config.right_arm_config.max_relative_target,
|
max_relative_target=config.right_arm_config.max_relative_target,
|
||||||
cameras=right_cameras,
|
cameras=right_cameras,
|
||||||
side=config.right_arm_config.side,
|
side=config.right_arm_config.side,
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ class OpenArmFollowerConfigBase:
|
|||||||
# Whether to disable torque when disconnecting
|
# Whether to disable torque when disconnecting
|
||||||
disable_torque_on_disconnect: bool = True
|
disable_torque_on_disconnect: bool = True
|
||||||
|
|
||||||
|
# When True, expose `.vel` and `.torque` per motor in observation features.
|
||||||
|
# Default False for compatibility with the position-only openarm_mini teleoperator.
|
||||||
|
use_velocity_and_torque: bool = False
|
||||||
|
|
||||||
# Safety limit for relative target positions
|
# Safety limit for relative target positions
|
||||||
# Set to a positive scalar for all motors, or a dict mapping motor names to limits
|
# Set to a positive scalar for all motors, or a dict mapping motor names to limits
|
||||||
max_relative_target: float | dict[str, float] | None = None
|
max_relative_target: float | dict[str, float] | None = None
|
||||||
|
|||||||
@@ -93,8 +93,9 @@ class OpenArmFollower(Robot):
|
|||||||
features: dict[str, type] = {}
|
features: dict[str, type] = {}
|
||||||
for motor in self.bus.motors:
|
for motor in self.bus.motors:
|
||||||
features[f"{motor}.pos"] = float
|
features[f"{motor}.pos"] = float
|
||||||
features[f"{motor}.vel"] = float # Add this
|
if self.config.use_velocity_and_torque:
|
||||||
features[f"{motor}.torque"] = float # Add this
|
features[f"{motor}.vel"] = float
|
||||||
|
features[f"{motor}.torque"] = float
|
||||||
return features
|
return features
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -235,6 +236,7 @@ class OpenArmFollower(Robot):
|
|||||||
for motor in self.bus.motors:
|
for motor in self.bus.motors:
|
||||||
state = states.get(motor, {})
|
state = states.get(motor, {})
|
||||||
obs_dict[f"{motor}.pos"] = state.get("position", 0.0)
|
obs_dict[f"{motor}.pos"] = state.get("position", 0.0)
|
||||||
|
if self.config.use_velocity_and_torque:
|
||||||
obs_dict[f"{motor}.vel"] = state.get("velocity", 0.0)
|
obs_dict[f"{motor}.vel"] = state.get("velocity", 0.0)
|
||||||
obs_dict[f"{motor}.torque"] = state.get("torque", 0.0)
|
obs_dict[f"{motor}.torque"] = state.get("torque", 0.0)
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class BiOpenArmLeader(Teleoperator):
|
|||||||
can_data_bitrate=config.left_arm_config.can_data_bitrate,
|
can_data_bitrate=config.left_arm_config.can_data_bitrate,
|
||||||
motor_config=config.left_arm_config.motor_config,
|
motor_config=config.left_arm_config.motor_config,
|
||||||
manual_control=config.left_arm_config.manual_control,
|
manual_control=config.left_arm_config.manual_control,
|
||||||
|
use_velocity_and_torque=config.left_arm_config.use_velocity_and_torque,
|
||||||
position_kd=config.left_arm_config.position_kd,
|
position_kd=config.left_arm_config.position_kd,
|
||||||
position_kp=config.left_arm_config.position_kp,
|
position_kp=config.left_arm_config.position_kp,
|
||||||
)
|
)
|
||||||
@@ -63,6 +64,7 @@ class BiOpenArmLeader(Teleoperator):
|
|||||||
can_data_bitrate=config.right_arm_config.can_data_bitrate,
|
can_data_bitrate=config.right_arm_config.can_data_bitrate,
|
||||||
motor_config=config.right_arm_config.motor_config,
|
motor_config=config.right_arm_config.motor_config,
|
||||||
manual_control=config.right_arm_config.manual_control,
|
manual_control=config.right_arm_config.manual_control,
|
||||||
|
use_velocity_and_torque=config.right_arm_config.use_velocity_and_torque,
|
||||||
position_kd=config.right_arm_config.position_kd,
|
position_kd=config.right_arm_config.position_kd,
|
||||||
position_kp=config.right_arm_config.position_kp,
|
position_kp=config.right_arm_config.position_kp,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ class OpenArmLeaderConfigBase:
|
|||||||
# When enabled, motors have torque disabled for manual movement
|
# When enabled, motors have torque disabled for manual movement
|
||||||
manual_control: bool = True
|
manual_control: bool = True
|
||||||
|
|
||||||
|
# When True, expose `.vel` and `.torque` per motor in action features.
|
||||||
|
# Default False for compatibility with the position-only openarm_mini teleoperator.
|
||||||
|
use_velocity_and_torque: bool = False
|
||||||
|
|
||||||
# TODO(Steven, Pepijn): Not used ... ?
|
# TODO(Steven, Pepijn): Not used ... ?
|
||||||
# MIT control parameters (used when manual_control=False for torque control)
|
# MIT control parameters (used when manual_control=False for torque control)
|
||||||
# List of 8 values: [joint_1, joint_2, joint_3, joint_4, joint_5, joint_6, joint_7, gripper]
|
# List of 8 values: [joint_1, joint_2, joint_3, joint_4, joint_5, joint_6, joint_7, gripper]
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class OpenArmLeader(Teleoperator):
|
|||||||
features: dict[str, type] = {}
|
features: dict[str, type] = {}
|
||||||
for motor in self.bus.motors:
|
for motor in self.bus.motors:
|
||||||
features[f"{motor}.pos"] = float
|
features[f"{motor}.pos"] = float
|
||||||
|
if self.config.use_velocity_and_torque:
|
||||||
features[f"{motor}.vel"] = float
|
features[f"{motor}.vel"] = float
|
||||||
features[f"{motor}.torque"] = float
|
features[f"{motor}.torque"] = float
|
||||||
return features
|
return features
|
||||||
@@ -201,6 +202,7 @@ class OpenArmLeader(Teleoperator):
|
|||||||
for motor in self.bus.motors:
|
for motor in self.bus.motors:
|
||||||
state = states.get(motor, {})
|
state = states.get(motor, {})
|
||||||
action_dict[f"{motor}.pos"] = state.get("position")
|
action_dict[f"{motor}.pos"] = state.get("position")
|
||||||
|
if self.config.use_velocity_and_torque:
|
||||||
action_dict[f"{motor}.vel"] = state.get("velocity")
|
action_dict[f"{motor}.vel"] = state.get("velocity")
|
||||||
action_dict[f"{motor}.torque"] = state.get("torque")
|
action_dict[f"{motor}.torque"] = state.get("torque")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user