Go to the documentation of this file.
29 template <
class FType>
146 std::uint64_t iterationCount{0};
160 template <
class FType>
167 template <
class FType>
174 template <
class FType>
181 template <
class FType>
188 template <
class FType>
195 template <
class FType>
199 std::tie(limitOutLo, limitOutHi) = std::minmax(
min,
max);
202 template <
class FType>
209 template <
class FType>
216 template <
class FType>
220 outRampDelta = delta;
223 template <
class FType>
230 template <
class FType>
237 template <
class FType>
244 template <
class FType>
251 template <
class FType>
258 template <
class FType>
262 if (!(0 >= lastOutFactor && lastOutFactor < 1))
264 throw std::invalid_argument{
"the interpolation factor has to be in [0, 1)! factor = " +
267 lastOutInterpolation = lastOutFactor;
270 template <
class FType>
274 return lastOutInterpolation;
278 template <
class FType>
285 template <
class FType>
292 template <
class FType>
299 template <
class FType>
303 return iterationCount;
307 template <
class FType>
314 template <
class FType>
318 return update(lastInValue, lastTarget);
321 template <
class FType>
325 return update(inValue, lastTarget);
328 template <
class FType>
346 error =
std::clamp(error, -maxError, +maxError);
353 lastInValue = inValue;
357 const FloatingType dOut = -Kd * (inValue - lastInValue);
358 lastInValue = inValue;
362 if (outRampDelta != 0)
364 out =
std::clamp(out, lastOutValue - outRampDelta, lastOutValue + outRampDelta);
366 if (limitOutLo != limitOutHi)
368 out =
std::clamp(out, limitOutLo, limitOutHi);
370 if (lastOutInterpolation != 0)
372 out = lastOutValue * lastOutInterpolation + out * (1 - lastOutInterpolation);
FloatingType getLastOutValue() const
FloatingType getD() const
void setP(FloatingType p)
FloatingType getLastTarget() const
FloatingType getLastOutInterpolationFactor() const
FloatingType getMaxError() const
Vertex target(const detail::edge_base< Directed, Vertex > &e, const PCG &)
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
void setTargetRadius(FloatingType radius)
void setMaxError(FloatingType error)
double clamp(double x, double a, double b)
std::uint64_t getIterationCount() const
std::vector< T > abs(const std::vector< T > &v)
void setD(FloatingType d)
FloatingType getLastInValue() const
FloatingType getLoOutLimit() const
FloatingType getP() const
void setOutRampDelta(FloatingType delta)
void limitOut(FloatingType out)
set limits for the output value (lo and hi limits are set to the same value)
const std::string & to_string(const std::string &s)
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
PDController(FloatingType p=0, FloatingType d=0)
std::vector< T > min(const std::vector< T > &v1, const std::vector< T > &v2)
void setLastOutInterpolation(FloatingType lastOutFactor)
FloatingType getHiOutLimit() const
void reset()
reset phe controller
FloatingType getTargetRadius() const
FloatingType update()
update the controller using the last input and target value
This file offers overloads of toIce() and fromIce() functions for STL container types.
FloatingType getOutRampDelta() const