Dear all,
I'm trying to use the Levenberg Marquardt algorithm. If I compile, I get the error "invalid use of non-static member" in the line "minlmoptimize(state, problemMeasurementEquipmentPositon);". First thought, no problem, I make the method problemMeasurementEquipmentPositon(...) static. This would work, if the called methods within this method would be static too, but they aren't. I have never had such a problem and I don't know how to solve it. I would be very grateful if somebody could help. Thanks.
Code:
void RobotProblemSolver::solveMeasurementEquipment(){
int equations=para.getNumberOfMeasurements()*3;
real_1d_array x = "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]";
real_1d_array bndl = "[-1,-1,-1,-10,-1,-1,-1,-10,-1,-1,-1,-10,-0.1,-0.1,-0.1]";
real_1d_array bndu = "[+1,+1,+1,+10,+1,+1,+1,+10,+1,+1,+1,+10,+0.1,+0.1,+0.1]";
double epsx = 0.0000000001;
ae_int_t maxits = 0;
minlmstate state;
minlmreport rep;
minlmcreatev(equations, x, 0.0001, state);
minlmsetbc(state, bndl, bndu);
minlmsetcond(state, epsx, maxits);
minlmoptimize(state, problemMeasurementEquipmentPositon);
minlmresults(state, x, rep);
Transformation t(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],0,0,0,1);
std::cout << t.toString() << std::endl;
std::cout << "Tool: "<<x[12]<<" "<<x[13]<<" "<<x[14]<<std::endl;
}
void RobotProblemSolver::problemMeasurementEquipmentPositon(const real_1d_array &x, real_1d_array &fi, void *ptr){
double phi[6];
double coordinates[3];
Transformation pose;
Transformation toolTrans(1,0,0,x[12],
0,1,0,x[13],
0,0,1,x[14],
0,0,0,1);
Tool tool(toolTrans);
for(int i=0; i<para.getNumberOfMeasurements(); i++){
para.getMeasure(i,phi,coordinates);
robotModel.directKinematics(phi,tool,pose);
fi[i*3+0]=coordinates[0]*x[0]+coordinates[1]*x[1]+coordinates[2]*x[2]+x[3]-pose[3];
fi[i*3+1]=coordinates[0]*x[4]+coordinates[1]*x[5]+coordinates[2]*x[6]+x[7]-pose[7];
fi[i*3+2]=coordinates[0]*x[8]+coordinates[1]*x[9]+coordinates[2]*x[10]+x[11]-pose[11];
}
}