Dual mode controller. More...
#include <dual_mode_controller.h>
Public Types | |
using | Ptr = std::shared_ptr< DualModeController > |
![]() | |
using | ControlVector = Eigen::VectorXd |
using | Ptr = std::shared_ptr< ControllerInterface > |
using | StateVector = Eigen::VectorXd |
using | UPtr = std::unique_ptr< ControllerInterface > |
Public Member Functions | |
DualModeController ()=default | |
void | getAvailableSignals (SignalTargetInterface &signal_target, const std::string &ns="") const override |
Retrieve available signals from the controller. More... | |
double | getControlDuration () const override |
Return the duration for which the control u obtained from step() is valid (useful for asynchronous control) More... | |
int | getControlInputDimension () const override |
Return the control input dimension. More... | |
ControllerInterface::Ptr | getInstance () const override |
Return a newly created shared instance of the implemented class. More... | |
int | getStateDimension () const override |
Return the dimension of the required plant state/output. More... | |
ControllerStatistics::Ptr | getStatistics () const override |
bool | hasPiecewiseConstantControls () const override |
Return true if the controller returns piecewise constant control pieces. More... | |
bool | initialize (const StateVector &x, ReferenceTrajectoryInterface &expected_xref, ReferenceTrajectoryInterface &expected_uref, const Duration &expected_dt, const Time &t, ReferenceTrajectoryInterface *sref=nullptr) override |
Initialize the controller. More... | |
bool | providesFutureControls () const override |
bool | providesFutureStates () const override |
void | reset () override |
Reset internal controller state and caches. More... | |
void | sendSignals (double t, SignalTargetInterface &signal_target, const std::string &ns="") const override |
void | setLocalController (ControllerInterface::Ptr local_controller) |
bool | setWeightS (const Eigen::Ref< const Eigen::MatrixXd > &S) |
bool | step (const StateVector &x, ReferenceTrajectoryInterface &xref, ReferenceTrajectoryInterface &uref, const Duration &dt, const Time &t, TimeSeries::Ptr u_sequence, TimeSeries::Ptr x_sequence, SignalTargetInterface *signal_target=nullptr, ReferenceTrajectoryInterface *sref=nullptr, ReferenceTrajectoryInterface *xinit=nullptr, ReferenceTrajectoryInterface *uinit=nullptr, const std::string &ns="") override |
bool | supportsAsynchronousControl () const override |
Specify whether the controllers step function is independent of dt and getControlDuration() returns a valid value. More... | |
![]() | |
virtual bool | step (const StateVector &x, ReferenceTrajectoryInterface &xref, ReferenceTrajectoryInterface &uref, const Duration &dt, const Time &t, ControlVector &u, SignalTargetInterface *signal_target=nullptr, const std::string &ns="") |
Perform actual controller step / control law computation. More... | |
virtual | ~ControllerInterface () |
Virtual destructor. More... | |
Static Public Member Functions | |
static Ptr | getInstanceStatic () |
![]() | |
static Factory< ControllerInterface > & | getFactory () |
Get access to the associated factory. More... | |
Protected Member Functions | |
bool | isInsideInTerminalBall (const Eigen::Ref< const Eigen::VectorXd > &x0, const Eigen::Ref< const Eigen::VectorXd > &xf) const |
Private Attributes | |
bool | _first_run = true |
double | _gamma = 0.0 |
bool | _initialized = false |
ControllerInterface::Ptr | _local_controller |
bool | _local_ctrl_active = false |
double | _min_dt = 0 |
PredictiveController | _pred_controller |
Eigen::MatrixXd | _S |
ControllerStatistics | _statistics |
bool | _switch_dt = false |
bool | _switch_terminal_ball = false |
Dual mode controller.
Use predictive controller until some conditions are satisfied (terminal region, min dt) and then switch to an LQR.
Definition at line 69 of file dual_mode_controller.h.
using corbo::DualModeController::Ptr = std::shared_ptr<DualModeController> |
Definition at line 94 of file dual_mode_controller.h.
|
default |
|
overridevirtual |
Retrieve available signals from the controller.
Register a-priori known signals at the signal target. Registration is optional. Note, during step() execution further signals might occur without registration (in case the they are not known in advance or the implementation lacks a proper registration).
[in,out] | signal_target | Target for occuring signals [optional] |
Reimplemented from corbo::ControllerInterface.
Definition at line 129 of file dual_mode_controller.cpp.
|
inlineoverridevirtual |
Return the duration for which the control u obtained from step() is valid (useful for asynchronous control)
Reimplemented from corbo::ControllerInterface.
Definition at line 133 of file dual_mode_controller.h.
|
inlineoverridevirtual |
Return the control input dimension.
Implements corbo::ControllerInterface.
Definition at line 99 of file dual_mode_controller.h.
|
inlineoverridevirtual |
Return a newly created shared instance of the implemented class.
Implements corbo::ControllerInterface.
Definition at line 119 of file dual_mode_controller.h.
|
inlinestatic |
Definition at line 120 of file dual_mode_controller.h.
|
inlineoverridevirtual |
Return the dimension of the required plant state/output.
Depending on the controller type, the state dimension can also be just the plant output or the complete measured or observed state vector.
Implements corbo::ControllerInterface.
Definition at line 101 of file dual_mode_controller.h.
|
inlineoverridevirtual |
Reimplemented from corbo::ControllerInterface.
Definition at line 153 of file dual_mode_controller.h.
|
inlineoverridevirtual |
Return true if the controller returns piecewise constant control pieces.
Implements corbo::ControllerInterface.
Definition at line 103 of file dual_mode_controller.h.
|
overridevirtual |
Initialize the controller.
Initialization should be optional but it should facilitate memory allocation and trajectory initialization respectively warm starting.
[in] | x | Current plant state [getStateDimension() x 1] |
[in] | expected_xref | State reference (writable in order to allow to the reference object to precompute caches) |
[in] | expected_uref | Control reference (writable in order to allow to the reference object to precompute caches) |
[in] | expected_dt | Expected sampling interval length (controller rate) |
[in] | t | Current time stamp (can be sim-time or system-time, but compatible to state and control references) |
Reimplemented from corbo::ControllerInterface.
Definition at line 55 of file dual_mode_controller.cpp.
|
protected |
Definition at line 123 of file dual_mode_controller.cpp.
|
inlineoverridevirtual |
Implements corbo::ControllerInterface.
Definition at line 108 of file dual_mode_controller.h.
|
inlineoverridevirtual |
Implements corbo::ControllerInterface.
Definition at line 113 of file dual_mode_controller.h.
|
overridevirtual |
Reset internal controller state and caches.
Implements corbo::ControllerInterface.
Definition at line 137 of file dual_mode_controller.cpp.
|
overridevirtual |
Reimplemented from corbo::ControllerInterface.
Definition at line 145 of file dual_mode_controller.cpp.
|
inline |
Definition at line 140 of file dual_mode_controller.h.
bool corbo::DualModeController::setWeightS | ( | const Eigen::Ref< const Eigen::MatrixXd > & | S | ) |
Definition at line 156 of file dual_mode_controller.cpp.
|
overridevirtual |
Implements corbo::ControllerInterface.
Definition at line 78 of file dual_mode_controller.cpp.
|
inlineoverridevirtual |
Specify whether the controllers step function is independent of dt and getControlDuration() returns a valid value.
Reimplemented from corbo::ControllerInterface.
Definition at line 143 of file dual_mode_controller.h.
|
private |
Definition at line 190 of file dual_mode_controller.h.
|
private |
Definition at line 186 of file dual_mode_controller.h.
|
private |
Definition at line 192 of file dual_mode_controller.h.
|
private |
Definition at line 178 of file dual_mode_controller.h.
|
private |
Definition at line 183 of file dual_mode_controller.h.
|
private |
Definition at line 188 of file dual_mode_controller.h.
|
private |
Definition at line 177 of file dual_mode_controller.h.
|
private |
Definition at line 185 of file dual_mode_controller.h.
|
private |
Definition at line 175 of file dual_mode_controller.h.
|
private |
Definition at line 180 of file dual_mode_controller.h.
|
private |
Definition at line 181 of file dual_mode_controller.h.