diff --git a/.clang-tidy b/.clang-tidy index fd4a125dda..7ae7ddeba5 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -85,7 +85,6 @@ Checks: '*, -modernize-use-override, -modernize-use-using, -performance-inefficient-string-concatenation, - -performance-unnecessary-value-param, -readability-avoid-const-params-in-decls, -readability-braces-around-statements, -readability-container-size-empty, diff --git a/src/lib/FlightTasks/tasks/Utility/ManualVelocitySmoothingXY.cpp b/src/lib/FlightTasks/tasks/Utility/ManualVelocitySmoothingXY.cpp index 0018df50a6..0cdc63b9df 100644 --- a/src/lib/FlightTasks/tasks/Utility/ManualVelocitySmoothingXY.cpp +++ b/src/lib/FlightTasks/tasks/Utility/ManualVelocitySmoothingXY.cpp @@ -38,7 +38,7 @@ using namespace matrix; -void ManualVelocitySmoothingXY::reset(Vector2f accel, Vector2f vel, Vector2f pos) +void ManualVelocitySmoothingXY::reset(const Vector2f &accel, const Vector2f &vel, const Vector2f &pos) { for (int i = 0; i < 2; i++) { _trajectory[i].reset(accel(i), vel(i), pos(i)); @@ -54,7 +54,7 @@ void ManualVelocitySmoothingXY::resetPositionLock() _position_setpoint_locked(1) = NAN; } -void ManualVelocitySmoothingXY::update(float dt, Vector2f velocity_target) +void ManualVelocitySmoothingXY::update(float dt, const Vector2f &velocity_target) { // Update state updateTrajectories(dt); @@ -79,7 +79,7 @@ void ManualVelocitySmoothingXY::updateTrajectories(float dt) } } -void ManualVelocitySmoothingXY::updateTrajDurations(Vector2f velocity_target) +void ManualVelocitySmoothingXY::updateTrajDurations(const Vector2f &velocity_target) { for (int i = 0; i < 2; ++i) { _trajectory[i].updateDurations(velocity_target(i)); @@ -88,7 +88,7 @@ void ManualVelocitySmoothingXY::updateTrajDurations(Vector2f velocity_target) VelocitySmoothing::timeSynchronization(_trajectory, 2); } -void ManualVelocitySmoothingXY::checkPositionLock(Vector2f velocity_target) +void ManualVelocitySmoothingXY::checkPositionLock(const Vector2f &velocity_target) { /** * During a position lock -> position unlock transition, we have to make sure that the velocity setpoint diff --git a/src/lib/FlightTasks/tasks/Utility/ManualVelocitySmoothingXY.hpp b/src/lib/FlightTasks/tasks/Utility/ManualVelocitySmoothingXY.hpp index 2759b357dd..9ff5c1a397 100644 --- a/src/lib/FlightTasks/tasks/Utility/ManualVelocitySmoothingXY.hpp +++ b/src/lib/FlightTasks/tasks/Utility/ManualVelocitySmoothingXY.hpp @@ -50,10 +50,10 @@ public: ManualVelocitySmoothingXY() = default; ~ManualVelocitySmoothingXY() = default; - void reset(Vector2f accel, Vector2f vel, Vector2f pos); - void update(float dt, Vector2f velocity_target); + void reset(const Vector2f &accel, const Vector2f &vel, const Vector2f &pos); + void update(float dt, const Vector2f &velocity_target); - void setVelSpFeedback(const Vector2f fb) { _velocity_setpoint_feedback = fb; } + void setVelSpFeedback(const Vector2f &fb) { _velocity_setpoint_feedback = fb; } void setMaxJerk(const float max_jerk) { @@ -79,7 +79,7 @@ public: Vector2f getCurrentJerk() const { return _state.j; } Vector2f getCurrentAcceleration() const { return _state.a; } - void setCurrentVelocity(const Vector2f vel) + void setCurrentVelocity(const Vector2f &vel) { _state.v = vel; _trajectory[0].setCurrentVelocity(vel(0)); @@ -87,7 +87,7 @@ public: } Vector2f getCurrentVelocity() const { return _state.v; } - void setCurrentPosition(const Vector2f pos) + void setCurrentPosition(const Vector2f &pos) { _state.x = pos; _trajectory[0].setCurrentPosition(pos(0)); @@ -96,13 +96,13 @@ public: } Vector2f getCurrentPosition() const { return _position_setpoint_locked; } - void setCurrentPositionEstimate(Vector2f pos) { _position_estimate = pos; } + void setCurrentPositionEstimate(const Vector2f &pos) { _position_estimate = pos; } private: void resetPositionLock(); void updateTrajectories(float dt); - void checkPositionLock(Vector2f velocity_target); - void updateTrajDurations(Vector2f velocity_target); + void checkPositionLock(const Vector2f &velocity_target); + void updateTrajDurations(const Vector2f &velocity_target); VelocitySmoothing _trajectory[2]; ///< Trajectory in x and y directions diff --git a/src/modules/mc_att_control/RateControl/RateControl.cpp b/src/modules/mc_att_control/RateControl/RateControl.cpp index a728c8ec98..0715f82ebb 100644 --- a/src/modules/mc_att_control/RateControl/RateControl.cpp +++ b/src/modules/mc_att_control/RateControl/RateControl.cpp @@ -66,7 +66,7 @@ void RateControl::setSaturationStatus(const MultirotorMixer::saturation_status & _mixer_saturation_negative[2] = status.flags.yaw_neg; } -Vector3f RateControl::update(const Vector3f rate, const Vector3f rate_sp, const float dt, const bool landed) +Vector3f RateControl::update(const Vector3f &rate, const Vector3f &rate_sp, const float dt, const bool landed) { // angular rates error Vector3f rate_error = rate_sp - rate; diff --git a/src/modules/mc_att_control/RateControl/RateControl.hpp b/src/modules/mc_att_control/RateControl/RateControl.hpp index 38f688969a..195951195e 100644 --- a/src/modules/mc_att_control/RateControl/RateControl.hpp +++ b/src/modules/mc_att_control/RateControl/RateControl.hpp @@ -93,7 +93,8 @@ public: * @param dt desired vehicle angular rate setpoint * @return [-1,1] normalized torque vector to apply to the vehicle */ - matrix::Vector3f update(const matrix::Vector3f rate, const matrix::Vector3f rate_sp, const float dt, const bool landed); + matrix::Vector3f update(const matrix::Vector3f &rate, const matrix::Vector3f &rate_sp, const float dt, + const bool landed); /** * Set the integral term to 0 to prevent windup