I am using the Arduino odrive library to command my motor and read data (position and velocity) from 2 different motors. And then data is printed on serial. However, when I print the data, the serial data gets mixed up. Sometimes position shows up in velocity, sometimes left motor position in the right and vice versa. Sometimes there is no problem with the same code.
motor_pos_left = odrive.GetPosition(motor_left);
motor_pos_right = odrive.GetPosition(motor_right);
motor_vel_left = odrive.GetVelocity(motor_left);
motor_vel_right = odrive.GetVelocity(motor_right);
Can anyone help with this issue?