diff --git a/.vscode/settings.json b/.vscode/settings.json index 88a30e91a..652c472fd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -112,6 +112,7 @@ "throwin", "timespec", "tldr", + "torqueless", "tqdm", "unpenalize", "unpenalized", diff --git a/bitbots_motion/bitbots_animation_rqt/bitbots_animation_rqt/record_ui.py b/bitbots_motion/bitbots_animation_rqt/bitbots_animation_rqt/record_ui.py index 88300de33..32a83bb96 100755 --- a/bitbots_motion/bitbots_animation_rqt/bitbots_animation_rqt/record_ui.py +++ b/bitbots_motion/bitbots_animation_rqt/bitbots_animation_rqt/record_ui.py @@ -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: """ @@ -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)