Class PID#
Defined in File PID.h
Inheritance Relationships#
Base Type#
public Karana::Models::KModel< PID, PIDParams >(Template Class KModel)
Class Documentation#
-
class PID : public Karana::Models::KModel<PID, PIDParams>#
Simple PID controller model.
Public Functions
-
PID(std::string_view name, const kc::ks_ptr<kd::StatePropagator> &sp, const kc::ks_ptr<kd::PhysicalSubhinge> &sh, std::function<km::Vec(const km::Ktime&)> q_traj, std::function<km::Vec(const km::Ktime&)> u_traj)#
Constructor. The PID model adds force to a subhinge. The model uses the incoming function as the desired trajectory. The output of this function should be the desired Q values of the subhinge.
- Parameters:
name – The name of the model.
sp – The StatePropagator to register this model with.
sh – The Subhinge to apply the forces calculated by the PID controller to.
q_traj – A function that defines the reference trajectory for Q.
u_traj – A function that defines the reference trajectory for U.
-
void preDeriv(const km::Ktime &t, const km::Vec &x)#
Calculate and apply the output of the PID model to the subhinge.
- Parameters:
t – Current time.
x – Current state. Not used.
-
void preModelStep(const km::Ktime &t, const km::Vec &x)#
Calculate the contribution of integral control.
- Parameters:
t – Current time.
x – Current state. Not used.
-
virtual const std::string &typeString() const noexcept#
Returns the type string of LockingBase.
- Returns:
The type string.
Public Static Functions
-
static kc::ks_ptr<PID> create(std::string_view name, const kc::ks_ptr<kd::StatePropagator> &sp, const kc::ks_ptr<kd::PhysicalSubhinge> &sh, std::function<km::Vec(const km::Ktime&)> q_traj, std::function<km::Vec(const km::Ktime&)> u_traj)#
Constructor. The PID model adds force to a subhinge. The model uses the incoming function as the desired trajectory. The output of this function should be the desired Q values of the subhinge.
- Parameters:
name – The name of the model.
sp – The StatePropagator to register this model with.
sh – The Subhinge to apply the forces calculated by the PID controller to.
q_traj – A function that defines the reference trajectory for Q.
u_traj – A function that defines the reference trajectory for U.
- Returns:
A ks_ptr to the newly created instance of the PID model.
-
PID(std::string_view name, const kc::ks_ptr<kd::StatePropagator> &sp, const kc::ks_ptr<kd::PhysicalSubhinge> &sh, std::function<km::Vec(const km::Ktime&)> q_traj, std::function<km::Vec(const km::Ktime&)> u_traj)#