Add camera serial number and slow the reset speed between episode
This commit is contained in:
parent
4f76d5cefb
commit
14c3e798f0
@ -12,6 +12,19 @@ robot:
|
||||
min_tcp_z_mm: -2.0
|
||||
# Append gripper initialization/read/write failures here.
|
||||
gripper_error_log_path: "logs/xarm7_gripper_errors.log"
|
||||
cameras:
|
||||
camera:
|
||||
type: intelrealsense
|
||||
serial_number_or_name: "242622070583"
|
||||
width: 640
|
||||
height: 480
|
||||
fps: 30
|
||||
camera2:
|
||||
type: intelrealsense
|
||||
serial_number_or_name: "148522072685"
|
||||
width: 640
|
||||
height: 480
|
||||
fps: 30
|
||||
# Redundant args, indicating the initial pose of xarm7. Set by 192.168.1.245:18333
|
||||
# start_joints: [0, -30, 0, 0, 0, 30, 0]
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
## Configurations:
|
||||
INIT_SYNC_JOINT_VELOCITY_RAD = 0.2
|
||||
ROBOT_RESET_SPEED_DEG = 60
|
||||
ROBOT_RESET_SPEED_DEG = 20
|
||||
TCP_Z_CLAMP_TOLERANCE_MM = 1e-3
|
||||
TCP_Z_LOG_INTERVAL_S = 1.0
|
||||
TCP_Z_MAX_IK_JOINT_STEP_RAD = math.radians(10.0)
|
||||
@ -519,7 +519,10 @@ class UFRobot(Robot, Thread):
|
||||
if move_to_open:
|
||||
self._check_gripper_code(
|
||||
"set_gripper_position",
|
||||
self.real_arm.set_gripper_position(self._gripper_param.open_pos),
|
||||
self.real_arm.set_gripper_position(
|
||||
self._gripper_param.open_pos,
|
||||
wait=True,
|
||||
),
|
||||
)
|
||||
elif self._gripper_type == GripperType.xArmGripperG2:
|
||||
self.real_arm.set_gripper_enable(True)
|
||||
@ -553,6 +556,7 @@ class UFRobot(Robot, Thread):
|
||||
if move_to_open:
|
||||
self._gripper_param.grippos = self._gripper_param.open_pos
|
||||
self._gripper_param.gripper_norm = 0.0
|
||||
self._last_gripper_command = 0.0
|
||||
|
||||
def calibrate(self) -> None:
|
||||
self._is_calibrated = True
|
||||
|
||||
@ -131,7 +131,7 @@ def test_manual_mode_robot_enters_teaching_mode_without_sending_actions(monkeypa
|
||||
"set_servo_angle",
|
||||
{
|
||||
"angle": arm.initial_point,
|
||||
"speed": 60,
|
||||
"speed": 20,
|
||||
"is_radian": False,
|
||||
"wait": True,
|
||||
},
|
||||
@ -177,7 +177,7 @@ def test_robot_reset_uses_sdk_initial_point_in_normal_mode(monkeypatch, tmp_path
|
||||
"set_servo_angle",
|
||||
{
|
||||
"angle": arm.initial_point,
|
||||
"speed": 60,
|
||||
"speed": 20,
|
||||
"is_radian": False,
|
||||
"wait": True,
|
||||
},
|
||||
@ -187,6 +187,41 @@ def test_robot_reset_uses_sdk_initial_point_in_normal_mode(monkeypatch, tmp_path
|
||||
robot.disconnect()
|
||||
|
||||
|
||||
def test_normal_mode_waits_for_gripper_to_open_before_control(monkeypatch, tmp_path):
|
||||
from lerobot_robot_ufactory.robots.uf_robot import uf_robot as uf_robot_module
|
||||
|
||||
arm = FakeXArm("192.168.1.245")
|
||||
arm.gripper_position = 400
|
||||
monkeypatch.setattr(uf_robot_module, "XArmAPI", lambda robot_ip: arm)
|
||||
monkeypatch.setattr(uf_robot_module.time, "sleep", lambda _: None)
|
||||
|
||||
config = UFRobotConfig(
|
||||
id="test_wait_for_gripper",
|
||||
calibration_dir=tmp_path,
|
||||
robot_ip=arm.robot_ip,
|
||||
robot_dof=6,
|
||||
control_space="joint",
|
||||
gripper_type=1,
|
||||
)
|
||||
robot = uf_robot_module.UFRobot(config)
|
||||
robot.connect()
|
||||
|
||||
open_calls = [call for call in arm.calls if call[0] == "set_gripper_position"]
|
||||
assert open_calls == [("set_gripper_position", 800, {"wait": True})]
|
||||
assert robot._last_gripper_command == 0.0
|
||||
|
||||
before_writes = len(
|
||||
[call for call in arm.calls if call[0] == "getset_tgpio_modbus_data"]
|
||||
)
|
||||
robot._send_gripper_action(0.0)
|
||||
after_writes = len(
|
||||
[call for call in arm.calls if call[0] == "getset_tgpio_modbus_data"]
|
||||
)
|
||||
assert after_writes == before_writes
|
||||
|
||||
robot.disconnect()
|
||||
|
||||
|
||||
def test_manual_mode_config_rejects_cartesian_control(tmp_path):
|
||||
with pytest.raises(ValueError, match="control_space='joint'"):
|
||||
UFRobotConfig(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user