forked from Archive/PX4-Autopilot
clang-tidy: enable performance-unnecessary-value-param and fix
This commit is contained in:
parent
4a7a9a1ba9
commit
d545825bf0
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue