29 inline double clamp(
double value,
double lower,
double upper)
30 {
return std::max(lower, std::min(
value, upper)); }
45 inline double clampAndWarn(
double value,
double lower,
double upper,
const std::string & label)
53 else if(
value < lower)
85 template<
typename VectorT>
86 inline VectorT
clamp(
const VectorT & v,
double lower,
double upper)
88 VectorT result(v.size());
89 for(
unsigned i = 0; i < v.size(); i++) { result(i) =
clamp(v(i), lower, upper); }
99 template<
typename VectorT>
100 inline VectorT
clamp(
const VectorT & v,
const VectorT & lower,
const VectorT & upper)
102 VectorT result(v.size());
103 for(
unsigned i = 0; i < v.size(); i++) { result(i) =
clamp(v(i), lower(i), upper(i)); }
113 template<
typename VectorT>
114 inline VectorT
clampAndWarn(
const VectorT & v,
const VectorT & lower,
const VectorT & upper,
const std::string & label)
116 VectorT result(v.size());
117 for(
unsigned i = 0; i < v.size(); i++)
129 template<
typename VectorT>
130 inline void clampInPlace(VectorT & v,
const VectorT & lower,
const VectorT & upper)
132 for(
unsigned i = 0; i < v.size(); i++) { v(i) =
clamp(v(i), lower(i), upper(i)); }
140 template<
typename VectorT>
143 for(
unsigned i = 0; i < v.size(); i++) { v(i) =
clamp(v(i), lower, upper); }
152 template<
typename VectorT>
155 for(
unsigned i = 0; i < vector.size(); i++)
167 template<
typename VectorT>
169 const VectorT & lower,
170 const VectorT & upper,
171 const std::string & label)
173 for(
unsigned i = 0; i < vector.size(); i++)
std::optional< Eigen::VectorXd > value
void clampInPlace(double &value, double lower, double upper)
Definition: clamp.h:36
void clampInPlaceAndWarn(double &value, double lower, double upper, const std::string &label)
Definition: clamp.h:68
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:45
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(const S &format, Args &&... args)
Definition: logging.h:75