Compilation error libraries


Hi, i have this error when i try to compile my project. I think it is a problem with the basicLinearAlgebra library but i don't understand why i get this error as the library is in my documents and it seems it refereces to the right library...

#ifndef SE_SF_H
#define SE_SF_H

//#include <BasicLinearAlgebra.h>
#include <BasicLinearAlgebra.h>
#include "mecotron.h" // Include MECOTRON header

void PredictionUpdate(const Matrix<1> &u, Matrix<1> &xhat);
void CorrectionUpdate(const Matrix<1> &y, Matrix<1> &xhat, Matrix<1> &nu);

#endif // SE_SF_H

Post a complete sketch.

Did you slavishly follow any examples to see how the library works (and that it does indeed work) before you attempted your own sketch?

I don't recognize the syntax, but the example I found included

// All the functions in BasicLinearAlgebra are wrapped up inside the namespace BLA, so specify that we're using it like
// so:
using namespace BLA;

which seems to be key.

When you share code or error messages, text is preferred to screen shots. Put it within code tags, one way is to use the <CODE/> button in the message composition window toolbar and do as it says

type or paste code here

HTH

a7

Welcome to the forum

Please do not post pictures of code

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

Please post your sketch, using code tags when you do
Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

Please also post the full error message, again using code tags. As you will have see, the IDE has a button that will allow the full error message to be posted

#include "state_estimator.h"

void PredictionUpdate(const Matrix<1> &u, Matrix<1> &xhat) {
  // UNCOMMENT AND COMPLETE LINES BELOW TO IMPLEMENT PredictionUpdate OF THE STATE ESTIMATOR

  float Ts = 0.01;
  float rw = 0.032;

  // // System A&B-matrix
  float arrayA[1][1]{{ 1 }}; //Provide here the element values of state-space matrix A
  Matrix<1,1> A = arrayA;
  float arrayB[1][1]{{ Ts*rw }}; //Provide here the element values of state-space matrix B
  Matrix<1,1> B = arrayB;
  
  // // Evaluate discrete-time system dynamics
  xhat = A*xhat + B*u;
  
}

void CorrectionUpdate(const Matrix<1> &y, Matrix<1> &xhat, Matrix<1> &nu) {
  // UNCOMMENT AND COMPLETE LINES BELOW TO IMPLEMENT CorrectionUpdate OF THE STATE ESTIMATOR
 
  // // System C-matrix - measurement equation
  float arrayC[1][1]{{ -1 }}; //Provide here the element values of state-space matrix C
  // Matrix<1,1> C = arrayC;
  
  // // Compute innovation
  nu = y - C*xhat;
    
  // // Set estimator gain
  Matrix<1,1> L = -0.618;
  
  // // Compute corrected system state estimate
  xhat += L * nu;
}

#ifndef SE_SF_H
#define SE_SF_H

#include <BasicLinearAlgebra.h>
#include "mecotron.h" // Include MECOTRON header



void PredictionUpdate(const Matrix<1> &u, Matrix<1> &xhat);
void CorrectionUpdate(const Matrix<1> &y, Matrix<1> &xhat, Matrix<1> &nu);

#endif // SE_SF_H

This is the entire sketck. we got it from our professor so i presume the second part should be workign that's why i didn't add the BLA line,which i saw online too. The first part (.cpp part ) i wrote some lines but not that much. We had to add some results but not much. When i add the BLA line it gives me an error in the Matrix<1,1> = arrayA part

It isn't a complete sketch. Where is the setup() function? Where is the loop() function?

Or if you are doing without, where is your main() function?

Any use of the library will require using the namespace it relies on.

Examine the example I linked. Try it out.

a7

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.