Skip to content

Conversation

@DonLakeFlyer
Copy link
Contributor

Values would bounce between 0.0 and -0.0 and -90 and nan.

@DonLakeFlyer
Copy link
Contributor Author

@Davidsastresas Can you test this out?

Copilot finished reviewing on behalf of DonLakeFlyer November 26, 2025 19:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes gimbal indicator pitch value jitter where values would bounce between 0.0 and -0.0, and also handles NaN values that occurred at boundary conditions (e.g., -90 degrees pitch). The fix involves three coordinated changes: improving quaternion-to-Euler conversion to avoid NaN values, stripping negative zero from floating-point string representations, and using the Fact System's built-in string formatting in the UI.

Key changes:

  • Replaced mavlink_quaternion_to_euler with QQuaternion::toEulerAngles() for more robust boundary condition handling
  • Added negative zero stripping to the Fact System's string conversion to prevent -0.0 display jitter
  • Updated UI to use valueString property instead of manual toFixed() formatting

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/UI/toolbar/GimbalIndicator.qml Changed gimbal angle displays to use Fact's valueString property instead of rawValue.toFixed(1), leveraging built-in NaN handling and formatting
src/Gimbal/GimbalController.cc Replaced MAVLink quaternion conversion with Qt's QQuaternion::toEulerAngles() which returns degrees and handles boundary conditions better, preventing NaN values
src/FactSystem/Fact.cc Added stripNegativeZero lambda to convert -0.0 and -0 to positive zero in float/double string representations, eliminating display jitter

@Davidsastresas
Copy link
Member

I just tested, it looks good to me. Thank you for keeping me in the loop.

I had a weird crash going to the joystick menu and disconnecting the joystick, in Linux. However I wasn't able to reproduce it after several tries.

@DonLakeFlyer
Copy link
Contributor Author

Thanks for testing David

@DonLakeFlyer DonLakeFlyer merged commit b7ea2dd into master Dec 1, 2025
27 checks passed
@DonLakeFlyer DonLakeFlyer deleted the GimbalJitter branch December 1, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants