19 #include "tgSineStringControl.h"
30 const double amplitude,
31 const double frequency,
34 const double length) :
37 m_controlStep(controlStep),
38 m_commandedTension(0.0),
39 cpgAmplitude(amplitude),
40 cpgFrequency(frequency),
45 m_controlLength(length),
46 m_pMotorControl(p_ipc)
48 if (m_controlStep < 0.0)
50 throw std::invalid_argument(
"Negative control step");
58 tgSineStringControl::~tgSineStringControl()
70 tgBasicActuator& m_sca = *(tgCast::cast<tgSpringCableActuator, tgBasicActuator>(subject));
73 if (m_controlTime >= m_controlStep)
76 cycle = cos(m_totalTime * 2.0 * M_PI * cpgFrequency + phaseOffset);
77 target = cycle*cpgAmplitude + offsetSpeed;
79 if (phaseOffset == 0.0 && m_totalTime < 4.0)
84 m_commandedTension = m_pMotorControl->
control(m_sca, m_controlTime, m_controlLength, target);
Contains the definition of class ImpedanceControl. $Id$.
virtual void onStep(tgSpringCableActuator &subject, double dt)
Contains the definition of class tgBasicActuator.
tgSineStringControl(const double controlStep, tgImpedanceController *p_ipc, const double amplitude, const double frequency, const double phase, const double offset, const double length)
double control(tgBasicController &mLocalController, double deltaTimeSeconds, double newPosition, double offsetVel=0)
Control Functions.