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 47 of file dual_mode_controller.h.
using corbo::DualModeController::Ptr = std::shared_ptr<DualModeController> |
Definition at line 50 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 107 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 89 of file dual_mode_controller.h.
|
inlineoverridevirtual |
Return the control input dimension.
Implements corbo::ControllerInterface.
Definition at line 55 of file dual_mode_controller.h.
|
inlineoverridevirtual |
Return a newly created shared instance of the implemented class.
Implements corbo::ControllerInterface.
Definition at line 75 of file dual_mode_controller.h.
|
inlinestatic |
Definition at line 76 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 57 of file dual_mode_controller.h.
|
inlineoverridevirtual |
Reimplemented from corbo::ControllerInterface.
Definition at line 109 of file dual_mode_controller.h.
|
inlineoverridevirtual |
Return true if the controller returns piecewise constant control pieces.
Implements corbo::ControllerInterface.
Definition at line 59 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 33 of file dual_mode_controller.cpp.
|
protected |
Definition at line 101 of file dual_mode_controller.cpp.
|
inlineoverridevirtual |
Implements corbo::ControllerInterface.
Definition at line 64 of file dual_mode_controller.h.
|
inlineoverridevirtual |
Implements corbo::ControllerInterface.
Definition at line 69 of file dual_mode_controller.h.
|
overridevirtual |
Reset internal controller state and caches.
Implements corbo::ControllerInterface.
Definition at line 115 of file dual_mode_controller.cpp.
|
overridevirtual |
Reimplemented from corbo::ControllerInterface.
Definition at line 123 of file dual_mode_controller.cpp.
|
inline |
Definition at line 96 of file dual_mode_controller.h.
bool corbo::DualModeController::setWeightS | ( | const Eigen::Ref< const Eigen::MatrixXd > & | S | ) |
Definition at line 134 of file dual_mode_controller.cpp.
|
overridevirtual |
Implements corbo::ControllerInterface.
Definition at line 56 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 99 of file dual_mode_controller.h.
|
private |
Definition at line 146 of file dual_mode_controller.h.
|
private |
Definition at line 142 of file dual_mode_controller.h.
|
private |
Definition at line 148 of file dual_mode_controller.h.
|
private |
Definition at line 134 of file dual_mode_controller.h.
|
private |
Definition at line 139 of file dual_mode_controller.h.
|
private |
Definition at line 144 of file dual_mode_controller.h.
|
private |
Definition at line 133 of file dual_mode_controller.h.
|
private |
Definition at line 141 of file dual_mode_controller.h.
|
private |
Definition at line 131 of file dual_mode_controller.h.
|
private |
Definition at line 136 of file dual_mode_controller.h.
|
private |
Definition at line 137 of file dual_mode_controller.h.