Browse Source

[fix] sshkeboard exit bug

main
silencht 8 months ago
parent
commit
f657ff8bea
  1. 2
      teleop/robot_control/robot_arm.py
  2. 10
      teleop/teleop_hand_and_arm.py

2
teleop/robot_control/robot_arm.py

@ -232,7 +232,7 @@ class G1_29_ArmController:
current_q = self.get_current_dual_arm_q() current_q = self.get_current_dual_arm_q()
if np.all(np.abs(current_q) < tolerance): if np.all(np.abs(current_q) < tolerance):
if self.motion_mode: if self.motion_mode:
for weight in np.arange(1, 0, -0.01):
for weight in np.linspace(1, 0, num=101):
self.msg.motor_cmd[G1_29_JointIndex.kNotUsedJoint0].q = weight; self.msg.motor_cmd[G1_29_JointIndex.kNotUsedJoint0].q = weight;
time.sleep(0.02) time.sleep(0.02)
logger_mp.info("[G1_29_ArmController] both arms have reached the home position.") logger_mp.info("[G1_29_ArmController] both arms have reached the home position.")

10
teleop/teleop_hand_and_arm.py

@ -213,7 +213,6 @@ if __name__ == '__main__':
cv2.imshow("record image", tv_resized_image) cv2.imshow("record image", tv_resized_image)
key = cv2.waitKey(1) & 0xFF key = cv2.waitKey(1) & 0xFF
if key == ord('q'): if key == ord('q'):
stop_listening()
running = False running = False
if args.sim: if args.sim:
publish_reset_category(2, reset_pose_publisher) publish_reset_category(2, reset_pose_publisher)
@ -260,13 +259,14 @@ if __name__ == '__main__':
# quit teleoperate # quit teleoperate
if tele_data.tele_state.right_aButton: if tele_data.tele_state.right_aButton:
running = False running = False
stop_listening()
# command robot to enter damping mode. soft emergency stop function # command robot to enter damping mode. soft emergency stop function
if tele_data.tele_state.left_thumbstick_state and tele_data.tele_state.right_thumbstick_state: if tele_data.tele_state.left_thumbstick_state and tele_data.tele_state.right_thumbstick_state:
sport_client.Damp() sport_client.Damp()
# control, limit velocity to within 0.3 # control, limit velocity to within 0.3
sport_client.Move(-tele_data.tele_state.left_thumbstick_value[1] * 0.3, sport_client.Move(-tele_data.tele_state.left_thumbstick_value[1] * 0.3,
-tele_data.tele_state.left_thumbstick_value[0] * 0.3,
-tele_data.tele_state.right_thumbstick_value[0] * 0.3)
-tele_data.tele_state.left_thumbstick_value[0] * 0.3,
-tele_data.tele_state.right_thumbstick_value[0] * 0.3)
# get current robot state data. # get current robot state data.
current_lr_arm_q = arm_ctrl.get_current_dual_arm_q() current_lr_arm_q = arm_ctrl.get_current_dual_arm_q()
@ -306,8 +306,8 @@ if __name__ == '__main__':
right_hand_action = [dual_gripper_action_array[1]] right_hand_action = [dual_gripper_action_array[1]]
current_body_state = arm_ctrl.get_current_motor_q().tolist() current_body_state = arm_ctrl.get_current_motor_q().tolist()
current_body_action = [-tele_data.tele_state.left_thumbstick_value[1] * 0.3, current_body_action = [-tele_data.tele_state.left_thumbstick_value[1] * 0.3,
-tele_data.tele_state.left_thumbstick_value[0] * 0.3,
-tele_data.tele_state.right_thumbstick_value[0] * 0.3]
-tele_data.tele_state.left_thumbstick_value[0] * 0.3,
-tele_data.tele_state.right_thumbstick_value[0] * 0.3]
elif (args.ee == "inspire1" or args.ee == "brainco") and args.xr_mode == "hand": elif (args.ee == "inspire1" or args.ee == "brainco") and args.xr_mode == "hand":
with dual_hand_data_lock: with dual_hand_data_lock:
left_ee_state = dual_hand_state_array[:6] left_ee_state = dual_hand_state_array[:6]

Loading…
Cancel
Save