53 phaseOffsets.push_back(M_PI/2);
54 phaseOffsets.push_back(0);
55 phaseOffsets.push_back(0);
61 delete out_controller;
66 for(std::size_t i = 0; i < stringList.size(); i++)
68 double setTension = in_controller->
control(*(stringList[i]),
72 #if (0) // Conditional compile for verbose control
73 std::cout <<
"Inside String " << i <<
" tension " << setTension
74 <<
" act tension " << stringList[i]->getMuscle()->getTension()
75 <<
" length " << stringList[i]->getMuscle()->getActualLength() << std::endl;
84 for(std::size_t i = 0; i < stringList.size(); i++)
86 cycle = sin(simTime * cpgFrequency + 2 * bodyWaves * M_PI * i / (segments) + phaseOffsets[phase]);
87 target = offsetSpeed + cycle*cpgAmplitude;
89 double setTension = out_controller->
control(*(stringList[i]),
94 #if(0) // Conditional compile for verbose control
95 std::cout <<
"Outside String " << i <<
" com tension " << setTension
96 <<
" act tension " << stringList[i]->getMuscle()->getTension()
97 <<
" length " << stringList[i]->getMuscle()->getActualLength() << std::endl;
106 segments = subject.getSegments();
Contains the definition of class ImpedanceControl. $Id$.
NestedStructureSineWaves()
Contains the definition of class NestedStructureTestModel.
void applyImpedanceControlOutside(const std::vector< tgBasicActuator * > stringList, double dt, std::size_t phase)
~NestedStructureSineWaves()
Contains the definition of class tgBasicActuator.
Contains the definition of class NestedStructureSineWaves.
void applyImpedanceControlInside(const std::vector< tgBasicActuator * > stringList, double dt)
virtual void onStep(NestedStructureTestModel &subject, double dt)
const std::vector< tgBasicActuator * > & getActuators(const std::string &key) const
Contains the definition of class tgUtil and overloaded operator<<() free functions.
double control(tgBasicController &mLocalController, double deltaTimeSeconds, double newPosition, double offsetVel=0)
Control Functions.