35 static const double kDefaultOffsetTension = 0.001;
42 static const double kDefaultLengthStiffness = 0.0;
49 static const double kDefaultVelocityStiffness = 0.0;
52 _offsetTension(kDefaultOffsetTension),
53 _lengthStiffness(kDefaultLengthStiffness),
54 _velStiffness(kDefaultVelocityStiffness)
64 double lengthStiffness,
65 double velStiffness) :
66 _offsetTension(offsetTension),
67 _lengthStiffness(lengthStiffness),
68 _velStiffness(velStiffness)
71 assert(offsetTension >= 0.0);
72 assert(lengthStiffness >= 0.0);
73 assert(velStiffness >= 0.0);
93 static inline double determineVelocity(
double ds,
double dt)
95 return (dt > 0.0) ? (ds / dt) : 0.0;
110 static inline double determineSetTension(
double offset,
114 return std::max(static_cast<double>(0.0), offset + displacement + velocity);
119 double deltaTimeSeconds,
123 return controlTension( mString,
131 ImpedanceControl::controlTension(
tgBaseString*
const mString,
132 double deltaTimeSeconds,
134 double offsetTension,
138 assert(mString != NULL);
140 const double actualLength = mString->getCurrentLength();
141 const double vel = mString->getVelocity();
143 const double setTension =
144 determineSetTension(offsetTension,
148 mString->tensionMinLengthController(setTension,
152 assert(setTension >= 0.0);
160 assert(offsetTension >= 0.0);
172 assert(lengthStiffness >= 0.0);
184 assert(velStiffness >= 0.0);
193 bool ImpedanceControl::invariant()
const
Contains the definition of abstract base class tgBaseString. Assumes that the string is linear (F = -...
void setLengthStiffness(double lengthStiffness)
ImpedanceControl()
Constructors.
void setVelStiffness(double velStiffness)
double control(tgBaseString *const mString, double deltaTimeSeconds, double newPosition, double offsetVel=0)
Control Functions.
Contains the definition of class ImpedanceControl. $Id$.
void setOffsetTension(double offsetTension)