Anatomically precise joint names
This commit is contained in:
@@ -44,26 +44,26 @@ class HopeJrHand(Robot):
|
||||
port=self.config.port,
|
||||
motors={
|
||||
# Thumb
|
||||
"thumb_basel_rotation": Motor(1, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"thumb_cmc": Motor(1, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"thumb_mcp": Motor(2, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"thumb_pip": Motor(3, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"thumb_dip": Motor(4, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
# Index
|
||||
"index_thumb_side": Motor(5, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"index_pinky_side": Motor(6, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"index_flexor": Motor(7, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"index_radial_flexor": Motor(5, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"index_ulnar_flexor": Motor(6, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"index_pip_dip": Motor(7, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
# Middle
|
||||
"middle_thumb_side": Motor(8, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"middle_pinky_side": Motor(9, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"middle_flexor": Motor(10, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"middle_radial_flexor": Motor(8, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"middle_ulnar_flexor": Motor(9, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"middle_pip_dip": Motor(10, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
# Ring
|
||||
"ring_thumb_side": Motor(11, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"ring_pinky_side": Motor(12, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"ring_flexor": Motor(13, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"ring_radial_flexor": Motor(11, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"ring_ulnar_flexor": Motor(12, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"ring_pip_dip": Motor(13, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
# Pinky
|
||||
"pinky_thumb_side": Motor(14, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"pinky_pinky_side": Motor(15, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"pinky_flexor": Motor(16, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"pinky_radial_flexor": Motor(14, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"pinky_ulnar_flexor": Motor(15, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
"pinky_pip_dip": Motor(16, "scs0009", MotorNormMode.RANGE_M100_100),
|
||||
},
|
||||
calibration=self.calibration,
|
||||
protocol_version=1,
|
||||
|
||||
@@ -56,22 +56,32 @@ class HomonculusGlove(Teleoperator):
|
||||
self.serial = serial.Serial(config.port, config.baud_rate, timeout=1)
|
||||
|
||||
self.joints = [
|
||||
"thumb_0",
|
||||
"thumb_1",
|
||||
"thumb_2",
|
||||
"thumb_3",
|
||||
"index_0",
|
||||
"index_1",
|
||||
"index_2",
|
||||
"middle_0",
|
||||
"middle_1",
|
||||
"middle_2",
|
||||
"ring_0",
|
||||
"ring_1",
|
||||
"ring_2",
|
||||
"pinky_0",
|
||||
"pinky_1",
|
||||
"pinky_2",
|
||||
"thumb_cmc",
|
||||
"thumb_mcp",
|
||||
"thumb_pip",
|
||||
"thumb_dip",
|
||||
"index_mcp_abduction",
|
||||
"index_mcp_flexion",
|
||||
"index_dip",
|
||||
"middle_mcp_abduction",
|
||||
"middle_mcp_flexion",
|
||||
"middle_dip",
|
||||
"ring_mcp_abduction",
|
||||
"ring_mcp_flexion",
|
||||
"ring_dip",
|
||||
"pinky_mcp_abduction",
|
||||
"pinky_mcp_flexion",
|
||||
"pinky_dip",
|
||||
]
|
||||
|
||||
self.inverted_joints = [
|
||||
"thumb_cmc",
|
||||
"thumb_dip",
|
||||
"index_mcp_abduction",
|
||||
"index_dip",
|
||||
"middle_dip",
|
||||
"ring_dip",
|
||||
"pinky_dip",
|
||||
]
|
||||
# self._state = dict.fromkeys(self.joints, 100)
|
||||
self.thread = threading.Thread(target=self._async_read, daemon=True, name=f"{self} _async_read")
|
||||
@@ -115,25 +125,11 @@ class HomonculusGlove(Teleoperator):
|
||||
range_mins.update(finger_mins)
|
||||
range_maxes.update(finger_maxes)
|
||||
|
||||
inverted_joints = [
|
||||
"thumb_0",
|
||||
"thumb_3",
|
||||
"index_0",
|
||||
"index_2",
|
||||
"middle_2",
|
||||
"ring_2",
|
||||
"pinky_2",
|
||||
]
|
||||
# for joint in inverted_joints:
|
||||
# tmp_pos = range_mins[joint]
|
||||
# range_mins[joint] = range_maxes[joint]
|
||||
# range_maxes[joint] = tmp_pos
|
||||
|
||||
self.calibration = {}
|
||||
for id_, joint in enumerate(self.joints):
|
||||
self.calibration[joint] = MotorCalibration(
|
||||
id=id_,
|
||||
drive_mode=1 if joint in inverted_joints else 0,
|
||||
drive_mode=1 if joint in self.inverted_joints else 0,
|
||||
homing_offset=0,
|
||||
range_min=range_mins[joint],
|
||||
range_max=range_maxes[joint],
|
||||
|
||||
Reference in New Issue
Block a user