Class ComputedTorque#

Inheritance Relationships#

Base Type#

Class Documentation#

class ComputedTorque : public Karana::Models::KModel<ComputedTorque>#

Limits the generalized force that can be applied to a subhinge.

Public Functions

ComputedTorque(std::string_view name, const kc::ks_ptr<kd::ModelManager> &mm, const kc::ks_ptr<kd::SubTree> &st, const SetAccelFn &set_accels_fn)#

ComputedTorque constructor. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance.

The user-supplied set_accels_fn should set the accelerations on the provided SubGraph. Then, the model uses Algorithms.evalComputedTorque to calculate the corresponding torques and apply them to the SubTree.

Parameters:
  • name – The name of the model.

  • mm – The ModelManager to register this model with.

  • st – The SubTree to apply the torques to.

  • set_accels_fn – The function that sets the accelerations for the computed torque to compute torques for.

void preDeriv(const km::Ktime &t, const km::Vec &x)#

Calculate and apply the torques.

Parameters:
  • t – Current time. This is passed to the user-supplied set_accels_fn.

  • x – Current state. This is passed to the user-supplied set_accels_fn.

~ComputedTorque()#

Destructor for ComputedTorque.

Public Static Functions

static kc::ks_ptr<ComputedTorque> create(std::string_view name, const kc::ks_ptr<kd::ModelManager> &mm, const kc::ks_ptr<kd::SubTree> &st, const SetAccelFn &set_accels_fn)#

Constructor.

The user-supplied set_accels_fn should set the accelerations on the provided SubGraph. Then, the model uses Algorithms.evalComputedTorque to calculate the corresponding torques and apply them to the SubTree.

Parameters:
  • name – The name of the model.

  • mm – The ModelManager to register this model with.

  • st – The SubTree to apply the torques to.

  • set_accels_fn – The function that sets the accelerations for the computed torque to compute torques for.

Returns:

A ks_ptr to the newly created instance of the ComputedTorque model.