31 #include "boost/array.hpp"
32 #include "boost/numeric/odeint.hpp"
35 #include "LinearMath/btQuickprof.h"
42 using namespace boost::numeric::odeint;
44 typedef std::vector<double > cpgVars_type;
46 CPGEquationsFB::CPGEquationsFB(
int maxSteps) :
49 CPGEquationsFB::CPGEquationsFB(std::vector<CPGNode*>& newNodeList,
int maxSteps) :
54 CPGEquationsFB::~CPGEquationsFB()
59 int CPGEquationsFB::addNode(std::vector<double>& newParams)
61 int index = nodeList.size();
63 nodeList.push_back(newNode);
68 std::vector<double>& CPGEquationsFB::getXVars() {
70 BT_PROFILE(
"CPGEquationsFB:getXVars");
71 #endif //BT_NO_PROFILE
74 for (
int i = 0; i != nodeList.size(); i++){
75 CPGNodeFB* currentNode = tgCast::cast<CPGNode, CPGNodeFB>(nodeList[i]);
77 XVars.push_back(currentNode->phiValue);
78 XVars.push_back(currentNode->rValue);
79 XVars.push_back(currentNode->
omega);
85 std::vector<double>& CPGEquationsFB::getDXVars() {
87 BT_PROFILE(
"CPGEquationsFB:getDXVars");
88 #endif //BT_NO_PROFILE
91 for (
int i = 0; i != nodeList.size(); i++){
92 CPGNodeFB* currentNode = tgCast::cast<CPGNode, CPGNodeFB>(nodeList[i]);
93 DXVars.push_back(currentNode->phiDotValue);
94 DXVars.push_back(currentNode->rDotValue);
95 DXVars.push_back(currentNode->omegaDot);
101 void CPGEquationsFB::updateNodes(std::vector<double>& descCom)
103 #ifndef BT_NO_PROFILE
104 BT_PROFILE(
"CPGEquationsFB:updateNodes");
105 #endif //BT_NO_PROFILE
106 std::vector<double>::iterator comIt = descCom.begin();
108 assert(descCom.size() == nodeList.size() * 3);
110 for(
int i = 0; i != nodeList.size(); i++){
111 CPGNodeFB* currentNode = tgCast::cast<CPGNode, CPGNodeFB>(nodeList[i]);
112 std::vector<double> comGroup(comIt, comIt + 3);
119 void CPGEquationsFB::updateNodeData(std::vector<double> newXVals)
121 #ifndef BT_NO_PROFILE
122 BT_PROFILE(
"CPGEquationsFB::updateNodeData");
123 #endif //BT_NO_PROFILE
124 assert(newXVals.size()==3*nodeList.size());
126 for(
int i = 0; i!=nodeList.size(); i++){
127 CPGNodeFB* currentNode = tgCast::cast<CPGNode, CPGNodeFB>(nodeList[i]);
128 currentNode->updateNodeValues(newXVals[3*i], newXVals[3*i+1], newXVals[3*i+2]);
Utility class for class casting and filtering collections by type.
virtual void updateDTs(const std::vector< double > &feedback)
Definition of class CPGEquationsFB.