Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# PIDsmoothedValue Class Reference

Calculation of the PID-value for a given target value, with or without boundary checks. More...

`#include <PIDsmoothedValue.h>`

List of all members.

## Public Member Functions
| PIDsmoothedValue ()
| Default constructor contains default vaules and weights.
| PIDsmoothedValue (double value, double p, double i, double d, double min=-100, double max=100.0, double maxaction=100.0)
| Constructor for user chosen weights and value types as above in the default constructor.
void | setMin (double m)
| Set the min value.
void | setMax (double m)
| Set the max value.
void | setWeightP (double p)
| set the P-weight
void | setWeightI (double i)
| set the P-weight
void | setWeightD (double d)
| set the P-weight
double | approximateVal (double newTargetVal)
| Calculation of the PID-value to return thereby it will not just calculate the PID-sum but also ensure that it lies within the given boundaries.
double | addOffset (double offset)
double | setTo (double val)
double | apprDiscrVal (double targetVal, double time, double maxIteration)
| Discreet and iterative value calculation.
double | getVal ()
| return the - if necessary modified - PID-value
double | approximateValNew (double newTargetVal)
| Calculation of the PID-value to return, just an alternative approach without any boundary checks and the D-value is not just calculated by the change of the target to object difference but by the object position change.
double | apprContVal (double targetVal, double time)
| Calculate the PID value as a continuous function.
double | getWeightP ()
| get the P-weight
double | getWeightI ()
| get the I-weight
double | getWeightD ()
| get the D-weight
double | getMin ()
| get the Min-border
double | getMax ()
| get the Max-border
void | reset (void)
| reset all values and the sums necessary for its calculation
void | resetTo (double val)
| reset all values and the sums necessary for its calculation and set the value to val
## Private Attributes
double | lastDifference
double | lastTargetVal
double | value
double | lastValue
bool | started
double | oldTargetVal
double | integralError
double | lastTime
double | p
double | i
double | d
double | min
double | max
double | maxaction

## Detailed Description

Calculation of the PID-value for a given target value, with or without boundary checks.

Definition at line 19 of file PIDsmoothedValue.h.

## Constructor & Destructor Documentation

PIDsmoothedValue::PIDsmoothedValue | ( |  | ) |

| Default constructor contains default vaules and weights. Value types are: First result value = 0; P-weight,I-weight,D-weight, Min PID - Value, Max PID - Value, Max PID - value change since recent PID - value. Definition at line 21 of file PIDsmoothedValue.cpp. References max, and min.

PIDsmoothedValue::PIDsmoothedValue | ( | double | value,
|  | double | p,
|  | double | i,
|  | double | d,
|  | double | min = -100,
|  | double | max = 100.0,
|  | double | maxaction = 100.0
| ) |

| Constructor for user chosen weights and value types as above in the default constructor. Definition at line 31 of file PIDsmoothedValue.cpp. References max, and min.

## Member Function Documentation

void PIDsmoothedValue::setMin | ( | double | m | ) |

| Set the min value. Definition at line 49 of file PIDsmoothedValue.cpp. References min.

void PIDsmoothedValue::setMax | ( | double | m | ) |

| Set the max value. Definition at line 59 of file PIDsmoothedValue.cpp. References max.

void PIDsmoothedValue::setWeightP | ( | double | p | ) |

| set the P-weight after using the constructor Definition at line 69 of file PIDsmoothedValue.cpp. References p. Referenced by GT2005MotionControl::handleMessage().

void PIDsmoothedValue::setWeightI | ( | double | i | ) |

| set the P-weight after using the constructor Definition at line 79 of file PIDsmoothedValue.cpp. References i.

void PIDsmoothedValue::setWeightD | ( | double | d | ) |

| set the P-weight after using the constructor Definition at line 89 of file PIDsmoothedValue.cpp.

double PIDsmoothedValue::approximateVal | ( | double | targetVal | ) |

| Calculation of the PID-value to return thereby it will not just calculate the PID-sum but also ensure that it lies within the given boundaries. Definition at line 101 of file PIDsmoothedValue.cpp. References i, integralError, lastDifference, lastValue, max, maxaction, min, p, and started. Referenced by apprDiscrVal(), GT2005BasicBehaviorGoToPointAndAvoidObstacles::execute(), resetTo(), and MotionStabilizer::stabilize().

double PIDsmoothedValue::addOffset | ( | double | offset | ) |

| Definition at line 325 of file PIDsmoothedValue.cpp. References lastValue. Referenced by setTo().

double PIDsmoothedValue::setTo | ( | double | val | ) |

| Definition at line 332 of file PIDsmoothedValue.cpp. References addOffset().

Here is the call graph for this function:

double PIDsmoothedValue::apprDiscrVal | ( | double | targetVal,
|  | double | time,
|  | double | maxIteration
| ) |

| Discreet and iterative value calculation. Definition at line 158 of file PIDsmoothedValue.cpp. References approximateVal(), lastValue, and resetTo().

Here is the call graph for this function:

double PIDsmoothedValue::getVal | ( |  | ) |

| return the - if necessary modified - PID-value Definition at line 287 of file PIDsmoothedValue.cpp. Referenced by MotionStabilizer::stabilize().

double PIDsmoothedValue::approximateValNew | ( | double | newTargetVal | ) |

| Calculation of the PID-value to return, just an alternative approach without any boundary checks and the D-value is not just calculated by the change of the target to object difference but by the object position change. During first tests the upper algorithm "approximateValue" showed a better convergence behavior that this one and is considered as the original algorithm Definition at line 193 of file PIDsmoothedValue.cpp. References i, integralError, lastTargetVal, p, and started.

double PIDsmoothedValue::apprContVal | ( | double | targetVal,
|  | double | time
| ) |

| Calculate the PID value as a continuous function. Definition at line 227 of file PIDsmoothedValue.cpp. References i, integralError, lastDifference, lastValue, max, maxaction, min, p, and started.

double PIDsmoothedValue::getWeightP | ( |  | ) |

| get the P-weight Definition at line 291 of file PIDsmoothedValue.cpp. References p.

double PIDsmoothedValue::getWeightI | ( |  | ) |

| get the I-weight Definition at line 294 of file PIDsmoothedValue.cpp. References i.

double PIDsmoothedValue::getWeightD | ( |  | ) |

| get the D-weight Definition at line 297 of file PIDsmoothedValue.cpp.

double PIDsmoothedValue::getMin | ( |  | ) |

| get the Min-border Definition at line 299 of file PIDsmoothedValue.cpp. References min.

double PIDsmoothedValue::getMax | ( |  | ) |

| get the Max-border Definition at line 300 of file PIDsmoothedValue.cpp. References max.

void PIDsmoothedValue::reset | ( | void |  | ) |

| reset all values and the sums necessary for its calculation Definition at line 307 of file PIDsmoothedValue.cpp. References integralError, lastTargetVal, and started. Referenced by resetTo().

void PIDsmoothedValue::resetTo | ( | double | val | ) |

| reset all values and the sums necessary for its calculation and set the value to val Definition at line 318 of file PIDsmoothedValue.cpp. References approximateVal(), and reset(). Referenced by apprDiscrVal(), and GT2005BasicBehaviorGoToPointAndAvoidObstacles::execute().

Here is the call graph for this function:

## Member Data Documentation

double PIDsmoothedValue::lastDifference`[private]`

| Definition at line 22 of file PIDsmoothedValue.h. Referenced by apprContVal(), and approximateVal().

double PIDsmoothedValue::lastTargetVal`[private]`

| Definition at line 23 of file PIDsmoothedValue.h. Referenced by approximateValNew(), and reset().

double PIDsmoothedValue::value`[private]`

| Definition at line 24 of file PIDsmoothedValue.h.

double PIDsmoothedValue::lastValue`[private]`

| Definition at line 25 of file PIDsmoothedValue.h. Referenced by addOffset(), apprContVal(), apprDiscrVal(), and approximateVal().

bool PIDsmoothedValue::started`[private]`

| Definition at line 26 of file PIDsmoothedValue.h. Referenced by apprContVal(), approximateVal(), approximateValNew(), and reset().

double PIDsmoothedValue::oldTargetVal`[private]`

| Definition at line 28 of file PIDsmoothedValue.h.

double PIDsmoothedValue::integralError`[private]`

| Definition at line 29 of file PIDsmoothedValue.h. Referenced by apprContVal(), approximateVal(), approximateValNew(), and reset().

double PIDsmoothedValue::lastTime`[private]`

| Definition at line 30 of file PIDsmoothedValue.h.

double PIDsmoothedValue::p`[private]`

| Definition at line 32 of file PIDsmoothedValue.h. Referenced by apprContVal(), approximateVal(), approximateValNew(), getWeightP(), and setWeightP().

double PIDsmoothedValue::i`[private]`

| Definition at line 33 of file PIDsmoothedValue.h. Referenced by apprContVal(), approximateVal(), approximateValNew(), getWeightI(), and setWeightI().

double PIDsmoothedValue::d`[private]`

| Definition at line 34 of file PIDsmoothedValue.h.

double PIDsmoothedValue::min`[private]`

| Definition at line 35 of file PIDsmoothedValue.h. Referenced by apprContVal(), approximateVal(), getMin(), and setMin().

double PIDsmoothedValue::max`[private]`

| Definition at line 36 of file PIDsmoothedValue.h. Referenced by apprContVal(), approximateVal(), getMax(), and setMax().

double PIDsmoothedValue::maxaction`[private]`

| Definition at line 37 of file PIDsmoothedValue.h. Referenced by apprContVal(), and approximateVal().

The documentation for this class was generated from the following files:

- Tools/Math/PIDsmoothedValue.h
- Tools/Math/PIDsmoothedValue.cpp