Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
trap::algorithms::DualCascadePid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError > Class Template Reference

#include <dual_cascade_pid.hpp>

Classes

struct  Config
 

Public Types

using MainPid = SmoothPid< MainType, IntermediateType, TimeType >
 
using IntermediatePid = SmoothPid< IntermediateType, OutputType, TimeType >
 

Public Member Functions

 DualCascadePid (const Config &config)
 
OutputType runController (const MainType &mainCurrent, const IntermediateType &intermediateCurrent)
 
OutputType runController (const MainType &mainCurrent, const IntermediateType &intermediateCurrent, const TimeType &deltaTime)
 
void setTarget (const MainType &mainTarget)
 

Detailed Description

template<typename MainType, typename IntermediateType, typename OutputType, typename TimeType, typename MainError = MainType, typename IntermediateError = IntermediateType>
class trap::algorithms::DualCascadePid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError >

Cascading PID

MainType is the type for the beginning and main targeted value Intermediate is the type that is in the middle Output is the type of the calculated value

MainError and IntermediateError is a custom override for utilizing types which override arithmetic (wrapped float types). They should be convertible or constructible from and to MainType and IntermediateType respectively

Error is calculated with target - current. So any overload of the operator- will allow for custom behavior

e.g. Radians which then output a target RPM which outputs an abstract Motoroutput

The main target is the radians, but the target for the intermediate error is give by the first PID

Member Typedef Documentation

◆ IntermediatePid

template<typename MainType , typename IntermediateType , typename OutputType , typename TimeType , typename MainError = MainType, typename IntermediateError = IntermediateType>
using trap::algorithms::DualCascadePid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError >::IntermediatePid = SmoothPid<IntermediateType, OutputType, TimeType>

◆ MainPid

template<typename MainType , typename IntermediateType , typename OutputType , typename TimeType , typename MainError = MainType, typename IntermediateError = IntermediateType>
using trap::algorithms::DualCascadePid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError >::MainPid = SmoothPid<MainType, IntermediateType, TimeType>

Constructor & Destructor Documentation

◆ DualCascadePid()

template<typename MainType , typename IntermediateType , typename OutputType , typename TimeType , typename MainError = MainType, typename IntermediateError = IntermediateType>
trap::algorithms::DualCascadePid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError >::DualCascadePid ( const Config config)
inline

Member Function Documentation

◆ runController() [1/2]

template<typename MainType , typename IntermediateType , typename OutputType , typename TimeType , typename MainError = MainType, typename IntermediateError = IntermediateType>
OutputType trap::algorithms::DualCascadePid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError >::runController ( const MainType &  mainCurrent,
const IntermediateType &  intermediateCurrent 
)
inline
Parameters
mainCurent- current value of main
intermediateCurrent- current value of intermediate type

WARNING: THIS IS DIFFERENT FROM STANDARD PID API This wrapper automatically calculates how much the error has changed and the amount of time which has passed between calls

◆ runController() [2/2]

template<typename MainType , typename IntermediateType , typename OutputType , typename TimeType , typename MainError = MainType, typename IntermediateError = IntermediateType>
OutputType trap::algorithms::DualCascadePid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError >::runController ( const MainType &  mainCurrent,
const IntermediateType &  intermediateCurrent,
const TimeType &  deltaTime 
)
inline

Allows unit testing an manual time determination see the main version for parameter information

◆ setTarget()

template<typename MainType , typename IntermediateType , typename OutputType , typename TimeType , typename MainError = MainType, typename IntermediateError = IntermediateType>
void trap::algorithms::DualCascadePid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError >::setTarget ( const MainType &  mainTarget)
inline

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