增加机器人夹爪

This commit is contained in:
2025-12-09 09:47:38 +08:00
parent 1d09062f79
commit bcb678c608
4 changed files with 10 additions and 5 deletions

BIN
pyproject.zip Normal file

Binary file not shown.

View File

@@ -5,3 +5,4 @@ dataset:
single_task: test
repo_id: yehao/realman-test
num_episodes: 2
fps: 2

View File

@@ -33,8 +33,8 @@ class RoboticArmMock:
def rm_set_gripper_route(self,*args):
print(f"rm_set_gripper_route:{args}")
def rm_set_gripper_position(self,*args):
print(f"rm_set_gripper_position:{args}")
def rm_set_gripper_position(self,*kargs):
print(f"rm_set_gripper_position:{kargs}")
def rm_get_gripper_state(self):
print("get_gripper_state")
@@ -171,7 +171,7 @@ class RealmanMotorsBus(MotorsBus):
def write_arm(self, target_joint: list):
ret = self.rmarm.rm_movej_follow(target_joint[:-1])
if ret != 0:
if ret != None:
print("movej error:", ret[1])
return ret

View File

@@ -93,7 +93,7 @@ class Xbox(Teleoperator):
pose_speeds['x.vel'] = -current_linear_step if hat_left else (current_linear_step if hat_right else 0.0) # X
pose_speeds['y.vel'] = current_linear_step if hat_up else (-current_linear_step if hat_down else 0.0) # Y
# 摇杆X轴
# 摇杆X轴
z_mapping = self.apply_nonlinear_mapping(self.joystick.get_axis(1))
print(f"Z轴非线性映射: {self.joystick.get_axis(1)} -> {z_mapping}")
pose_speeds['z.vel'] = z_mapping * current_angular_step * 2 # RY
@@ -119,7 +119,11 @@ class Xbox(Teleoperator):
# print(f"RZ轴非线性映射: {z_axis} -> {rz_mapping}")
pose_speeds['rz.vel'] = rz_mapping * current_angular_step * 2 # RZ
pose_speeds['gripper.vel'] = 0
# 右摇杆Y轴控制夹爪
# 设置夹爪开合速度
gripper_mapping = -self.apply_nonlinear_mapping(-self.joystick.get_axis(0))
# print(f"gripper轴非线性映射: {self.joystick.get_axis(0)} -> {gripper_mapping}")
pose_speeds['gripper.vel'] = gripper_mapping * current_angular_step * 2 # RY
return pose_speeds