From 522c15284f1c6f0bfa57d5a27065ef662a5c3352 Mon Sep 17 00:00:00 2001 From: Pernilla Date: Fri, 23 Jan 2026 00:02:03 +0100 Subject: [PATCH] Gimbal: (#26331) * passing const reference instead to avoid the copy * remove unused using declaration --- src/modules/gimbal/output.cpp | 2 +- src/modules/gimbal/output.h | 4 ++-- src/modules/gimbal/output_rc.cpp | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/modules/gimbal/output.cpp b/src/modules/gimbal/output.cpp index efbbcd78c6..fce2ad8a4b 100644 --- a/src/modules/gimbal/output.cpp +++ b/src/modules/gimbal/output.cpp @@ -305,7 +305,7 @@ void OutputBase::set_stabilize(bool roll_stabilize, bool pitch_stabilize, bool y _stabilize[2] = yaw_stabilize; } -void OutputBase::set_last_valid_setpoint(const bool compensate[3], const matrix::Eulerf euler_vehicle) +void OutputBase::set_last_valid_setpoint(const bool compensate[3], const matrix::Eulerf &euler_vehicle) { // No updates from angular velocity, hence no modification of last valid setpoint if (!PX4_ISFINITE(_angle_velocity[0]) && !PX4_ISFINITE(_angle_velocity[1]) && !PX4_ISFINITE(_angle_velocity[2])) { diff --git a/src/modules/gimbal/output.h b/src/modules/gimbal/output.h index 8836f7a259..9d77fc1cb1 100644 --- a/src/modules/gimbal/output.h +++ b/src/modules/gimbal/output.h @@ -106,9 +106,9 @@ protected: * the received MAVLink command, the last valid setpoint is updated to account for the vehicle attitude. * * @param compensate Boolean per axis (roll, pitch, yaw). If true, the vehicle attitude is taken into account. - * @param euler_vehicle + * @param euler_vehicle Reference to Euler float */ - void set_last_valid_setpoint(const bool compensate[3], const matrix::Eulerf euler_vehicle); + void set_last_valid_setpoint(const bool compensate[3], const matrix::Eulerf &euler_vehicle); float _angle_outputs[3] = { 0.f, 0.f, 0.f }; ///< calculated output angles (roll, pitch, yaw) [rad] diff --git a/src/modules/gimbal/output_rc.cpp b/src/modules/gimbal/output_rc.cpp index 3bf9ebfe5d..508d748b5b 100644 --- a/src/modules/gimbal/output_rc.cpp +++ b/src/modules/gimbal/output_rc.cpp @@ -38,8 +38,6 @@ #include #include -using math::constrain; - namespace gimbal {