Browse Source

Fix inspire_hand_default scoping bug in robot_hand_inspire.py

Save imported module as self.inspire_hand_default so it's accessible
from _send_hand_command (was only a local variable in __init__).
Matches the g1-control version's fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
main
Joe DiPrima 1 month ago
parent
commit
f8369a256f
  1. 5
      teleop/robot_control/robot_hand_inspire.py

5
teleop/robot_control/robot_hand_inspire.py

@ -164,6 +164,7 @@ class Inspire_Controller_FTP:
logger_mp.info("Initialize Inspire_Controller_FTP...") logger_mp.info("Initialize Inspire_Controller_FTP...")
from inspire_sdkpy import inspire_dds # lazy import from inspire_sdkpy import inspire_dds # lazy import
import inspire_sdkpy.inspire_hand_defaut as inspire_hand_default import inspire_sdkpy.inspire_hand_defaut as inspire_hand_default
self.inspire_hand_default = inspire_hand_default
self.fps = fps self.fps = fps
self.Unit_Test = Unit_Test self.Unit_Test = Unit_Test
self.simulation_mode = simulation_mode self.simulation_mode = simulation_mode
@ -242,13 +243,13 @@ class Inspire_Controller_FTP:
Send scaled angle commands [0-1000] to both hands. Send scaled angle commands [0-1000] to both hands.
""" """
# Left Hand Command # Left Hand Command
left_cmd_msg = inspire_hand_default.get_inspire_hand_ctrl()
left_cmd_msg = self.inspire_hand_default.get_inspire_hand_ctrl()
left_cmd_msg.angle_set = left_angle_cmd_scaled left_cmd_msg.angle_set = left_angle_cmd_scaled
left_cmd_msg.mode = 0b0001 # Mode 1: Angle control left_cmd_msg.mode = 0b0001 # Mode 1: Angle control
self.LeftHandCmd_publisher.Write(left_cmd_msg) self.LeftHandCmd_publisher.Write(left_cmd_msg)
# Right Hand Command # Right Hand Command
right_cmd_msg = inspire_hand_default.get_inspire_hand_ctrl()
right_cmd_msg = self.inspire_hand_default.get_inspire_hand_ctrl()
right_cmd_msg.angle_set = right_angle_cmd_scaled right_cmd_msg.angle_set = right_angle_cmd_scaled
right_cmd_msg.mode = 0b0001 # Mode 1: Angle control right_cmd_msg.mode = 0b0001 # Mode 1: Angle control
self.RightHandCmd_publisher.Write(right_cmd_msg) self.RightHandCmd_publisher.Write(right_cmd_msg)

Loading…
Cancel
Save