Cheetah Software  1.0
ActuatorModel< T > Class Template Reference

#include <ActuatorModel.h>

+ Collaboration diagram for ActuatorModel< T >:

Public Member Functions

 ActuatorModel (T gearRatio, T motorKT, T motorR, T batteryV, T damping, T dryFriction, T tauMax)
 
 ActuatorModel ()
 
getTorque (T tauDes, T qd)
 
void setFriction (bool enabled)
 

Private Attributes

_gr
 
_kt
 
_R
 
_V
 
_damping
 
_dryFriction
 
_tauMax
 
bool _frictionEnabled = true
 

Detailed Description

template<typename T>
class ActuatorModel< T >

Definition at line 16 of file ActuatorModel.h.

Constructor & Destructor Documentation

template<typename T >
ActuatorModel< T >::ActuatorModel ( gearRatio,
motorKT,
motorR,
batteryV,
damping,
dryFriction,
tauMax 
)
inline

Definition at line 18 of file ActuatorModel.h.

20  : _gr(gearRatio),
21  _kt(motorKT),
22  _R(motorR),
23  _V(batteryV),
24  _damping(damping),
25  _dryFriction(dryFriction),
26  _tauMax(tauMax) {}
template<typename T >
ActuatorModel< T >::ActuatorModel ( )
inline

Definition at line 28 of file ActuatorModel.h.

28 {}

Member Function Documentation

template<typename T >
T ActuatorModel< T >::getTorque ( tauDes,
qd 
)
inline

Definition at line 33 of file ActuatorModel.h.

References ActuatorModel< T >::_damping, ActuatorModel< T >::_dryFriction, ActuatorModel< T >::_frictionEnabled, ActuatorModel< T >::_gr, ActuatorModel< T >::_kt, ActuatorModel< T >::_R, ActuatorModel< T >::_tauMax, ActuatorModel< T >::_V, coerce(), and sgn().

33  {
34  // compute motor torque
35  T tauDesMotor = tauDes / _gr; // motor torque
36  T iDes = tauDesMotor / (_kt * 1.5); // i = tau / KT
37  // T bemf = qd * _gr * _kt * 1.732; // back emf
38  T bemf = qd * _gr * _kt * 2.; // back emf
39  T vDes = iDes * _R + bemf; // v = I*R + emf
40  T vActual = coerce(vDes, -_V, _V); // limit to battery voltage
41  T tauActMotor =
42  1.5 * _kt * (vActual - bemf) / _R; // tau = Kt * I = Kt * V / R
43  T tauAct = _gr * coerce(tauActMotor, -_tauMax, _tauMax);
44 
45  // add damping and dry friction
46  if (_frictionEnabled)
47  tauAct = tauAct - _damping * qd - _dryFriction * sgn(qd);
48 
49  return tauAct;
50  }
bool _frictionEnabled
Definition: ActuatorModel.h:56
T coerce(T in, T min, T max)
Definition: utilities.h:35
int sgn(T val)
Definition: utilities.h:65

+ Here is the call graph for this function:

template<typename T >
void ActuatorModel< T >::setFriction ( bool  enabled)
inline

Definition at line 52 of file ActuatorModel.h.

References ActuatorModel< T >::_frictionEnabled.

52 { _frictionEnabled = enabled; }
bool _frictionEnabled
Definition: ActuatorModel.h:56

Member Data Documentation

template<typename T >
T ActuatorModel< T >::_damping
private

Definition at line 55 of file ActuatorModel.h.

template<typename T >
T ActuatorModel< T >::_dryFriction
private

Definition at line 55 of file ActuatorModel.h.

template<typename T >
bool ActuatorModel< T >::_frictionEnabled = true
private

Definition at line 56 of file ActuatorModel.h.

template<typename T >
T ActuatorModel< T >::_gr
private

Definition at line 55 of file ActuatorModel.h.

template<typename T >
T ActuatorModel< T >::_kt
private

Definition at line 55 of file ActuatorModel.h.

template<typename T >
T ActuatorModel< T >::_R
private

Definition at line 55 of file ActuatorModel.h.

template<typename T >
T ActuatorModel< T >::_tauMax
private

Definition at line 55 of file ActuatorModel.h.

template<typename T >
T ActuatorModel< T >::_V
private

Definition at line 55 of file ActuatorModel.h.


The documentation for this class was generated from the following file: