Pid Class Reference

A basic pid class. More...

#include <sr_plain_pid.hpp>

Detailed Description

A basic pid class.

This class implements a generic structure that can be used to create a wide range of pid controllers. It can function independently or be subclassed to provide more specific controls based on a particular control loop.

In particular, this class implements the standard pid equation:

$command = -p_{term} - i_{term} - d_{term} $

where:

given:

ROS

Parameters
pProportional gain
dDerivative gain
iIntegral gain
i_clampMin/max bounds for the integral windup, the clamp is applied to the $i_{term}$
publish_stateEnable publishing internal controller state on the state topic. May break real-time guarantees due to clock_gettime system call.

Usage

To use the Pid class, you should first call some version of init() (in non-realtime) and then call updatePid() at every update step. For example:

control_toolbox::Pid pid;
pid.initPid(6.0, 1.0, 2.0, 0.3, -0.3);
double position_desi_ = 0.5;
...
ros::Time last_time = ros::Time::now();
while (true) {
ros::Time time = ros::Time::now();
double effort = pid.updatePid(currentPosition() - position_desi_, time - last_time);
last_time = time;
}

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


sr_mechanism_controllers
Author(s): Ugo Cupcic
autogenerated on Tue Oct 13 2020 03:55:58