Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
modded_pid.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "smooth_pid.hpp"
4#include "ipid_modder.hpp"
5
6namespace trap::algorithms
7{
11template<typename ErrorType, typename ControlType, typename TimeUnit>
12class ModdedPid : public SmoothPid<ErrorType, ControlType, TimeUnit>
13{
14public:
19 const Config& config,
20 std::unique_ptr<IModder> modder = std::make_unique<NullPidModder<ControlType>>(),
21 ErrorType initialLastError = ErrorType{0.0}
22 ):
23 BasePid(config, initialLastError),
24 modder_(std::move(modder))
25 {}
26
32 ControlType runController(ErrorType error)
33 {
34 return modder_->getModdedOutput(BasePid::runController(error));
35 }
36
40 ControlType runController(const ErrorType& error, const TimeUnit& deltaTime)
41 {
42 return modder_->getModdedOutput(BasePid::runController(error, deltaTime));
43 }
44private:
45 std::unique_ptr<IModder> modder_;
46};
47}
Definition ipid_modder.hpp:14
Definition modded_pid.hpp:13
ControlType runController(const ErrorType &error, const TimeUnit &deltaTime)
Definition modded_pid.hpp:40
ModdedPid(const Config &config, std::unique_ptr< IModder > modder=std::make_unique< NullPidModder< ControlType > >(), ErrorType initialLastError=ErrorType{0.0})
Definition modded_pid.hpp:18
ControlType runController(ErrorType error)
Definition modded_pid.hpp:32
SmoothPid< ErrorType, ControlType, TimeUnit > BasePid
Definition modded_pid.hpp:16
Definition ipid_modder.hpp:28
Definition smooth_pid.hpp:22
ControlType runController(ErrorType error)
Definition smooth_pid.hpp:37
tap::algorithms::SmoothPidConfig Config
Definition smooth_pid.hpp:25
Definition pwm_info.hpp:4
Definition dimensional_smooth_pid.hpp:10
Definition smooth_pid.hpp:36