A controller that implements a simple PID control loop.
More...
|
|
double | m_p |
| The gain for proportional error.
|
|
double | m_i |
| The gain for integral error.
|
|
double | m_d |
| The gain for derivative error.
|
|
Cfg | m_previousError |
| The last step's error value.
|
|
Cfg | m_integral |
| The integrated error history.
|
|
Cfg | m_target |
| The previous target.
|
|
|
Robot *const | m_robot |
| The owning robot object.
|
|
ControlSet * | m_controls {nullptr} |
| The discrete controls, if any.
|
|
bool | m_debug {false} |
| Show debug messages?
|
|
A controller that implements a simple PID control loop.
◆ PIDFeedback() [1/3]
PIDFeedback::PIDFeedback |
( |
Robot *const |
_r, |
|
|
const double |
_p, |
|
|
const double |
_i, |
|
|
const double |
_d |
|
) |
| |
Construct a PID feedback controller.
- Parameters
-
[in] | _r | The robot to control. |
[in] | _p | The proportional gain. |
[in] | _i | The integral gain. |
[in] | _d | The derivative gain. |
◆ PIDFeedback() [2/3]
PIDFeedback::PIDFeedback |
( |
Robot *const |
_r, |
|
|
XMLNode & |
_node |
|
) |
| |
Construct a PID feedback controller from an XML node.
- Parameters
-
[in] | _r | The robot to control. |
[in] | _node | The XML node to parse. |
◆ PIDFeedback() [3/3]
Copy a controller for another robot.
- Parameters
-
_r | The destination robot. |
_c | The controller to copy. |
◆ Clone()
Create a copy of this controller for another robot. This is provided so that we can copy controllers without knowing their derived type.
- Parameters
-
_r | The robot receiving the cloned controller. |
- Returns
- The cloned controller.
Implements ControllerMethod.
◆ operator()()
Control PIDFeedback::operator() |
( |
const Cfg & |
_current, |
|
|
const Cfg & |
_target, |
|
|
const double |
_dt |
|
) |
| |
|
overridevirtual |
Find the best available control to steer a robot from a starting configuration to a target configuration.
- Parameters
-
_current | The current configuration. |
_target | The target configuration. |
_dt | The timestep length. |
- Returns
- The best available control for steering from _current to _target.
Reimplemented from ControllerMethod.
◆ ComputeDesiredForce()
std::vector< double > PIDFeedback::ComputeDesiredForce |
( |
const Cfg & |
_current, |
|
|
const Cfg & |
_target, |
|
|
const double |
_dt |
|
) |
| |
|
overrideprotectedvirtual |
Compute the desired generalized force (or velocity) in the robot's local frame to move from the current position to the target.
- Parameters
-
_current | The current configuration. |
_target | The target configuration. |
_dt | The timestep length. |
- Returns
- The ideal generalized force.
Implements ControllerMethod.
◆ Initialize()
void PIDFeedback::Initialize |
( |
const Cfg & |
_target | ) |
|
|
protected |
PID controllers re-initialize every time they change targets.
- Parameters
-
[in] | _target | The target configuration. |
◆ Factory()
Create a dynamically-allocated controller from an XML node.
- Parameters
-
_r | The robot to control. |
_node | The XML node to read parameters from. |
- Returns
- A controller of the type described by _node.
◆ GetRandomControl()
Control ControllerMethod::GetRandomControl |
( |
const Cfg & |
_current, |
|
|
const double |
_dt |
|
) |
| const |
|
virtualnoexceptinherited |
Find a random control.
- Parameters
-
_current | The current configuration. |
_dt | The timestep length. |
- Returns
- A random control that can be executed from _current for _dt steps.
Reimplemented in CarlikeNeedleController, and MatlabNeedleController.
◆ GetControlSet()
ControlSet * ControllerMethod::GetControlSet |
( |
| ) |
|
|
noexceptinherited |
Get the discrete set of controls that this controller can use, if any.
- Returns
- The discrete set of controls for this controller, or null if it uses a continuous space(s) of controls.
◆ SetControlSet()
void ControllerMethod::SetControlSet |
( |
ControlSet *const |
_c | ) |
|
|
noexceptinherited |
Set a discrete set of controls for this controller to use. This limits the controller to a subset of all possible controls accepted by a robot's actuators.
- Parameters
-
_c | The control set to use. |
◆ ComputeNearestControl()
Control ControllerMethod::ComputeNearestControl |
( |
const Cfg & |
_current, |
|
|
std::vector< double > && |
_force |
|
) |
| |
|
protectedvirtualinherited |
Compute the control that produces the closest force to the ideal.
- Parameters
-
_current | The current configuration. |
_force | The desired force in the robot's local frame. |
- Returns
- The control whose result is nearest to _force.
◆ ComputeNearestContinuousControl()
Control ControllerMethod::ComputeNearestContinuousControl |
( |
const Cfg & |
_current, |
|
|
std::vector< double > && |
_force |
|
) |
| |
|
protectedvirtualinherited |
Compute the continuous control that produces the closest force to the ideal.
- Parameters
-
_current | The current configuration. |
_force | The desired force in the robot's local frame. |
- Returns
- The control whose result is nearest to _force.
Reimplemented in CarlikeNeedleController.
◆ ComputeNearestDiscreteControl()
Control ControllerMethod::ComputeNearestDiscreteControl |
( |
const Cfg & |
_current, |
|
|
std::vector< double > && |
_force |
|
) |
| |
|
protectedvirtualinherited |
Compute the discrete control that produces the closest force to the ideal.
- Parameters
-
_current | The current configuration. |
_force | The desired force in the robot's local frame. |
- Returns
- The control whose result is nearest to _force.
The documentation for this class was generated from the following files:
- PIDFeedback.h
- PIDFeedback.cpp