I know using #include <stlport.h>
and #include <Eigen30.h>
to make Eigen work with Arduino is a pretty old way to get working Eigen.
Hence I tried also #include <ArduinoSTL.h>
with two Eigen Arduino libs that I found out there(#include <Eigen30.h>
and #include <Eigen.h>
). I´ll leave here the links to the GitHub repos of all the libraries.
#include <Eigen.h>
: https://github.com/bolderflight/Eigen
#include <Eigen30.h>
: https://github.com/vancegroup/EigenArduino/tree/Eigen30
#include <stlport.h>
: https://github.com/vancegroup/stlport-avr/tree/STLport-5.2-arduino-installed
#include <ArduinoSTL.h>
: https://github.com/mike-matera/ArduinoSTL
Only #include <stlport.h>
and #include <Eigen30.h>
actually compiled in Arduino's IDE. I'm Actually version 1.6.20
of the AVR Boards package that we can modify in Tools Board Board Manager.
When I started doing some basic operations to test Eigen, like adding matrices and Initializing matrices. Then I noticed that whenever I multiplied 2 matrices no matter the method I used (I tried every method that the documentation of Eigen suggested as best practices) the program got stuck in that specific instruction.
Here is an example:
#include <stlport.h>
#include <Eigen30.h>
#include <Eigen/Dense>
using namespace Eigen;
void setup()
{
Serial.begin(9600);
delay(2000);
Serial.print("Hi");
Matrix3f m;
MatrixXf b(2,2);
MatrixXf M1(2,2); //EDIT: I missed this last time.
MatrixXf matA(2, 2);
m << 1, 2, 3,
4, 5, 6,
7, 8, 9;
matA << 1, 2,
1, 2;
b = matA;
print_mtxf(b); // Goes ok
print_mtxf(matA); // Goes ok
Serial.print("M1:\n"); // Goes ok
M1.noalias() = matA*b; // Something wrong is going on here.
print_mtxf(M1); // Nerver gets to print this or the following
Serial.print("M1:\n");
Serial.print("M1:\n");
}
void loop()
{
}
void print_mtxf(const Eigen::MatrixXf &X)
{
int i, j, nrow, ncol;
nrow = X.rows();
ncol = X.cols();
Serial.print("nrow: "); Serial.println(nrow);
Serial.print("ncol: "); Serial.println(ncol);
Serial.println();
for (i=0; i<nrow; i++)
{
for (j=0; j<ncol; j++)
{
Serial.print(X(i,j), 6); // print 6 decimal places
Serial.print(", ");
}
Serial.println();
}
Serial.println();
}
So now what are my options? I really want to get working Eigen because I'm going to use a basic c++ library that depends just in Eigen, it's pretty basic but Eigen hasn't worked properly. I think it gest to an infinite loop because the proceeding prints never get completed.