|
Fang-Robotics-MCB
Fang Robotics Team Codebase
|
#include <dual_modded_pid.hpp>
Classes | |
| struct | Config |
Public Types | |
| using | MainPid = ModdedPid< MainType, IntermediateType, TimeType > |
| using | IntermediatePid = ModdedPid< IntermediateType, OutputType, TimeType > |
| using | MainModder = IPidModder< IntermediateType > |
| using | IntermediateModder = IPidModder< OutputType > |
Public Member Functions | |
| DualModdedPid (const Config &config, std::unique_ptr< MainModder > mainModder=std::make_unique< NullPidModder< IntermediateType > >(), std::unique_ptr< IntermediateModder > intermediateModder=std::make_unique< NullPidModder< OutputType > >()) | |
| OutputType | runController (const MainType &mainCurrent, const IntermediateType &intermediateCurrent) |
| OutputType | runController (const MainType &mainCurrent, const IntermediateType &intermediateCurrent, const TimeType &deltaTime) |
| void | setTarget (const MainType &mainTarget) |
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
| using trap::algorithms::DualModdedPid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError >::IntermediateModder = IPidModder<OutputType> |
| using trap::algorithms::DualModdedPid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError >::IntermediatePid = ModdedPid<IntermediateType, OutputType, TimeType> |
| using trap::algorithms::DualModdedPid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError >::MainModder = IPidModder<IntermediateType> |
| using trap::algorithms::DualModdedPid< MainType, IntermediateType, OutputType, TimeType, MainError, IntermediateError >::MainPid = ModdedPid<MainType, IntermediateType, TimeType> |
|
inline |
|
inline |
| 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
|
inline |
Allows unit testing an manual time determination see the main version for parameter information
|
inline |