iCub-main
|
Online Compensator Design. More...
#include <tuning.h>
Public Member Functions | |
OnlineCompensatorDesign () | |
Default constructor. More... | |
virtual bool | configure (yarp::dev::PolyDriver &driver, const yarp::os::Property &options) |
Configure the design. More... | |
virtual bool | isConfigured () const |
Check the configuration status. More... | |
virtual bool | tuneController (const yarp::os::Property &options, yarp::os::Property &results) |
Tune the controller once given the plant characteristics. More... | |
virtual bool | startPlantEstimation (const yarp::os::Property &options) |
Start off the plant estimation procedure. More... | |
virtual bool | startPlantValidation (const yarp::os::Property &options) |
Start off the plant validation procedure. More... | |
virtual bool | startStictionEstimation (const yarp::os::Property &options) |
Start off the stiction estimation procedure. More... | |
virtual bool | startControllerValidation (const yarp::os::Property &options) |
Start off the controller validation procedure. More... | |
virtual bool | isDone () |
Check the status of the current ongoing operation. More... | |
virtual bool | waitUntilDone () |
Wait until the current ongoing operation is accomplished. More... | |
virtual void | stopOperation () |
Stop any ongoing operation. More... | |
virtual bool | getResults (yarp::os::Property &results) |
Retrieve the results of the current ongoing operation. More... | |
virtual | ~OnlineCompensatorDesign () |
Destructor. More... | |
Protected Types | |
enum | { plant_estimation , plant_validation , stiction_estimation , controller_validation } |
Protected Member Functions | |
void | commandJoint (double &enc, double &u) |
bool | threadInit () |
void | run () |
void | threadRelease () |
bool | start () |
void | stop () |
Protected Attributes | |
OnlineDCMotorEstimator | plant |
OnlineStictionEstimator | stiction |
Kalman | predictor |
yarp::dev::IControlMode * | imod |
yarp::dev::IControlLimits * | ilim |
yarp::dev::IEncoders * | ienc |
yarp::dev::IPositionControl * | ipos |
yarp::dev::IPositionDirect * | idir |
yarp::dev::IPidControl * | ipid |
yarp::dev::IPWMControl * | ipwm |
yarp::dev::ICurrentControl * | icur |
yarp::dev::Pid * | pidCur |
yarp::dev::Pid | pidOld |
yarp::dev::Pid | pidNew |
std::mutex | mtx |
std::mutex | mtx_doneEvent |
std::condition_variable | cv_doneEvent |
yarp::os::BufferedPort< yarp::sig::Vector > | port |
yarp::sig::Vector | x0 |
yarp::sig::Vector | meanParams |
int | meanCnt |
double | P0 |
int | joint |
double | t0 |
double | t1 |
double | x_min |
double | x_max |
double | x_tg |
double | max_time |
double | max_pwm |
double | dpos_dV |
double | switch_timeout |
int | measure_update_ticks |
int | measure_update_cnt |
bool | controller_validation_ref_square |
double | controller_validation_ref_period |
double | controller_validation_ref_sustain_time |
int | controller_validation_cycles_to_switch |
int | controller_validation_num_cycles |
bool | controller_validation_stiction_yarp |
double | controller_validation_stiction_up |
double | controller_validation_stiction_down |
bool | pwm_pos |
bool | configured |
enum iCub::ctrl::OnlineCompensatorDesign:: { ... } | mode |
Online Compensator Design.
Tune in an online fashion a controller for a DC motor plant identified by means of OnlineDCMotorEstimator .
The design of the controller is such that the properties of the compensated closed-loop system comply with specifications given in terms of bandwidth and disturbance rejection.
This class has four operative modes: one for the plant estimation, one for the plant validation, one for the stiction estimation and one for validating the controller's design.
|
protected |
OnlineCompensatorDesign::OnlineCompensatorDesign | ( | ) |
Default constructor.
Definition at line 442 of file tuning.cpp.
|
virtual |
Destructor.
Definition at line 1115 of file tuning.cpp.
|
protected |
Definition at line 617 of file tuning.cpp.
|
virtual |
Configure the design.
driver | the device driver to control the robot part. |
options | the configuration options. |
Available options are to be given within the following groups:
[general]
joint <int>: specify the joint to be controlled.
port <string>: if given, specify the name of a yarp port to open in order to stream out relevant information.
[plant_estimation]
Ts <double>: specify the estimator sample time given in seconds.
Q <double>: specify the process noise covariance.
R <double>: specify the measurement noise covariance.
P0 <double>: specify the initial error covariance.
tau <double>: specify the initial mechanical time constant given in seconds.
K <double>: specify the initial plant gain.
max_pwm <double>: specify the amplitude of the square voltage waveform applied to the joint for identification purpose.
[stiction_estimation]
see OnlineStictionEstimator for a detailed description of available options.
Definition at line 459 of file tuning.cpp.
|
virtual |
Retrieve the results of the current ongoing operation.
results | property object containing the results depending on the current ongoing operation: while estimating the plant, results is (tau <double>) (K <double>) (tau_mean <double>) (K_mean <double>); while validating the plant, results is (position <double>) (velocity <double>); while estimating the stiction values, results is (stiction (<double> <double>)); while validating the controller, results is (voltage <double>) (reference <double>) (position <double>) (pid <string>), where pid is "old"|"new". |
Definition at line 1048 of file tuning.cpp.
|
inlinevirtual |
|
virtual |
Check the status of the current ongoing operation.
Definition at line 1025 of file tuning.cpp.
|
protected |
Definition at line 646 of file tuning.cpp.
|
protected |
|
virtual |
Start off the controller validation procedure.
The specified controller is put to test against the controller currently set within the firmware. The validation experiment foresees cycles of rising and falling transitions in the reference trajectory. The control is therefore continuously switched between the current and the new controller.
Once the validation has been carried out, then the low-level controller's paremeters are restored to their previous values.
options | property containing the validation options. Available otions are: (max_time <double>) specifies the maximum amount of time for the experiment; (Kp <double>) (Ki <double>) (Kd <double>) (tau_d <double>) (scale <int>) specify the controller's gains; (stiction (<double><double>)) specifies the stiction values; (stiction_compensation <string>) specifies whether the compensation is managed by the "firmware" (default) or the "middleware"; (ref_type <string>) specifies the waveform of the position reference ("square"|"min-jerk"); (ref_period <double>) specifies the period of the reference; (ref_sustain_time <double>) specifies how log (in seconds) the reference should be kept at the set-point before switching to next value (meaningful for min-jerk reference type); (cycles_to_switch <int>) specifies the number of cycles during which one controller is tested before the switch. |
Definition at line 971 of file tuning.cpp.
|
virtual |
Start off the plant estimation procedure.
options | property containing the estimation options. Available otions are: (max_time <double>) specifies the maximum amount of time for the experiment; (switch_timeout <double>) if greater than 0.0 specifies the timeout for voltage switching logic. |
Definition at line 891 of file tuning.cpp.
|
virtual |
Start off the plant validation procedure.
options | property containing the validation options. Available otions are: (max_time <double>) specifies the maximum amount of time for the experiment; (switch_timeout <double>) if greater than 0.0 specifies the timeout for voltage switching logic; (tau <double>) specifies the mechanical time constant of the plant to be validated; (K <double>) specifies the plant gain to be validated; (measure_update_ticks <int>) specifies how many sample ticks to take before updating the measurement in the Kalman filter, if <= 0 then no update is performed; (Q <double>) (R <double>) (P0 <double>) are the well known Kalman quantities for the noise statistics. |
Definition at line 905 of file tuning.cpp.
|
virtual |
Start off the stiction estimation procedure.
options | property containing the estimation options. Available otions are: (max_time <double>) specifies the maximum amount of time for the experiment; all the other options used while configuring the stiction estimator. |
Definition at line 953 of file tuning.cpp.
|
protected |
|
inlinevirtual |
|
protected |
Definition at line 547 of file tuning.cpp.
|
protected |
Definition at line 803 of file tuning.cpp.
|
virtual |
Tune the controller once given the plant characteristics.
The design requirements for the closed loop system are given in terms of bandwidth and properties for disturbance rejection.
The plant is assumed to be in the form:
\( K/\left(s \cdot \left(1+s\tau\right)\right). \)
The controller is in the form:
\( K_p + K_i/s. \)
The tuning is symbolic and by no means affects the gains of the low-level controller.
options | property object containing the plant characteristics as well as the design requirements: (tau <double>) (K <double>) (f_c <double>) (T_dr <double>); (type <string>) specifies the controller's architecture which can be "P" or "PI". |
results | property containing the design outcome in terms of \( K_p, K_i \) controller's parameters. The property's tags are respectively: Kp, Ki. |
Definition at line 838 of file tuning.cpp.
|
virtual |
Wait until the current ongoing operation is accomplished.
Definition at line 1035 of file tuning.cpp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
enum { ... } iCub::ctrl::OnlineCompensatorDesign::mode |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |