25 #ifndef SRC_CONTROLLERS_INCLUDE_CORBO_CONTROLLERS_LQR_CONTROLLER_H_
26 #define SRC_CONTROLLERS_INCLUDE_CORBO_CONTROLLERS_LQR_CONTROLLER_H_
74 class LqrController :
public ControllerInterface
77 using Ptr = std::shared_ptr<LqrController>;
83 int getControlInputDimension()
const override {
return _system_model ? _system_model->getInputDimension() : 0; }
85 int getStateDimension()
const override {
return _system_model ? _system_model->getStateDimension() : 0; }
87 bool hasPiecewiseConstantControls()
const override {
return false; }
89 bool providesFutureControls()
const override {
return false; }
91 bool providesFutureStates()
const override {
return false; }
113 bool initialize(
const StateVector&
x, ReferenceTrajectoryInterface& expected_xref, ReferenceTrajectoryInterface& expected_uref,
114 const Duration& expected_dt,
const Time& t, ReferenceTrajectoryInterface* sref =
nullptr)
override;
117 bool step(
const StateVector&
x, ReferenceTrajectoryInterface& xref, ReferenceTrajectoryInterface& uref,
const Duration& dt,
const Time& t,
119 ReferenceTrajectoryInterface* sref =
nullptr, ReferenceTrajectoryInterface* xinit =
nullptr,
120 ReferenceTrajectoryInterface* uinit =
nullptr,
const std::string& ns =
"")
override;
123 void getAvailableSignals(SignalTargetInterface& signal_target,
const std::string& ns =
"")
const override;
127 #ifdef MESSAGE_SUPPORT
128 void toMessage(corbo::messages::LqrController& message)
const;
129 void fromMessage(
const corbo::messages::LqrController& message, std::stringstream* issues =
nullptr);
131 void toMessage(corbo::messages::Controller& message)
const override { toMessage(*message.mutable_lqr_controller()); }
133 void fromMessage(
const corbo::messages::Controller& message, std::stringstream* issues =
nullptr)
override
135 fromMessage(message.lqr_controller(), issues);
140 void reset()
override;
143 void setPublishError(
bool publish) { _publish_error = publish; }
147 bool _discrete_time =
false;
149 bool _initialized =
false;
151 bool _publish_error =
true;
170 #endif // SRC_CONTROLLERS_INCLUDE_CORBO_CONTROLLERS_LQR_CONTROLLER_H_