File pid.hpp

Author

Vincent Berenz

Copyright

Copyright (c) 2019, New York University and Max Planck Gesellschaft, License BSD-3-Clause

Date

2019-12-09

namespace package_template

Functions

PID &get_default_pid()

convenience factory for getting default controller, i.e.

same as PID(std::shared_ptr<DefaultConfiguration> configuration)

See

DefaultConfiguration

class PID
#include <pid.hpp>

Simple 1D pid controller.

Public Functions

PID()

Construct a default PID object using the DefaultConfiguration.

PID(const Gains_configuration &configuration)

Construct a new PID object using a user provided configuration.

Parameters
  • configuration:

~PID()
double compute(const double position, const double velocity, const double position_target, const double delta_time)

compute the force related to the pid controller.

Warning

this function is not stateless, as it performs integration. Call reset_pid() to reset the integral part.

Return

computed force

Parameters
  • position: current position

  • velocity: current velocity

  • position_target: target position

  • delta_time: time passed since last measurement. Used for integral computation

void reset_integral()

reset integral part of the PID

Private Members

const Gains_configuration *configuration_
bool private_configuration_
double integral_