- 3.0.2 core module.
StepInputController.h
Go to the documentation of this file.
1 /**********************************************************************************************************************
2 This file is part of the Control Toolbox (https://github.com/ethz-adrl/control-toolbox), copyright by ETH Zurich.
3 Licensed under the BSD-2 license (see LICENSE file in main directory)
4 **********************************************************************************************************************/
5 
6 #pragma once
7 
8 namespace ct {
9 namespace core {
10 
12 
30 class StepInputController : public Controller<1, 1, double>
31 {
32 public:
34 
37  struct Parameters
38  {
39  Parameters(double gain_ = 1.0, double t_step_ = 1.0) : gain(gain_), t_step(t_step_) {}
40  double gain;
42  };
43 
45  StepInputController(const Parameters& parameters = Parameters()) : parameters_(parameters) {}
47  StepInputController(const StepInputController& arg) : parameters_(arg.parameters_) {}
49  StepInputController* clone() const override { return new StepInputController(*this); }
51 
58  const double& t,
59  ControlVector<1, double>& controlAction) override
60  {
61  controlAction(0) = parameters_.gain * (t >= parameters_.t_step);
62  }
63 
64 private:
65  Parameters parameters_;
66 };
67 } // namespace core
68 } // namespace ct
void computeControl(const StateVector< 1, double > &state, const double &t, ControlVector< 1, double > &controlAction) override
computes control input
Definition: StepInputController.h:57
A simple step input.
Definition: StepInputController.h:30
StepInputController(const StepInputController &arg)
copy constructor
Definition: StepInputController.h:47
StepInputController * clone() const override
deep cloning
Definition: StepInputController.h:49
StepInputController(const Parameters &parameters=Parameters())
default constructor
Definition: StepInputController.h:45
Definition: ControlVector.h:12
Parameters(double gain_=1.0, double t_step_=1.0)
Definition: StepInputController.h:39
Definition: StateVector.h:12
double gain
Definition: StepInputController.h:40
Time t_step
gain
Definition: StepInputController.h:41
Parameters of the step input function.
Definition: StepInputController.h:37
double Time
Definition: Time.h:11
Interface class for all controllers.
Definition: Controller.h:26