Skip to content

Commit

Permalink
slew_rate: pass vector by const ref
Browse files Browse the repository at this point in the history
  • Loading branch information
bresch authored and sfuhrer committed Mar 13, 2024
1 parent d32680f commit bc9df1a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/slew_rate/SlewRate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ class SlewRate
* Set maximum rate of change for the value
* @param slew_rate maximum rate of change
*/
void setSlewRate(const Type slew_rate) { _slew_rate = slew_rate; }
void setSlewRate(const Type &slew_rate) { _slew_rate = slew_rate; }

/**
* Set value ignoring slew rate for initialization purpose
* @param value new applied value
*/
void setForcedValue(const Type value) { _value = value; }
void setForcedValue(const Type &value) { _value = value; }

/**
* Get value from last update of the slew rate
Expand All @@ -76,7 +76,7 @@ class SlewRate
* @param deltatime time in seconds since last update
* @return actual value that complies with the slew rate
*/
Type update(const Type new_value, const float deltatime)
Type update(const Type &new_value, const float deltatime)
{
// Limit the rate of change of the value
const Type dvalue_desired = new_value - _value;
Expand All @@ -92,7 +92,7 @@ class SlewRate
};

template<>
inline matrix::Vector3f SlewRate<matrix::Vector3f>::update(const matrix::Vector3f new_value, const float deltatime)
inline matrix::Vector3f SlewRate<matrix::Vector3f>::update(const matrix::Vector3f &new_value, const float deltatime)
{
// Limit the rate of change of the value
const matrix::Vector3f dvalue_desired = new_value - _value;
Expand Down

0 comments on commit bc9df1a

Please sign in to comment.