Speeduino
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
PidTuningParameters Struct Reference

Structure to hold PID tuning parameters. More...

#include <PidTuningParameters.h>

Public Member Functions

constexpr PidTuningParameters (uint8_t kp=1U, uint8_t ki=1U, uint8_t kd=1U)
 Construct a new PidTuningParameters object.
 
int32_t compute (int32_t proportional, int32_t integral, int32_t derivative) const
 Basic PID calculation.
 

Public Attributes

int16_t Kp
 Proportional Tuning Parameter.
 
int16_t Ki
 Integral Tuning Parameter.
 
int16_t Kd
 Derivative Tuning Parameter.
 

Friends

constexpr PidTuningParameters operator* (const PidTuningParameters &params, int8_t scalar)
 Scalar multiplication operator for easy tuning adjustments.
 
constexpr PidTuningParameters operator* (int8_t scalar, const PidTuningParameters &params)
 Scalar multiplication operator for easy tuning adjustments.
 
constexpr PidTuningParameters operator/ (const PidTuningParameters &params, int8_t scalar)
 Scalar division operator for easy tuning adjustments.
 
constexpr PidTuningParameters operator/ (int8_t scalar, const PidTuningParameters &params)
 Scalar division operator for easy tuning adjustments.
 

Detailed Description

Structure to hold PID tuning parameters.

Constructor & Destructor Documentation

◆ PidTuningParameters()

constexpr PidTuningParameters::PidTuningParameters ( uint8_t  kp = 1U,
uint8_t  ki = 1U,
uint8_t  kd = 1U 
)
inlineexplicitconstexpr

Construct a new PidTuningParameters object.

Note
The parameters are uint8_t for memory efficiency, but are stored as int16_t to allow for a wide range of tuning values. They can be scaled as needed using the provided operators or by adjusting the tunings directly.
Parameters
kpProportional tuning parameter (default 1)
kiIntegral tuning parameter (default 1)
kdDerivative tuning parameter (default 1)

Member Function Documentation

◆ compute()

int32_t PidTuningParameters::compute ( int32_t  proportional,
int32_t  integral,
int32_t  derivative 
) const
inline

Basic PID calculation.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator* [1/2]

Scalar multiplication operator for easy tuning adjustments.

◆ operator* [2/2]

Scalar multiplication operator for easy tuning adjustments.

◆ operator/ [1/2]

Scalar division operator for easy tuning adjustments.

◆ operator/ [2/2]

Scalar division operator for easy tuning adjustments.

Member Data Documentation

◆ Kd

int16_t PidTuningParameters::Kd

Derivative Tuning Parameter.

◆ Ki

int16_t PidTuningParameters::Ki

Integral Tuning Parameter.

◆ Kp

int16_t PidTuningParameters::Kp

Proportional Tuning Parameter.


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