Skip to content

Commit

Permalink
Merge pull request #7 from HisaakiIida/PR/Spinal/dynamixel
Browse files Browse the repository at this point in the history
  • Loading branch information
sugihara-16 authored Jun 7, 2024
2 parents d4567ec + f14dc52 commit 70b11db
Showing 1 changed file with 6 additions and 24 deletions.
30 changes: 6 additions & 24 deletions aerial_robot_nerve/spinal/src/spinal/board_configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,7 @@ def configureButtonCallback(self):
req.command = req.SET_IMU_SEND_FLAG
elif self._command == 'pid_gain':
try:
if(spinal_flag):
req.data.append(int(self._raw_servo_id))
else:
req.data.append(int(self._servo_index))
req.data.append(int(self._servo_index))
pid_gains = list(map(lambda x: int(x), self._widget.lineEdit.text().split(',')))
if len(pid_gains) != 3:
raise ValueError('Input 3 gains(int)')
Expand All @@ -234,32 +231,23 @@ def configureButtonCallback(self):
req.command = req.SET_SERVO_PID_GAIN
elif self._command == 'profile_velocity':
try:
if(spinal_flag):
req.data.append(int(self._raw_servo_id))
else:
req.data.append(int(self._servo_index))
req.data.append(int(self._servo_index))
req.data.append(int(self._widget.lineEdit.text()))
except ValueError as e:
print(e)
return
req.command = req.SET_SERVO_PROFILE_VEL
elif self._command == 'send_data_flag':
try:
if(spinal_flag):
req.data.append(int(self._raw_servo_id))
else:
req.data.append(int(self._servo_index))
req.data.append(int(self._servo_index))
req.data.append(distutils.util.strtobool(self._widget.lineEdit.text()))
except ValueError as e:
print(e)
return
req.command = req.SET_SERVO_SEND_DATA_FLAG
elif self._command == 'current_limit':
try:
if(spinal_flag):
req.data.append(int(self._raw_servo_id))
else:
req.data.append(int(self._servo_index))
req.data.append(int(self._servo_index))
req.data.append(int(self._widget.lineEdit.text()))
except ValueError as e:
print(e)
Expand All @@ -280,21 +268,15 @@ def configureButtonCallback(self):
req.command = req.SET_DYNAMIXEL_TTL_RS485_MIXED
elif self._command == 'external_encoder_flag':
try:
if(spinal_flag):
req.data.append(int(self._raw_servo_id))
else:
req.data.append(int(self._servo_index))
req.data.append(int(self._servo_index))
req.data.append(distutils.util.strtobool(self._widget.lineEdit.text()))
except ValueError as e:
print(e)
return
req.command = req.SET_SERVO_EXTERNAL_ENCODER_FLAG
elif self._command == 'resolution[joint:servo]':
try:
if(spinal_flag):
req.data.append(int(self._raw_servo_id))
else:
req.data.append(int(self._servo_index))
req.data.append(int(self._servo_index))
resolutions = list(map(lambda x: int(x), self._widget.lineEdit.text().split(':')))
if len(resolutions) != 2:
raise ValueError('Input 2 resoultion(int)')
Expand Down

0 comments on commit 70b11db

Please sign in to comment.