28 #include "VerticalSpineRestLengthController.h"
52 const std::vector<tgBasicActuator*> muscles = subject.
getAllMuscles();
55 const std::vector<tgBasicActuator*> v_musclesA = subject.
getMuscles(
"vertical a");
56 const std::vector<tgBasicActuator*> v_musclesB = subject.
getMuscles(
"vertical b");
57 const std::vector<tgBasicActuator*> v_musclesC = subject.
getMuscles(
"vertical c");
58 const std::vector<tgBasicActuator*> v_musclesD = subject.
getMuscles(
"vertical d");
61 const std::vector<tgBasicActuator*> s_muscles0 = subject.
getMuscles(
tgString(
"saddle", 0));
62 const std::vector<tgBasicActuator*> s_muscles1 = subject.
getMuscles(
tgString(
"saddle", 1));
63 const std::vector<tgBasicActuator*> s_muscles2 = subject.
getMuscles(
tgString(
"saddle", 2));
64 const std::vector<tgBasicActuator*> s_muscles3 = subject.
getMuscles(
tgString(
"saddle", 3));
67 for (
size_t i = 0; i < v_musclesA.size(); ++ i)
71 assert(pMuscleA != NULL);
72 pMuscleA->setRestLengthSingleStep(verticalRL);
76 assert(pMuscleB != NULL);
77 pMuscleB->setRestLengthSingleStep(verticalRL);
81 assert(pMuscleC != NULL);
82 pMuscleC->setRestLengthSingleStep(verticalRL);
86 assert(pMuscleD != NULL);
87 pMuscleD->setRestLengthSingleStep(verticalRL);
92 for (
size_t i = 0; i < s_muscles0.size(); ++i)
97 assert(pMuscle1 != NULL);
98 pMuscle1->setRestLengthSingleStep(saddleRL1);
102 assert(pMuscle2 != NULL);
103 pMuscle2->setRestLengthSingleStep(saddleRL2);
107 assert(pMuscle3 != NULL);
108 pMuscle3->setRestLengthSingleStep(saddleRL3);
112 assert(pMuscle4 != NULL);
113 pMuscle4->setRestLengthSingleStep(saddleRL4);
220 throw std::invalid_argument(
"dt is not positive");
226 const std::vector<tgBasicActuator*> muscles = subject.
getAllMuscles();
229 const std::vector<tgBasicActuator*> v_musclesA = subject.
getMuscles(
"vertical a");
230 const std::vector<tgBasicActuator*> v_musclesB = subject.
getMuscles(
"vertical b");
231 const std::vector<tgBasicActuator*> v_musclesC = subject.
getMuscles(
"vertical c");
232 const std::vector<tgBasicActuator*> v_musclesD = subject.
getMuscles(
"vertical d");
235 const std::vector<tgBasicActuator*> s_muscles0 = subject.
getMuscles(
tgString(
"saddle", 0));
236 const std::vector<tgBasicActuator*> s_muscles1 = subject.
getMuscles(
tgString(
"saddle", 1));
237 const std::vector<tgBasicActuator*> s_muscles2 = subject.
getMuscles(
tgString(
"saddle", 2));
238 const std::vector<tgBasicActuator*> s_muscles3 = subject.
getMuscles(
tgString(
"saddle", 3));
241 for (
size_t i = 0; i < v_musclesA.size(); ++ i)
245 assert(pMuscleA != NULL);
246 pMuscleA->setRestLengthSingleStep(verticalRL);
250 assert(pMuscleB != NULL);
251 pMuscleB->setRestLengthSingleStep(verticalRL);
255 assert(pMuscleC != NULL);
256 pMuscleC->setRestLengthSingleStep(verticalRL);
260 assert(pMuscleD != NULL);
261 pMuscleD->setRestLengthSingleStep(verticalRL);
266 for (
size_t i = 0; i < s_muscles0.size(); ++i)
271 assert(pMuscle1 != NULL);
272 pMuscle1->setRestLengthSingleStep(saddleRL1);
276 assert(pMuscle2 != NULL);
277 pMuscle2->setRestLengthSingleStep(saddleRL2);
281 assert(pMuscle3 != NULL);
282 pMuscle3->setRestLengthSingleStep(saddleRL3);
286 assert(pMuscle4 != NULL);
287 pMuscle4->setRestLengthSingleStep(saddleRL4);
const std::vector< tgSpringCableActuator * > & getMuscles(const std::string &key) const
virtual void onSetup(VerticalSpineModel &subject)
Convenience function for combining strings with ints, mostly for naming structures.
Contains the definition of class VerticalSpineModel.
VerticalSpineRestLengthController()
Contains the definition of class tgBasicActuator.
std::string tgString(std::string s, int i)
virtual void onStep(VerticalSpineModel &subject, double dt)
const std::vector< tgSpringCableActuator * > & getAllMuscles() const