feat(core): expose math_utils helpers in public headers#2873
Conversation
Moves math_utils.hpp to the public include directory so consumers can convert between Quaternion and EulerAngle without MavlinkPassthrough. Also clamps asinf input to [-1, 1] to avoid NaN from FP rounding (same fix as pymavlink mavlink#1208). Closes mavlink#2693.
julianoes
left a comment
There was a problem hiding this comment.
Could you please add a test to math_utils_test.cpp that tests the constrain you added?
|
Also note that you will have to make sure there are docstrings and you run |
Verify pitch stays finite when 2*(q.w*q.y - q.z*q.x) is driven outside [-1, 1] by floating-point rounding (positive and negative case).
Add Doxygen docstrings to math_utils.hpp, register it as an installable public header in CMakeLists.txt, and regenerate the API reference markdown.
|
@julianoes I've addressed both: added the gimbal-lock constrain test in math_utils_test.cpp and added docstrings + ran generate_docs.sh. Happy to adjust anything ! |
julianoes
left a comment
There was a problem hiding this comment.
Just the macro, then this is good to go in. Thanks.
These are part of the public API now, not test-only access.
Without an export macro the symbol had hidden visibility and was unreachable from outside libmavsdk.so. Verified via nm: t -> T at the same offset.
|
@julianoes Macro swap done in |
|
@julianoes |
Closes #2693.
Move
math_utils.hppto the public include directory so users can convert betweenQuaternionandEulerAnglewithoutMavlinkPassthrough(and hence withoutmavlink_conversions.h) .Also clamp the
asinfinput into_euler_angle_from_quaternionto[-1, 1]to prevent NaN when a quaternion approaches gimbal-lock ; same fix landing in ArduPilot/pymavlink#1208 for the upstream C library.