Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spinal][Servo] debug around boad configurator #7

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading