Skip to content

Conversation

@AarC10
Copy link
Member

@AarC10 AarC10 commented Jun 28, 2025

Description

Calculates roll, pitch and yaw based on the output of a sensor fusion quaternion

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Standard math, so just check and make sure it compiles for now. Once we integration test we can fully validate.

Checklist:

  • New functionality is documented in the necessary spots (i.e new functions documented in the header)
  • Unit tests cover any new functionality or edge cases that the PR was meant to resolve (if applicable)
  • The CI checks are passing
  • I reviewed my own code in the GitHub diff and am sure that each change is intentional
  • I feel comfortable about this code flying in a rocket

@AarC10 AarC10 requested a review from a team as a code owner June 28, 2025 13:24
- hal_nxp
- littlefs
- loramac-node
- hal_st
Copy link
Member Author

Choose a reason for hiding this comment

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

Note github diff doesn't show that it's present above. This is just deleting a duplicate entry

@AarC10 AarC10 requested a review from Copilot June 28, 2025 15:10
Copy link

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 PR adds new math functionality to calculate roll, pitch, and yaw from sensor fusion quaternions and updates the build configuration and project manifest accordingly.

  • Added math utilities in both header and source files (n_math_utils.h/.cpp)
  • Updated CMakeLists.txt and Kconfig to enable the new math feature
  • Modified west.yml to include additional repositories (lz4 and zscilib)

Reviewed Changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
west.yml Updates manifest by adding lz4 and zscilib repositories
lib/f_core/math/n_math_utils.cpp Introduces the quaternion-to-euler conversion with unit conversion
lib/f_core/math/CMakeLists.txt Configures build for the new math module
lib/f_core/Kconfig Adds a new configuration option for math functionality
lib/f_core/CMakeLists.txt Updates subdirectory inclusions to support the new math and radio modules
include/f_core/math/n_math_utils.h Provides the header for the new math utility with documentation
Files not reviewed (2)
  • app/backplane/sensor_module/.idea/editor.xml: Language not supported
  • app/backplane/sensor_module/.idea/vcs.xml: Language not supported
Comments suppressed due to low confidence (1)

lib/f_core/math/n_math_utils.cpp:11

  • There's a mismatch between the implementation and the header documentation: the header indicates that the output angles are in radians, but the implementation converts them to degrees. Please update the documentation or the conversion logic so that the behavior is consistent.
    roll = euler.x * multiplier;


void NMathUtils::CalculateRollPitchYaw(zsl_quat inputQuat, float& roll, float& pitch, float& yaw)
{
static constexpr multiplier = 180 / ZSL_PI;
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

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

Missing type for the constant 'multiplier'. Consider specifying a type (e.g., 'float') or using 'auto' to ensure proper type deduction.

Suggested change
static constexpr multiplier = 180 / ZSL_PI;
static constexpr double multiplier = 180 / ZSL_PI;

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

robots kinda cooking with this one


void NMathUtils::CalculateRollPitchYaw(zsl_quat inputQuat, float& roll, float& pitch, float& yaw)
{
static constexpr multiplier = 180 / ZSL_PI;
Copy link
Contributor

Choose a reason for hiding this comment

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

robots kinda cooking with this one

* @brief Calculate roll, pitch, and yaw from a quaternion.
*
* @param[in] inputQuat The input quaternion.
* @param[out] roll Output roll angle in radians.
Copy link
Contributor

Choose a reason for hiding this comment

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

either this comment is wrong or the implementation is wrong? You have a multiplier of 180/pi which turns radians into degrees in the implementation but say it comes out as radians?

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