user33100: Sorry if this question been posted but I couldn't find the one that matches my issue. I couldn't pass my struct values from the main file to a class. Any ideas? I got this: 
error: no matching function for call to 'ODriveArduino::SetParam(R_motor_params&)'

Main.cpp:
#include ODriveArduino.h
ODriveArduino odrive(Serial1);

struct L_motor_params{
 int axis=1;
 float vel_Gain= 2.5f/10000.0f ;
 float pos_Gain= 40.0f;
 float vel_Int_Gain= 0.0f/10000.0f;
};
struct R_motor_params{
 int axis=0;
 float vel_Gain= 2.75f/10000.0f ;
 float pos_Gain= 40.0f;
 float vel_Int_Gain= 0.0f/10000.0f;
};

void setup() {
  struct R_motor_params M;
  odrive.SetParam(M);
}

ODriveArduino.h:
class ODriveArduino {

private:

    struct motor_Params{
      int axis;
      float vel_Gain;
      float pos_Gain;
      float vel_Int_Gain;
    };

public:
    ODriveArduino(Stream& serial);

    // Commands
    void SetParam(struct motor_Params M);

 }

ODriveArduino.cpp:
#include "ODriveArduino.h"
template<class T> inline Print& operator <<(Print &obj,     T arg) { obj.print(arg);    return obj; }
template<>        inline Print& operator <<(Print &obj, float arg) { obj.print(arg, 4); return obj; }

ODriveArduino::ODriveArduino(Stream& serial)
    : serial_(serial) {}

void ODriveArduino::SetParam(struct motor_Params M){
  Serial1 << "w axis" << M.axis << ".motor.config.pos_gain " << M.pos_Gain << '\n';
  Serial1 << "w axis" << M.axis << ".motor.config.vel_gain " << M.vel_Gain << '\n';
  Serial1 << "w axis" << M.axis << ".motor.config.vel_integrator_gain " << M.vel_Int_Gain << '\n';
}


user4143: It looks like you're trying to implement polymorphism without implementing polymorphism.
What you have done is create three completely independent structures and assumed that they will all work together just because they are the same size, with similar names, and fields named the same. That's not the case. They are all completely separate.
Instead you want just one structure but to use it multiple times to create different variables:
// from ODriveArduino.h, but move *outside* the class
struct motor_Params{
      int axis;
      float vel_Gain;
      float pos_Gain;
      float vel_Int_Gain;
};

// in your code
struct motor_Params left_params = { 
    1, 2.5f/10000.0f, 40.0f, 0.0f/10000.0f
};

struct motor_Params right_params = {
    0, 2.75f/10000.0f, 40.0f, 0.0f/10000.0f
};

// later
  odrive.SetParam(left_params);


33100: <p>Sorry if this question been posted but I couldn't find the one that matches my issue. I couldn't pass my struct values from the main file to a class. Any ideas? I got this: </p>

<pre><code>error: no matching function for call to 'ODriveArduino::SetParam(R_motor_params&amp;)'
</code></pre>

<p>Main.cpp:</p>

<pre><code>#include ODriveArduino.h
ODriveArduino odrive(Serial1);

struct L_motor_params{
 int axis=1;
 float vel_Gain= 2.5f/10000.0f ;
 float pos_Gain= 40.0f;
 float vel_Int_Gain= 0.0f/10000.0f;
};
struct R_motor_params{
 int axis=0;
 float vel_Gain= 2.75f/10000.0f ;
 float pos_Gain= 40.0f;
 float vel_Int_Gain= 0.0f/10000.0f;
};

void setup() {
  struct R_motor_params M;
  odrive.SetParam(M);
}
</code></pre>

<p>ODriveArduino.h:</p>

<pre><code>class ODriveArduino {

private:

    struct motor_Params{
      int axis;
      float vel_Gain;
      float pos_Gain;
      float vel_Int_Gain;
    };

public:
    ODriveArduino(Stream&amp; serial);

    // Commands
    void SetParam(struct motor_Params M);

 }
</code></pre>

<p>ODriveArduino.cpp:</p>

<pre><code>#include "ODriveArduino.h"
template&lt;class T&gt; inline Print&amp; operator &lt;&lt;(Print &amp;obj,     T arg) { obj.print(arg);    return obj; }
template&lt;&gt;        inline Print&amp; operator &lt;&lt;(Print &amp;obj, float arg) { obj.print(arg, 4); return obj; }

ODriveArduino::ODriveArduino(Stream&amp; serial)
    : serial_(serial) {}

void ODriveArduino::SetParam(struct motor_Params M){
  Serial1 &lt;&lt; "w axis" &lt;&lt; M.axis &lt;&lt; ".motor.config.pos_gain " &lt;&lt; M.pos_Gain &lt;&lt; '\n';
  Serial1 &lt;&lt; "w axis" &lt;&lt; M.axis &lt;&lt; ".motor.config.vel_gain " &lt;&lt; M.vel_Gain &lt;&lt; '\n';
  Serial1 &lt;&lt; "w axis" &lt;&lt; M.axis &lt;&lt; ".motor.config.vel_integrator_gain " &lt;&lt; M.vel_Int_Gain &lt;&lt; '\n';
}
</code></pre>
 4143: <p>It looks like you're trying to implement polymorphism without implementing polymorphism.</p>

<p>What you have done is create three completely independent structures and assumed that they will all work together just because they are the same size, with similar names, and fields named the same. That's not the case. They are all completely separate.</p>

<p>Instead you want just <em>one</em> structure but to use it multiple times to create different variables:</p>

<pre><code>// from ODriveArduino.h, but move *outside* the class
struct motor_Params{
      int axis;
      float vel_Gain;
      float pos_Gain;
      float vel_Int_Gain;
};

// in your code
struct motor_Params left_params = { 
    1, 2.5f/10000.0f, 40.0f, 0.0f/10000.0f
};

struct motor_Params right_params = {
    0, 2.75f/10000.0f, 40.0f, 0.0f/10000.0f
};

// later
  odrive.SetParam(left_params);
</code></pre>
