I found the following one by jarredbarber : https://github.com/jarredbarber/eigen-QP
For some reason, I'm not being able to use the QP library in my nodemcu. Here is one very simple demonstration I've been trying to establish. But it throws away some errors, I can't figure why :
In my sketch for the NodeMCU
#include <Arduino.h>
#include <EEPROM.h>
#include <Wire.h>
#include <iostream>
//#include<ctime> //srand()
#include<cstdlib>
#define _USE_MATH_DEFINES
#include <cmath> // for using M_PI, Trig. functions (sin/cos/tan)
using namespace std;
//#include <ArduinoSTL.h>
#include "Eigen313.h"
using namespace Eigen;
#include "eigen-qp.hpp"
using namespace EigenQP;
//#define PI 3.1416
void setup() {
// put your setup code here, to run once:
Serial.println("Lets start!!");
int N=4;
float gamma =10000;
float safety_radius=0.1200;
Eigen::Matrix<float,Dynamic,Dynamic> Q(2*N,2*N); Q.setIdentity();
cout<<Q<<endl;
Eigen::Matrix<float,Dynamic,1> c(2*N,1);
c<<0,
0,
0.0086,
0.0847,
-0.1499,
0.0687,
0.0083,
-0.0867;
Eigen::Matrix<float,Dynamic,Dynamic> A(6,2*N);
A<<0.0655,0.6483,-0.0655,-0.6483,0,0,0,0,
-0.5839,0.6251,0,0,0.5839,-0.6251,0,0,
-0.5587,-0.0275,0,0,0,0,0.5587,0.0275,
0,0,-0.6494,-0.0232,0.6494,0.0232,0,0,
0,0,-0.6242,-0.6758,0,0,0.6242,0.6758,
0,0,0,0,0.0252,-0.6526,-0.0252,0.6526;
std::cout<<"A:\n"<<A<<endl;
Eigen::Matrix<float,Dynamic,1> b(6,1);
b <<7.7197,
47.8600,
2.6007,
7.5770,
76.6646,
7.8461;
A=-A;
b=-b;
Eigen::Matrix<float,Dynamic,1> x(2*N,1);
yield();
delay(2000);
//boost::timer::auto_cpu_timer t;
//for (int ii=0; ii < 8; ii++)
//QPIneqSolver::solve(&H,&f,&A,&b,&x);
EigenQP::quadprog<float,Dynamic,Dynamic>(Q,c,A,b,x);
std::cout<<x<<endl;
}
void loop() {
// put your main code here, to run repeatedly:
yield();
}
It compiles fine, but in the serial monitor, these show up :
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld
I tried to run the same code in codeblocks software in my computer, it works fine though.
PS: This is the first time I've ever posted any topic in this forum, please inform me if I've violated any guideline for the post..
Thanks in advance.