28 #include "T12SuperBallPayloadController.h"
43 this->m_initialLengths=initialLength;
44 this->m_totalTime=0.0;
50 const std::vector<tgBasicActuator*> muscles = subject.
getAllMuscles();
51 for (
size_t i = 0; i < muscles.size(); ++i)
54 assert(pMuscle != NULL);
63 throw std::invalid_argument(
"dt is not positive");
68 const std::vector<tgBasicActuator*> muscles = subject.
getAllMuscles();
69 for (
size_t i = 0; i < muscles.size(); ++i)
72 assert(pMuscle != NULL);
77 vector< vector<double> > actions;
90 actions.push_back(tmp);
94 actions = transformActions(actions);
102 vector< vector <double> > SuperBallPrefLengthController::transformActions(vector< vector <double> > actions)
106 double range=max-min;
108 for(
int i=0;i<actions.size();i++)
110 for(
int j=0;j<actions[i].size();j++)
112 scaledAct=actions[i][j]*(range)+min;
113 actions[i][j]=scaledAct;
120 void SuperBallPrefLengthController::applyActions(
T12SuperBallPayload& subject, vector< vector <double> > act)
123 const std::vector<tgBasicActuator*> muscles = subject.
getAllMuscles();
125 if(act.size() != muscles.size())
127 cout<<
"Warning: # of muscles: "<< muscles.size() <<
" != # of actions: "<< act.size()<<endl;
131 for (
size_t i = 0; i < muscles.size(); ++i)
134 assert(pMuscle != NULL);
Contains the definition of class T12SuperBallPayload. $Id$.
virtual void moveMotors(double dt)
virtual void setControlInput(double input)
SuperBallPrefLengthController(const double prefLength=5)
Contains the definition of class tgBasicActuator.
virtual void onSetup(SuperBallModel &subject)
const std::vector< tgBasicActuator * > & getAllMuscles() const
virtual void onStep(SuperBallModel &subject, double dt)