39 assert(x.rows() == xref.
getDimension() &&
"Dimension mismatch in controller: current state x and reference");
46 PRINT_WARNING(
"PidController number of parallel PID controllers does not match dimension of the state vector.");
51 PRINT_WARNING(
"PidController: number of parallel PID controllers does not match number of required control inputs");
69 u.resize(_num_parallel_pid);
82 u_sequence->add(0.0, u);
83 x_sequence->add(0.0, x);
105 #ifdef MESSAGE_SUPPORT 106 void PidController::toMessage(corbo::messages::Controller& message)
const 108 message.mutable_pid_controller()->set_p_gain(
_p_gain);
109 message.mutable_pid_controller()->set_i_gain(
_i_gain);
110 message.mutable_pid_controller()->set_d_gain(
_d_gain);
114 message.mutable_pid_controller()->set_publish_error(
_publish_error);
117 void PidController::fromMessage(
const corbo::messages::Controller& message, std::stringstream* issues)
119 _p_gain = message.pid_controller().p_gain();
120 _i_gain = message.pid_controller().i_gain();
121 _d_gain = message.pid_controller().d_gain();
std::vector< double > _i_error
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
Eigen::VectorXd ControlVector
#define PRINT_WARNING(msg)
Print msg-stream.
std::vector< double > _d_error
virtual int getDimension() const =0
void setNumParallelPid(int num_parallel_pid)
void getAvailableSignals(SignalTargetInterface &signal_target, const std::string &ns="") const override
Retrieve available signals from the controller.
virtual void sendMeasurement(Measurement::ConstPtr measurement)=0
Send a measurement to the target.
Interface class for signal targets.
Representation of time stamps.
virtual void registerMeasurement(const std::string &unique_name, int value_dimension, const std::vector< std::string > &value_labels={}, bool zero_order_hold=false)=0
Register a measurement type at current target.
std::vector< double > _p_error
Eigen::VectorXd OutputVector
double toSec() const
Return duration in seconds.
void reset() override
Reset internal controller state and caches.
double toSec() const
Cast time stamp to seconds.
Interface class for reference trajectories.
Eigen::VectorXd StateVector
virtual void getReference(const Time &t, OutputVector &ref) const =0
std::shared_ptr< TimeSeries > Ptr
Representation of time durations.