Brick
Loading...
Searching...
No Matches
bang_bang.h
Go to the documentation of this file.
1/**
2 * @file bang_bang.h
3 * @brief A control loop that utilizes only the positive error to get an output value
4 *
5 * This is a conventional pulse-width-modulation controller using the Feedback class as an
6 * interface. It calculates an output using only the current state and reference state
7 */
8
10#include "core/math/units.h"
11
12using namespace units::literals;
13
14/// Feedback child class to create pulse-width-modulation loops
15class BangBang : public Feedback<double, bool> {
16 public:
17 /// Resets the internal state of the BangBang controller
18 void reset() override;
19
20 /**
21 * @brief Updates the BangBang controller output
22 *
23 * @param state the current state the BangBand controller is at
24 * @param reference the target state for the BangBang controller
25 * @param dt the timestep since the last time this method was called
26 * @return the controller output
27 */
28 virtual bool update(const double& state, const double& reference,
29 const units::Time& dt = 10_ms) override;
30};
Feedback child class to create pulse-width-modulation loops.
Definition bang_bang.h:15
void reset() override
Resets the internal state of the BangBang controller.
virtual bool update(const double &state, const double &reference, const units::Time &dt=10_ms) override
Updates the BangBang controller output.
pure virtual class for generic feedback control loops.
Definition feedback.h:21
A pure virual class to function as an interface for all feedback control loops.
Definition units.h:691