Skip to content

Commit a52f675

Browse files
author
NoelieRamuzat
committed
[Pyrene_Actuator] Change gains and update error cout
1 parent 1f065d6 commit a52f675

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

examples/pyrene_actuator/mainBags.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ using namespace Eigen;
1515

1616

1717
vector<double> fillVector(string repoBags, string fileName){
18-
vector<double> fillVector(1000);
18+
vector<double> fillVector(2000);
1919
ifstream file((repoBags + fileName).c_str(),ios::in);
2020
if (!file){
2121
cerr << "File " << fileName.c_str() << " not Read"<< endl;
2222
}
2323

2424
double val;
25-
for (int j=0; j<1000; j++) {
25+
for (int j=0; j<2000; j++) {
2626
string line;
2727
getline(file, line);
2828
stringstream ss(line);
@@ -61,24 +61,26 @@ int main (int argc, char *argv[])
6161
costFunction.setTauLimit(70);
6262
costFunction.setJointLimit(0.0, -2.35619449019);
6363
costFunction.setJointVelLimit(30.0, -30.0);
64-
CostFunction<double,2,1>::stateMat_t Q;
65-
Q << 100.0,0.0,0.0,0.01;
66-
costFunction.setCostGainState(Q);
67-
// PyreneActuator.setLoadMass(20.0);
64+
// CostFunction<double,2,1>::stateMat_t Q;
65+
// Q << 500.0,0.0,0.0,0.01;
66+
// CostFunction<double,2,1>::commandMat_t P;
67+
// P << 100.0;
68+
// costFunction.setCostGainState(Q);
69+
// costFunction.setCostGainTorqueConstraint(P);
70+
// PyreneActuator.setLoadParam(30.0,-0.021481595, 0.10);
6871
DDPSolver<double,2,1> testSolverActuator(PyreneActuator,costFunction,DISABLE_FULLDDP,DISABLE_QPBOX);
6972

7073
double dx_joint;
7174
dx_joint = 0.5422;
7275
xinit << vec_joint_pos[0],
7376
dx_joint;
74-
75-
unsigned int nbIterTestMax=1000.0;
77+
xDes << vec_joint_pos[1], 0.0;
78+
unsigned int nbIterTestMax=2000.0;
7679
unsigned int iter;
7780
testSolverActuator.FirstInitSolver(xinit,xDes,T,dt,iterMax,stopCrit);
7881

7982
for (int i=0; i<nbIterTestMax-1; i++) {
8083

81-
xDes << vec_joint_pos[i+1], 0.0;
8284
gettimeofday(&tbegin,NULL);
8385

8486
testSolverActuator.initSolver(xinit,xDes);
@@ -91,6 +93,7 @@ int main (int argc, char *argv[])
9193

9294
xinit << xList[1](0,0),
9395
xList[1](1,0);
96+
xDes << vec_joint_pos[i+1], 0.0;
9497

9598

9699
texec+=((double)(tend.tv_sec-tbegin.tv_sec)*1000.0+((tend.tv_usec-tbegin.tv_usec)/1000.0));

examples/pyrene_actuator/pyreneCostFunction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ const double CostFunctionPyreneActuator::offset_m = 0.5572;
1010

1111
CostFunctionPyreneActuator::CostFunctionPyreneActuator()
1212
{
13-
Q << 10.0, 0.0,
13+
Q << 500.0, 0.0,
1414
0.0, 0.01;
1515
W << 1.0, 0.0,
1616
0.0, 0.01;
1717
R << 0.0001;
18-
P << 1.0;
18+
P << 100.0;
1919

2020
lxx = Q;
2121
luu = R;

include/ddp-actuator-solver/ddpsolver.hh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#include <Eigen/StdVector>
99
#include <qpOASES.hpp>
1010
#include <qpOASES/QProblemB.hpp>
11+
#include <time.h>
12+
#include <sys/time.h>
13+
#include <iostream>
1114

1215
#define ENABLE_QPBOX 1
1316
#define DISABLE_QPBOX 0
@@ -359,6 +362,15 @@ class DDPSolver
359362
if (lltofQuu.info() == Eigen::NumericalIssue)
360363
{
361364
std::cout << "not sdp" << std::endl;
365+
std::cout << "#############################" << std::endl;
366+
std::cout << "Quu_reg : " << Quu_reg << std::endl;
367+
std::cout << "lxx : " << costFunction->getlxx() << std::endl;
368+
std::cout << "lu : " << costFunction->getlu() << std::endl;
369+
std::cout << "lx : " << costFunction->getlx() << std::endl;
370+
std::cout << "luu" << costFunction->getluu() << std::endl;
371+
std::cout << "updateduList[0] : " << updateduList[0] << std::endl;
372+
std::cout << "updatedxList[0] : " << updatedxList[0] << std::endl;
373+
std::cout << "#############################" << std::endl;
362374
return false;
363375
}
364376
return true;

0 commit comments

Comments
 (0)