Git Product home page Git Product logo

minimu-9-ahrs-arduino's Introduction

Pololu MinIMU-9 + Arduino AHRS (Attitude and Heading Reference System)

Version: 1.3.0
Release Date: 2016-04-27
www.pololu.com

Summary

This is a program (sketch) for the Arduino that interfaces with the Pololu MinIMU-9 inertial measurement units:

It also works with the Pololu AltIMU-10 boards, although the output from the barometer is not used:

This Arduino program processes the raw rotation, acceleration, and magnetic data from the MinIMU-9 to derive an estimate of the board’s absolute orientation, which it outputs through the Arduino’s serial interface, turning the MinIMU-9 and Arduino into an attitude and heading reference system (AHRS).

A Python test program is also included. It communicates with the Arduino serially and displays a 3D representation of the MinIMU-9 board, allowing you to visualize the output of the AHRS in real time.

Both the Arduino software and Python test program are based on sf9domahrs by Doug Weibel and Jose Julio, which is in turn based on ArduIMU v1.5 by Jordi Munoz, William Premerlani, Jose Julio, and Doug Weibel.

Getting Started

Software

The Arduino program uses Pololu’s Arduino libraries for the sensors on the IMU board, which can also be downloaded from GitHub. Follow the instructions on their respective pages to install the libraries.

The Python test program also has several dependencies you must install before you can run it:

After you have set up the prerequisites, download the archive from GitHub and decompress it.

Hardware

Make the following connections with wires between the Arduino and the MinIMU-9:

5V Arduino boards

(including Arduino Uno, Leonardo, Mega; Pololu A-Star 32U4)

Arduino   IMU
-------   ---
     5V - VIN
    GND - GND
    SDA - SDA
    SCL - SCL

3.3V Arduino boards

(including Arduino Due)

Arduino   IMU
-------   ---
    3V3 - VIN
    GND - GND
    SDA - SDA
    SCL - SCL

Using the AHRS

From the Arduino environment, open MinIMU9AHRS.ino, which can be found in the MinIMU9AHRS folder.

The Arduino program is set up for a v4 or earlier IMU by default. If you are using a MinIMU or AltIMU v5, uncomment the line that says //#define IMU_V5 at the beginning of MinIMU9AHRS.ino.

By default, the Arduino code treats the positive X axis of the MinIMU-9 as forward and the negative Z axis as up (so that the components are on the bottom of the board and the silkscreen is on top). If you want the positive Z axis to be up instead (so that the components are on top), find the definition of SENSOR_SIGN[9] at the beginning of MinIMU9AHRS.ino and uncomment the appropriate line (after commenting the original).

To ensure that the heading derived from the compass is accurate, you should change the M_X_MIN through M_Z_MAX calibration constants to appropriate values. You can use the Calibrate example from the LIS3MDL library (v5) or LSM303 library (v4 or earlier) to find the right values for your board.

In the Tools menu, select the appropriate board and serial port. Click the “Upload” button to compile the sketch and load it onto your Arduino.

When the AHRS program first starts running, it takes some readings to establish a baseline orientation, during which it expects both the roll and the pitch of the sensors to be zero. Therefore, it is important to keep the MinIMU-9 level for a few seconds after powering on or resetting the Arduino or connecting to it from a computer.

After performing the startup routine, the program constantly takes readings from the gyro, accelerometer, and magnetometer on the MinIMU-9 and calculates an estimate of the board’s orientation. It outputs estimated roll, pitch, and yaw angles (in degrees) through the Arduino’s serial interface, and you can view the output with the Arduino Serial Monitor.

Example output:

!ANG:0.08,0.09,137.01
!ANG:0.14,0.11,137.04
!ANG:0.15,0.12,137.06

To visualize the output of the AHRS, you can run the Python test program (MinIMU-9-test.py) while the Arduino is connected to your computer. (You will probably have to edit the file first and change the definition of ser to match the COM port your Arduino is using.) You should be able to see three indicators showing the roll, pitch, and yaw angles being calculated by the AHRS, as well as a 3D representation of the MinIMU-9 board (the arrow indicates the positive X direction). You can watch these change in real time as you move the board around.

Version History

  • 1.3.0 (2016-04-27): Added support for MinIMU-9 v5 and AltIMU-10 v5. Added a check to help work around nan (not a number) problems caused by USB serial stalling the main loop.
  • 1.2.3 (2015-02-05): Updated to work with L3G library version 2.0.0.
  • 1.2.2 (2013-11-27): Updated to work with LSM303 library version 2.0.0.
  • 1.2.1 (2013-03-15): Fixed issue with properly enabling high-resolution mode on accelerometer.
  • 1.2.0 (2012-07-06): Added support for MinIMU-9 v2 (L3GD20 and LSM303DLHC); L3G4200D library dependency changed to L3G.
  • 1.1.0 (2011-11-15): Added support for LSM303DLM; LSM303DLH library dependency changed to LSM303.
  • 1.0.0 (2011-09-26): Original release.

minimu-9-ahrs-arduino's People

Contributors

davidegrayson avatar kevin-pololu avatar ryantm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minimu-9-ahrs-arduino's Issues

Regarding changing of DPS full scale

void Gyro_Init()
{
gyro.init();
gyro.enableDefault();
gyro.writeReg(L3G::CTRL_REG4, 0x20); // 2000 dps full scale
gyro.writeReg(L3G::CTRL_REG1, 0x0F); // normal power mode, all axes enabled, 100 Hz
}

Just wanted to check regarding the writing of registry. I wish to use a smaller dps full scale of 245. However I noticed a new registry written over CTRL_REG4 in Gyro_init which commented as 2000. Is it necessary for me to remove the current line with just the enable.default true? Thank you.

NaN output

I am trying to use the altIMU-10 V4 with this sketch and it starts off by giving me seemingly wrong values when it is stationary. When I took a look at the python GUI I saw that the yaw output was continuously spinning even when the IMU was stationary. When I moved the IMU, all the axis would start spinning and then give me a NaN output. I am using an Atmel 32U4 for testing. Could someone please point me in the right direction to figuring this out?

Arduino MEGA 2560 with AltIMU-10 v5

Hi, I'm currently using Arduino MEGA 2560 with AltIMU-10 v5 but it is currently nt showing me any output values in Arduino Serial Monitor. Any idea why?

No output from LSM303DLM

Hi, I connected my LSM303DLM to an Arduino Uno

5V -> VIN
GND -> GND
Analog Pin 5 -> SCL
Analog Pin 4 -> SDA
I have installed the LSM303 library and got the three basic programs to run with output to serial monitor, all looks good.
Then compiled and uploaded minimu-9.... Changed baud rate on Serial monitor to 115200. (plus added L3G library)
It prints: "Pololu MinIMU-9 + Arduino AHRS" on the Serial monitor, but nothing else.
Only LSM303DLM connected to Arduino. Is it waiting for anything else?

Product is:
http://www.hobbytronics.co.uk/lsm303dlh-tilt-compass?keyword=LSM303D&category_id=0

Max

Serial output?

I loaded the newest libraries and I downwloaded the newest minimu sketch for the Arduino. It runs the individual examples for the L3G and the LSM303 perfectly but then when I run the sketch everything is fine but the serial output likes like this:

(I am using an Uno R3 and pin connection is correct)
image

Compass drifts around quite a bit

I was having trouble with the compass reading drifting after I would stop turning it. I commented out the Drift_correction() call and now it seems to work fine.

I am not an expert on the math for this, so I don't know what the affect will be, just wanted to share with others that may be having the same problem.

Recive files, not drawing!

captura

Hi! I've installed everything and arduino UNO is sending data througth serial port correctly. I can see how the numbers on Python Shell moves but isn't drawing (those windows doesn't respond). What can i do?

'I2C_Init' was not declared in this scope

It seems that it's not using i2C.ino:

MinIMU9AHRS.ino: In function 'void setup()':
MinIMU9AHRS:158: error: 'I2C_Init' was not declared in this scope
MinIMU9AHRS:165: error: 'Accel_Init' was not declared in this scope
MinIMU9AHRS:166: error: 'Compass_Init' was not declared in this scope
MinIMU9AHRS:167: error: 'Gyro_Init' was not declared in this scope
MinIMU9AHRS:173: error: 'Read_Gyro' was not declared in this scope
MinIMU9AHRS:174: error: 'Read_Accel' was not declared in this scope
MinIMU9AHRS.ino: In function 'void loop()':
MinIMU9AHRS:211: error: 'Read_Gyro' was not declared in this scope
MinIMU9AHRS:212: error: 'Read_Accel' was not declared in this scope
MinIMU9AHRS:217: error: 'Read_Compass' was not declared in this scope

OSX compatibility

Hi
I'm trying to run this program on MAC. I found Vpython and pyserial libraries but pywin32 not support OSX. what should I do.
Thanks

minimu-9-ahrs-arduino displays nan as output

Hi i am working with the altIMU board to display attitude and heading information similar to that of an attitude indicator. I merged the 3 sensor program codes which i obtained from this site to display the data on the arduino serial monitor. The program which i am using to display the pitch and roll (attitude) data starts to display nan after a short while when the program is run and i have no idea why. Any help would be great guys. Ill attach the links to where i code the various codes as well as codes.

https://github.com/pololu/lps-arduinohttps://github.com/pololu/lsm303-arduino#serial https://github.com/pololu/minimu-9-ahrs-arduino

#include <LPS.h>
#include <LSM303.h>
#include <Wire.h>

LSM303 compass;


 void setup(){
  setupmagnetometer();
  setupattitude();
  setupaltitude();
}

  void loop(){
  loopmagnetometer();
  loopattitude();
  loopaltitude();
}

 void setupmagnetometer(){

  Serial.begin(9600);
  Wire.begin();
  compass.init();
  compass.enableDefault();

  /*
   Calibration values; the default values of +/-32767 for each axis
  lead to an assumed magnetometer bias of 0. Use the Calibrate example
  program to determine appropriate values for your particular unit.
  */
  compass.m_min = (LSM303::vector<int16_t>){-32767, -32767, -32767};
  compass.m_max = (LSM303::vector<int16_t>){+32767, +32767, +32767};
  }

void loopmagnetometer(){

compass.read();

 /*
 When given no arguments, the heading() function returns the angular
 difference in the horizontal plane between a default vector and
 north, in degrees.

  The default vector is chosen by the library to point along the
  surface of the PCB, in the direction of the top of the text on the
  silkscreen. This is the +X axis on the Pololu LSM303D carrier and
  the -Y axis on the Pololu LSM303DLHC, LSM303DLM, and LSM303DLH
  carriers.

  To use a different vector as a reference, use the version of heading()
  that takes a vector argument; for example, use

 compass.heading((LSM303::vector<int>){0, 0, 1});

 to use the +Z axis as a reference.
  */
  float heading = compass.heading();


Serial.print(heading);
Serial.println(" deg");

delay(1000);
} 

LPS ps;

void setupaltitude()
{
  Serial.begin(9600);
  Wire.begin();

  if (!ps.init())
{
    Serial.println("Failed to autodetect pressure sensor!");
    while (1);
}

  ps.enableDefault();
}
  void loopaltitude()
{ 
  float pressure = ps.readPressureMillibars();
  float altitude = ps.pressureToAltitudeMeters(pressure);
  float temperature = ps.readTemperatureC();

  Serial.print("Pressure: ");
  Serial.print(pressure);
  Serial.print(" mbar\tAltitude: ");
  Serial.print(altitude);
  Serial.print(" m\tTemperature: ");
  Serial.print(temperature);
  Serial.println(" deg C");

  delay(1000);
}
 // Uncomment the below line to use this axis definition: 
 // X axis pointing forward
 // Y axis pointing to the right 
 // and Z axis pointing down.
// Positive pitch : nose up
// Positive roll : right wing down
// Positive yaw : clockwise
int SENSOR_SIGN[9] = {1,1,1,-1,-1,-1,1,1,1}; //Correct directions x,y,z -gyro,accelerometer, magnetometer
// Uncomment the below line to use this axis definition: 
// X axis pointing forward
// Y axis pointing to the left 
// and Z axis pointing up.
// Positive pitch : nose down
// Positive roll : right wing down
// Positive yaw : counterclockwise
//int SENSOR_SIGN[9] = {1,-1,-1,-1,1,1,1,-1,-1}; //Correct directions x,y,z - gyro,    accelerometer, magnetometer

// tested with Arduino Uno with ATmega328 and Arduino Duemilanove with ATMega168

// LSM303 accelerometer: 8 g sensitivity
  // 3.9 mg/digit; 1 g = 256
#define GRAVITY 256  //this equivalent to 1G in the raw data coming from the accelerometer 

 #define ToRad(x) ((x)*0.01745329252)  // *pi/180
 #define ToDeg(x) ((x)*57.2957795131)  // *180/pi

// L3G4200D gyro: 2000 dps full scale

// 70 mdps/digit; 1 dps = 0.07
#define Gyro_Gain_X 0.07 //X axis Gyro gain
#define Gyro_Gain_Y 0.07 //Y axis Gyro gain
#define Gyro_Gain_Z 0.07 //Z axis Gyro gain
#define Gyro_Scaled_X(x) ((x)_ToRad(Gyro_Gain_X)) //Return the scaled ADC raw data of the gyro in radians for second
#define Gyro_Scaled_Y(x) ((x)_ToRad(Gyro_Gain_Y)) //Return the scaled ADC raw data of the gyro in radians for second
#define Gyro_Scaled_Z(x) ((x)*ToRad(Gyro_Gain_Z)) //Return the scaled ADC raw data of the gyro in radians for second

// LSM303 magnetometer calibration constants; use the Calibrate example from
// the Pololu LSM303 library to find the right values for your board
#define M_X_MIN -421
#define M_Y_MIN -639
#define M_Z_MIN -238
#define M_X_MAX 424
#define M_Y_MAX 295
#define M_Z_MAX 472

#define Kp_ROLLPITCH 0.02
#define Ki_ROLLPITCH 0.00002
#define Kp_YAW 1.2
#define Ki_YAW 0.00002

 /*For debugging purposes*/
 //OUTPUTMODE=1 will print the corrected data, 
 //OUTPUTMODE=0 will print uncorrected data of the gyros (with drift)
#define OUTPUTMODE 1

//#define PRINT_DCM 0     //Will print the whole direction cosine matrix
 #define PRINT_ANALOGS 0 //Will print the analog raw data
 #define PRINT_EULER 1   //Will print the Euler angles Roll, Pitch and Yaw

 #define STATUS_LED 13 

float G_Dt=0.02;    // Integration time (DCM algorithm)  We will run the integration loop at 50Hz      if possible

long timer=0;   //general purpuse timer
long timer_old;
long timer24=0; //Second timer used to print values 
int AN[6]; //array that stores the gyro and accelerometer data
int AN_OFFSET[6]={0,0,0,0,0,0}; //Array that stores the Offset of the sensors

int gyro_x;
int gyro_y;
int gyro_z;
int accel_x;
int accel_y;
int accel_z;
int magnetom_x;
int magnetom_y;
int magnetom_z;
float c_magnetom_x;
float c_magnetom_y;
float c_magnetom_z;
float MAG_Heading;

float Accel_Vector[3]= {0,0,0}; //Store the acceleration in a vector
float Gyro_Vector[3]= {0,0,0};//Store the gyros turn rate in a vector
float Omega_Vector[3]= {0,0,0}; //Corrected Gyro_Vector data
float Omega_P[3]= {0,0,0};//Omega Proportional correction
float Omega_I[3]= {0,0,0};//Omega Integrator
float Omega[3]= {0,0,0};

// Euler angles
float roll;
float pitch;
float yaw;

float errorRollPitch[3]= {0,0,0}; 
float errorYaw[3]= {0,0,0};

unsigned int counter=0;
byte gyro_sat=0;

float DCM_Matrix[3][3]= {
{
1,0,0  }

,{
0,1,0 }
,{
0,0,1 }
};
float Update_Matrix[3][3]={{0,1,2},{3,4,5},{6,7,8}}; //Gyros here

float Temporary_Matrix[3][3]={
 {
 0,0,0  }
 ,{
  0,0,0  }
 ,{
  0,0,0  }
};

void setupattitude()
{ 
Serial.begin(115200);
pinMode (STATUS_LED,OUTPUT);  // Status LED

I2C_Init();


digitalWrite(STATUS_LED,LOW);
delay(1500);

Accel_Init();
Compass_Init();
Gyro_Init();

delay(20);

for(int i=0;i<32;i++)    // We take some readings...
{
Read_Gyro();
Read_Accel();
for(int y=0; y<6; y++)   // Cumulate values
  AN_OFFSET[y] += AN[y];
delay(20);
}

for(int y=0; y<6; y++)
  AN_OFFSET[y] = AN_OFFSET[y]/32;

AN_OFFSET[5]-=GRAVITY*SENSOR_SIGN[5];

//Serial.println("Offset:");
for(int y=0; y<6; y++)
  Serial.println(AN_OFFSET[y]);

delay(2000);
digitalWrite(STATUS_LED,HIGH);

timer=millis();
delay(20);
counter=0;
}

void loopattitude()
{
 if((millis()-timer)>=20)  // Main loop runs at 50Hz
{
counter++;
timer_old = timer;
timer=millis();
if (timer>timer_old)
  G_Dt = (timer-timer_old)/1000.0;    // Real time of loop run. We use this on the DCM algorithm     (gyro integration time)
else
  G_Dt = 0;

// *** DCM algorithm
// Data adquisition
Read_Gyro();   // This read gyro data
Read_Accel();     // Read I2C accelerometer

if (counter > 5)  // Read compass data at 10Hz... (5 loop runs)
  {
  counter=0;
  Read_Compass();    // Read I2C magnetometer
  Compass_Heading(); // Calculate magnetic heading  
  }

// Calculations...
Matrix_update(); 
Normalize();
Drift_correction();
Euler_angles();
// ***

Serial.println(roll);
Serial.println(pitch);
 }

}

Yaw values

Hi there, sorry for the issue but i want to know that can i output the YAW values as integer instead of floating or character ?? means for e.g i want 90 instead of 90.36 etc
is it possible ? if possible then how can i get that?? sorry if i am asking a stupid question but i am very new to programming and want to learn with your help.

World frame

In order for my board to be in reference to the world frame can i just comment out the start up offset calculation for the gyro and accelerometer?

Calibration/Drift Issue

hi,

I m a bit confused with the calibration, using the LIS3MDL calibrate code.

hardware:

  • minimu 9 V5
  • arduino uno

I upload the calibration sketch, and read the calibration values after 30seconds .
I get some values.
if i unplug replug my arduino, reupload the calibration sketch, i will get some totally different values

I did it severall time, let the minimu stand on a table, made the 8 movement etc.

never got some stable values for the calibration :'(

what is the issue ? is it normal ?

many thanks for your help

Note: i tried to upload minimu9ahrs.ino sketch with some values i got, but angles provided are drifting a lot

No Output on Arduino Serial Monitor

I have been working a bit to set up the MinIMU-9 v3 Gyro, Accelerometer, and Compass (L3GD20H and LSM303D Carrier) with Arduino and Python. After some time I now have the correct versions on Python and Arduino so that the Python software comes up, yet does not show any points of freedom. Neither does the serial monitor.
The serial monitor only displays Pololu MinIMU-9 + Arduino AHRS

I am at the correct port, (COM4) and baud, (115200) with the connections
Arduino IMU


3V3 - VIN
GND - GND
SDA - SDA
SCL - SCL

Any Help ?

Slope

Hi when i was trying your code on the desktop and steady there is a slope. How can i fix this? Y axis is angle in degree X axis is time in seconds.
Pitch
pitch
Roll
roll
Yaw
yaw

Question about the Accelerometer Initialization

I'm trying to make sure I understand this correctly. Both of these commands are writing to the same register so does the second write undo the first one?

void Accel_Init()
{
....
compass.writeAccReg(LSM303_CTRL_REG4_A, 0x08); // high resolution output mode
compass.writeAccReg(LSM303_CTRL_REG4_A, 0x20); // 8 g full scale: FS = 10 on DLHC
....

0x08 - 0000 1000
0x20 - 0010 0000

To apply both settings, would you use one command with value 0x28 - 0010 1000

Python program produces no output

The Arduino code works GREAT, I'm getting all 3 values in the serial monitor. But the Python program doesn't seem to work at all. If you don't have the right COM port in the .py file, it just doesn't load at all, it will display a quick message in the console then close. So I know that when the program actually stays up, I have entered the right COM port (it also matches the COM port in the Arduino IDE). I know that my PC is getting the proper values through this COM port because I can see them just fine in the serial monitor. I've tried both on my PC, and on my laptop, two completely different environments, but in both situations, the Python program doesn't work.

You get all 3 windows - the compass and heading indicator window, and the 3D representation window, and the console output window, but there's no movement. The console output window is blank. The serial log text file it produces is completely blank. I've tried on two computers, AND with two different versions of Python - I noticed the .py file mentioned 2.6.4 so, after Python 2.7 didn't work, I went and tried 2.6.4 python and the 2.6 respective versions of all 3 of the addon programs. On both computers.

I am absolutely certain that the COM port and baud rate written in the .py file match exactly what they are in Arduino, I am certain that the IMU itself is producing usable values through the Arduino IDE serial monitor, there must be either something wrong with the python code, or there is another addon library/program we are missing, as both of the cases I tried were on clean installs on computers that had never seen Python before. If it makes a difference, I am trying all this on Windows 8.1 64bit (but using the 32bit version of Python as instructed).

Windows freeze

I'm using a Teensy 4.0 connected to the MiniIMU-9 v5, and can get printouts from it just fine. However, I've tried to use the python application to get an idea of how good this module is at measuring orientation, and the windows the python module generates keep freezing, and if I click on them eventually "Not Responding" shows up in the title bar. I have uncommented the #define IMU_V5, and because I was afraid the Teensy 4.0 might be too fast, I added a one millisecond delay after the print statements. In the terminal, the values I'm getting seem to make sense (as in I can independently change r,p, and y by moving the module around) and I never get "Invalid line".

Gibberish

Hello,
I just tried to run this code with an elegoo uno r3 and the altimu v 5 however when I open the serial port all I get is gibberish like this:
Nɗ⸮�⸮�⸮N!�⸮�!���q�P�q�⸮�⸮�җ0⸮02⸮:⸮Oe:�:�⸮�*⸮.⸮:�⸮��

I uncommented the #define IMU_V5.
Is there anything else I should be doing?
Any ideas on why the output is gibberish?

If SCL or SDA doesn't connect , main loop routine stop.

Thank you for useful program. 
In this program ,when SCL or SDA pin is not connected to Arduino, loop routine doesn't work.
It means, if SCL pin is cut accidentally, it does not Serial print wrong data, but it Serial print no data and any other program in loop also stops.

I want to make loop program work even if SCL and SDA is not connected.
What should I do?

Please give me some advice.

DCM doubt

In the Drift_correction() function, when computing the PI feedback controll of the error there's a weighed average of RollPitchError and YawError (as I saw that you referred to a paper discussing DCM applications). The RollPitchError is weighted, but the YawError isn't. Shouldn't it be weighted with something as

1 - Accel_weight

? Or maybe you just did a different elaboration?
I'm just curious, I'm studying the DCM applied for AHRS for an Arduino based quadcopter 😀

Update for MinIMU-9 v5?

Pololu's latest revision of this board is the v5 which combines ST’s LSM6DS33 3-axis gyroscope and 3-axis accelerometer and LIS3MDL 3-axis magnetometer.

I'd like to use your code this new revision. I'd adapt it on my own, but I'm a non-engineer, and trying to set the proper registers is a bit out of my skill set. If anyone else is able to add support for this board, I'll gladly help test it.

LIS3MDL Datasheet:

LSM6DS33 Datasheet

The output are always 0,0,0

Hi, I'm trying to run this code, but my output are always PITCH: 0.00, ROLL: 0.00, YAW:0.00
I've tried to debus values and are like:

_MAGNETOM X: -746, MAGNETOM Y: -2198, MAGNETOM Z: 5760_
!ROLL: 0.00, PITCH: -0.00, YAW: 0.00
EULER:
ANG:0.00,-0.01,0.00
ANALOGS:
AN:38,-68,-17,224,2,-120,-0.37,-1.10,2.88.

I'm using MinIMU-9 v5
Could anyone help me?

Arduino IMU Error

While Uploading my Arduino code I have these following Errors

Arduino: 1.8.7 (Linux), Board: "Arduino Nano, ATmega328P"

/home/hitesh/cart_ws/src/acs/razor_imu_9dof/src/Razor_AHRS/Razor_AHRS.ino: In function 'void read_sensors()':
Razor_AHRS:584:13: error: 'Read_Gyro' was not declared in this scope
   // Normally using x-z-plane-component/y-component of compensated gravity vector
             ^
Razor_AHRS:585:14: error: 'Read_Accel' was not declared in this scope
   // roll = atan2(temp2[1], sqrt(temp2[0] * temp2[0] + temp2[2] * temp2[2]));
              ^
Razor_AHRS:586:13: error: 'Read_Magn' was not declared in this scope
   // Since we compensated for pitch, x-z-plane-component equals z-component:
             ^
/home/hitesh/cart_ws/src/acs/razor_imu_9dof/src/Razor_AHRS/Razor_AHRS.ino: In function 'void compensate_sensor_errors()':
Razor_AHRS:622:78: error: 'Matrix_Vector_Multiply' was not declared in this scope
/home/hitesh/cart_ws/src/acs/razor_imu_9dof/src/Razor_AHRS/Razor_AHRS.ino: In function 'void reset_sensor_fusion()':
Razor_AHRS:655:43: error: 'Vector_Cross_Product' was not declared in this scope
Razor_AHRS:663:19: error: 'Compass_Heading' was not declared in this scope
   delay(400);  // Give sensors enough time to collect data
                   ^
Razor_AHRS:667:52: error: 'init_rotation_matrix' was not declared in this scope
/home/hitesh/cart_ws/src/acs/razor_imu_9dof/src/Razor_AHRS/Razor_AHRS.ino: In function 'void setup()':
Razor_AHRS:728:12: error: 'I2C_Init' was not declared in this scope
         else if (output_param == 'c') // Go to _c_alibration mode
            ^
Razor_AHRS:729:14: error: 'Accel_Init' was not declared in this scope
Razor_AHRS:730:13: error: 'Magn_Init' was not declared in this scope
           output_mode = OUTPUT__MODE_CALIBRATE_SENSORS;
             ^
Razor_AHRS:731:13: error: 'Gyro_Init' was not declared in this scope
           reset_calibration_session_flag = true;
             ^
/home/hitesh/cart_ws/src/acs/razor_imu_9dof/src/Razor_AHRS/Razor_AHRS.ino: In function 'void loop()':
Razor_AHRS:1058:91: error: 'output_calibration' was not declared in this scope
Razor_AHRS:1069:23: error: 'Compass_Heading' was not declared in this scope
Razor_AHRS:1070:21: error: 'Matrix_update' was not declared in this scope
Razor_AHRS:1071:17: error: 'Normalize' was not declared in this scope
Razor_AHRS:1072:24: error: 'Drift_correction' was not declared in this scope
Razor_AHRS:1073:20: error: 'Euler_angles' was not declared in this scope
Razor_AHRS:1076:63: error: 'output_angles' was not declared in this scope
Razor_AHRS:1087:23: error: 'Compass_Heading' was not declared in this scope
Razor_AHRS:1088:21: error: 'Matrix_update' was not declared in this scope
Razor_AHRS:1089:17: error: 'Normalize' was not declared in this scope
Razor_AHRS:1090:24: error: 'Drift_correction' was not declared in this scope
Razor_AHRS:1091:20: error: 'Euler_angles' was not declared in this scope
Razor_AHRS:1094:85: error: 'output_both_angles_and_sensors_text' was not declared in this scope
Razor_AHRS:1098:64: error: 'output_sensors' was not declared in this scope
/home/hitesh/cart_ws/src/acs/razor_imu_9dof/src/Razor_AHRS/DCM.ino: In function 'void Normalize()':
DCM:12:65: error: 'Vector_Dot_Product' was not declared in this scope
   error= -Vector_Dot_Product(&DCM_Matrix[0][0],&DCM_Matrix[1][0])*.5; //eq.19
                                                                 ^
DCM:14:58: error: 'Vector_Scale' was not declared in this scope
   Vector_Scale(&temporary[0][0], &DCM_Matrix[1][0], error); //eq.19
                                                          ^
DCM:17:67: error: 'Vector_Add' was not declared in this scope
   Vector_Add(&temporary[0][0], &temporary[0][0], &DCM_Matrix[0][0]);//eq.19
                                                                   ^
DCM:20:74: error: 'Vector_Cross_Product' was not declared in this scope
   Vector_Cross_Product(&temporary[2][0],&temporary[0][0],&temporary[1][0]); // c= a x b //eq.20
                                                                          ^
/home/hitesh/cart_ws/src/acs/razor_imu_9dof/src/Razor_AHRS/DCM.ino: In function 'void Drift_correction()':
DCM:54:77: error: 'Vector_Cross_Product' was not declared in this scope
   Vector_Cross_Product(&errorRollPitch[0],&Accel_Vector[0],&DCM_Matrix[2][0]); //adjust the ground of reference
                                                                             ^
DCM:55:72: error: 'Vector_Scale' was not declared in this scope
   Vector_Scale(&Omega_P[0],&errorRollPitch[0],Kp_ROLLPITCH*Accel_weight);
                                                                        ^
DCM:58:44: error: 'Vector_Add' was not declared in this scope
   Vector_Add(Omega_I,Omega_I,Scaled_Omega_I);     
                                            ^
/home/hitesh/cart_ws/src/acs/razor_imu_9dof/src/Razor_AHRS/DCM.ino: In function 'void Matrix_update()':
DCM:85:53: error: 'Vector_Add' was not declared in this scope
   Vector_Add(&Omega[0], &Gyro_Vector[0], &Omega_I[0]);  //adding proportional term
                                                     ^
DCM:113:60: error: 'Matrix_Multiply' was not declared in this scope
   Matrix_Multiply(DCM_Matrix,Update_Matrix,Temporary_Matrix); //a*b=c
                                                            ^
exit status 1
'Read_Gyro' was not declared in this scope

What are the Arduino libraries required for these?

python script not running

I am trying the python script on windows and macOS.
I followed the windows instruction and pretty sure all element are installed.
But both systems give me the same error.

Would you know what I am doing wrong?
Thank you.

On windows:
Screen Shot 2020-01-15 at 3 22 29 PM

On macOS:
Stephan:minimu-9-ahrs-arduino-master stephanschulz$ python MinIMU-9-test.py Traceback (most recent call last): File "MinIMU-9-test.py", line 39, in <module> from visual import * ImportError: No module named visual

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.