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

Fix animation record ui crash after a non numerical text input #615

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"throwin",
"timespec",
"tldr",
"torqueless",
"tqdm",
"unpenalize",
"unpenalized",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,17 @@ def q_joint_state_update(self, joint_states: JointState) -> None:
return
# Update working values of non stiff motors
for motor_name in self.motors:
if self._motor_controller_torque_checkbox[motor_name].checkState(0) != Qt.CheckState.Checked:
# Get the state from the UI checkboxes
motor_active = self._motor_switcher_active_checkbox[motor_name].checkState(0) == Qt.CheckState.Checked
motor_torqueless = self._motor_controller_torque_checkbox[motor_name].checkState(0) != Qt.CheckState.Checked
# Check if the we are currently positioning the motor and want to store the value
if motor_active and motor_torqueless:
# Update textfield
self._motor_controller_text_fields[motor_name].setText(
str(round(math.degrees(joint_states.position[joint_states.name.index(motor_name)]), 2))
)
# React to textfield changes
self.textfield_update()
# Update working values
self._working_angles[motor_name] = joint_states.position[joint_states.name.index(motor_name)]

def create_motor_controller(self) -> None:
"""
Expand Down Expand Up @@ -681,7 +685,7 @@ def textfield_update(self):
"Warning",
f"Please enter a valid number.\n '{text_field.text()}' is not a valid number.",
)
return
continue
# Clip the angle to the maximum and minimum, we do this in degrees,
# because we do not want introduce rounding errors in the textfield
angle = round(max(-180.0, min(angle, 180.0)), 2)
Expand Down
Loading