29 inline double clamp(
double value,
double lower,
double upper)
31 return std::max(lower, std::min(value, upper));
38 inline void clampInPlace(
double & value,
double lower,
double upper)
40 value =
clamp(value, lower, upper);
49 inline double clampAndWarn(
double value,
double lower,
double upper,
const std::string & label)
57 else if(value < lower)
72 inline void clampInPlaceAndWarn(
double & value,
double lower,
double upper,
const std::string & label)
91 template<
typename VectorT>
92 inline VectorT
clamp(
const VectorT & v,
double lower,
double upper)
94 VectorT result(v.size());
95 for(
unsigned i = 0; i < v.size(); i++) { result(i) =
clamp(v(i), lower, upper); }
105 template<
typename VectorT>
106 inline VectorT
clamp(
const VectorT & v,
const VectorT & lower,
const VectorT & upper)
108 VectorT result(v.size());
109 for(
unsigned i = 0; i < v.size(); i++) { result(i) =
clamp(v(i), lower(i), upper(i)); }
119 template<
typename VectorT>
120 inline VectorT
clampAndWarn(
const VectorT & v,
const VectorT & lower,
const VectorT & upper,
const std::string & label)
122 VectorT result(v.size());
123 for(
unsigned i = 0; i < v.size(); i++)
135 template<
typename VectorT>
136 inline void clampInPlace(VectorT & v,
const VectorT & lower,
const VectorT & upper)
138 for(
unsigned i = 0; i < v.size(); i++) { v(i) =
clamp(v(i), lower(i), upper(i)); }
146 template<
typename VectorT>
149 for(
unsigned i = 0; i < v.size(); i++) { v(i) =
clamp(v(i), lower, upper); }
158 template<
typename VectorT>
161 for(
unsigned i = 0; i < vector.size(); i++)
173 template<
typename VectorT>
175 const VectorT & lower,
176 const VectorT & upper,
177 const std::string & label)
179 for(
unsigned i = 0; i < vector.size(); i++)
void clampInPlace(double &value, double lower, double upper)
Definition: clamp.h:38
void clampInPlaceAndWarn(double &value, double lower, double upper, const std::string &label)
Definition: clamp.h:72
double clamp(double value, double lower, double upper)
Definition: clamp.h:29
double clampAndWarn(double value, double lower, double upper, const std::string &label)
Definition: clamp.h:49
Definition: ExponentialMovingAverage.h:15
std::conditional< std::is_same< std::string, T >::value, const std::string &, std::string >::type to_string(const T &value)
Definition: RobotLoader.h:51
void warning(Args &&... args)
Definition: logging.h:69