From 951b4ba4581fd8d480633d3d35cb0ceacaff87fb Mon Sep 17 00:00:00 2001 From: "1002142102@qq.com" <1002142102@qq.com> Date: Wed, 10 Dec 2025 11:49:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=BF=E7=9C=9F=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- robot_client/robots/realman/motors_bus.py | 52 ++--------------------- 1 file changed, 3 insertions(+), 49 deletions(-) diff --git a/robot_client/robots/realman/motors_bus.py b/robot_client/robots/realman/motors_bus.py index e6ae04f2..f63f4031 100644 --- a/robot_client/robots/realman/motors_bus.py +++ b/robot_client/robots/realman/motors_bus.py @@ -5,52 +5,6 @@ from lerobot.motors import Motor, MotorCalibration, MotorsBus #动作执行成功 ACTION_SUCCESS = 0 -class RoboticArmMock: - def __init__(self,*args): - pass - - def rm_create_robot_arm(self, ip, port): - print(f"connnect {ip}:{port}") - return {"id":1} - - def rm_movej(self,*args): - print(f"rm_movej:{args}") - - def rm_movej_follow(self,*args): - print(f"rm_movej_follow:{args}") - - def rm_get_current_arm_state(self): - print("get_current_arm_state") - return ACTION_SUCCESS, {"pose":[0.0,0.0,0.0,0.0,0.0,0.0],"joint":[0.0,0.0,0.0,0.0,0.0,0.0]} - - def rm_movej_p(self,*args): - print(f"rm_movej_p:{args}") - - - def rm_set_joint_en_state(self,*args): - print(f"rm_set_joint_en_state:{args}") - - def rm_set_gripper_route(self,*args): - print(f"rm_set_gripper_route:{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") - return ACTION_SUCCESS, {"actpos":0.0} - - def rm_set_gripper_release(self,*args): - print(f"rm_set_gripper_release:{args}") - def rm_set_gripper_pick_on(self,*args): - print(f"rm_set_gripper_pick_on:{args}") - - def rm_movev_canfd(self,*args): - print(f"rm_movev_canfd:{args}") - - def rm_destory(self): - print("destory") - class RealmanMotorsBus(MotorsBus): model_number_table={} @@ -72,10 +26,11 @@ class RealmanMotorsBus(MotorsBus): calibration: dict[str, MotorCalibration] | None = None, ): super().__init__(port,motors, calibration) + self.rmarm = RoboticArm(rm_thread_mode_e.RM_DUAL_MODE_E) if mock: - self.rmarm = RoboticArmMock() + self.rmarm.rm_set_arm_run_mode(0)#仿真模式 else: - self.rmarm = RoboticArm(rm_thread_mode_e.RM_DUAL_MODE_E) + self.rmarm.rm_set_arm_run_mode(1) address = port.split(':') self.ip = address[0] self.port = int(address[1]) @@ -105,7 +60,6 @@ class RealmanMotorsBus(MotorsBus): ''' self.handle = self.rmarm.rm_create_robot_arm(self.ip, self.port) - self.rmarm.rm_set_arm_run_mode(0) enable_flag = False loop_flag = False # 设置超时时间(秒)