Code Monkey home page Code Monkey logo

razor-9dof-ahrs's Introduction

Razor AHRS v1.4.2

9 Degree of Measurement Attitude and Heading Reference System for Sparkfun 9DOF Razor IMU (SEN-10125 and SEN-10736) and SparkFun 9DOF Sensor Stick (SEN-10183, SEN-10321 and SEN-10724)

Infos, updates, bug reports, contributions and feedback: https://github.com/ptrbrtz/razor-9dof-ahrs

Download

Clone the repository on GitHub or download as .zip.

Tutorial

You find a detailed tutorial in the Wiki.

Quick setup

Razor AHRS Firmware and Processing Test Sketch

Select your hardware in Arduino/Razor_AHRS/Razor_AHRS.ino under "USER SETUP AREA" / "HARDWARE OPTIONS". Upload the firmware using Arduino.
Run Processing/Razor_AHRS_test/Razor_AHRS_test.pde using Processing.

Optional: Mac OS X / Unix / Linux C++ Interface

Compile test program:

g++ Example.cpp RazorAHRS.cpp -Wall -D_REENTRANT -lpthread -o example

Run it:

./example

Sorry, no Windows support. But you could try to compile using cygwin.

Optional: Android Interface

About Razor AHRS and Android Bluetooth: Bluetooth seems to be even more picky on Android than it is anyway. Be sure to have a look at the section about Android Bluetooth in the tutorial.

Compiling and running the test app: Open up your Android-ready Eclipse and import both projects using FileImport...GeneralExisting Projects into Workspace with the root folder being Android/. Then build and run the test app from Eclipse.

Building your own app:

  • Your app needs to target Android 2.0 (API Level 5) or later. The RazorAHRS Library Project has to be present in your Workspace. Add the library to your app under Project PropertiesAndroidLibrary.

  • In case you want yaw/heading to reference "true north" and not just magnetic north, you can use the included DeclinationHelper class to find out about declination at your current position.

  • You have to specify these uses-permissions in the AndroidManifest.xml:
    android.permission.BLUETOOTH and android.permission.BLUETOOTH_ADMIN

  • If you want to use the DeclinationHelper class you also need:
    android.permission.ACCESS_FINE_LOCATION and android.permission.ACCESS_COARSE_LOCATION

Donation

If the code and the tutorial helped you and you'd like to buy me a beer to say thanks, I'll be happy and say cheers!

PayPal:

razor-9dof-ahrs's People

Contributors

jewang avatar mgeier avatar ptrbrtz 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  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

razor-9dof-ahrs's Issues

Finger Position

Hi,
Can I use this module to estimate the finger position (X, Y and Z), with error less than 1mm, and 1ms?
Thanks

Typo in init_gyro( )

In sensors.ino, the function init_gyro( ) has a few lines that say:
" // Set clock to PLL with z gyro reference
Wire.beginTransmission(GYRO_ADDRESS);
WIRE_SEND(0x3E);
WIRE_SEND(0x00); "

But if you check the datasheet for the gyro, you need the second WIRE_SEND( ) to send 0x03 in order for the z gyro to be the reference. As written, the internal oscillator is being used. This doesn't seem to affect much, but the code just isn't doing what the comments say it is.

All the best and thanks!

Lateral movement

Hi, first of all, thanks for excellent project.

Not a issue but a question, possible to calculate lateral movement too?

SPI Slave interface

I have modified 1.4.2 to (optionally) work as an SPI slave. This is useful for boards which don't have a spare serial port. I would like to contribute it - how do I do that?

Razor IMU 9DOF: angular change when translating

Hi everyone,
I'm using RoS Indigo with the 9DoF Razor IMU (SEN-10736).

With DEBUG__NO_DRIFT_CORRECTION set to 'false', the Yaw-Pitch-Roll output does not drift at all. Great!

However, I fixed the IMU on a horizontal translation stage and I was expecting no angular change, but yaw changed by about 15 degrees for a translation of only 20cm.

Is this normal? Is this a calibration issue? I calibrated the gyroscope, the accelerometer and the magnetometer the best I could...but I'm not sure where to go from here.

Best regards,
-Vincent

Working with IMU 9 DOF Razor and Arduino YUN

Dear all my colleagues and friends,
And, to whom it may concern

Firstly, I want to say IMU 9 DOF Razor with default program (razor-9dof-ahrs) can work well with Arduino UNO and thank you very much for your help.

I do some works with Arduino YUN, like collecting data from IMU 9 DOF Razor, processing and transmitting them by Wifi... When developing my code for Arduino YUN, I have problems with it and IMU 9 DOF Razor. Please give me your suggestions to solve 2 problems below:

[1]. Not like Arduino UNO, Arduino YUN gave out Zero numbers when I used default calibration program (with a little change). I think when we use IMU 9 DOF Razor module with one platform, we have to calibrate it with that platform. If not, the factory should give us default Max-min data for each IMU sensor to apply for every platform. Is it true?

When calibrating IMU 9 DOF Razor, I improve the razor-9dof-ahrs program (https://github.com/ptrbrtz/razor-9dof-ahrs) by use Bridge to change the way to transmit data from using COM to Wifi, and put default Max-min data numbers for it:

// Put MIN/MAX and OFFSET readings for your board here!
// Accelerometer
// "accel x,y,z (min/max) = X_MIN/X_MAX Y_MIN/Y_MAX Z_MIN/Z_MAX"

define ACCEL_X_MIN ((float) -250)

define ACCEL_X_MAX ((float) 250)

define ACCEL_Y_MIN ((float) -250)

define ACCEL_Y_MAX ((float) 250)

define ACCEL_Z_MIN ((float) -250)

define ACCEL_Z_MAX ((float) 250)

// Magnetometer (standard calibration) - Default numbers
// "magn x,y,z (min/max) = X_MIN/X_MAX Y_MIN/Y_MAX Z_MIN/Z_MAX"

define MAGN_X_MIN ((float) -600)

define MAGN_X_MAX ((float) 600)

define MAGN_Y_MIN ((float) -600)

define MAGN_Y_MAX ((float) 600)

define MAGN_Z_MIN ((float) -600)

define MAGN_Z_MAX ((float) 600)

// Gyroscope
// "gyro x,y,z (current/average) = .../OFFSET_X .../OFFSET_Y .../OFFSET_Z

define GYRO_AVERAGE_OFFSET_X ((float) 0.0)

define GYRO_AVERAGE_OFFSET_Y ((float) 0.0)

define GYRO_AVERAGE_OFFSET_Z ((float) 0.0)

I receive results = 0 for all. Even with that numbers, Arduino UNO can work normally.

1

I tried to calibrate IMU 9 DOF Razor by Arduino UNO and have corrected number with Arduino UNO. I mean IMU can work well with Arduino UNO. But when I did copy that numbers and program to Arduino YUN, Arduino YUN runs out of rank after some minutes.

2

[2]. When collecting data from IMU 9 DOF Razor by YUN via Wi-Fi, I have full data: Y, P, R, Ax, Ay, Az; Mx, My, Mz, Gx, Gy, Gz. But after some minutes, data run out of ranks (nan – not a number). How can I correct that fault?

3

Thank you very much for taking time to read and comment!

Sensing a 360 degree rotation value on the X axis

I have successfully calibrated and tested my 9Dof stick with your processing code, and the visual display works great. However, I can't figure out how to get a degree value of 0 to 360 around it's X axis.
The heading can be any direction, just depending on where the user stands, but I need the reading of rotation on pitch. This 10 second video shows it more clearly. I need to read this rotation, regardless of whether it's pointing left, right, straight ahead, or backward. Thanks for any help with this.
http://youtu.be/VH5QJre1om4

Accelerometer data rate

I have seen that modifying the BW_RATE register (0x2C) you can set different rates in Hz, from 6 to 3200. What happens if you set 6 Hz but you run the loop at 1000 Hz? I have tried it but seems to work well.

Serial port selection problem

Hi all

I'm trying to upload the the firmware to my 9dof razor imu board, first I connect the wires to the serial/usb converter and then plug the usb to my computer, and then load the .ino file and select the hardware in it (hardware options section), but after choosing the board from tools/board menu the serial port is still gray and I can't see any options! why is this?

Thanks,

Razor 9DOF SEN-10736

I've followed the direction very carefully. The Arduino sketch runs fine, but when I try to run the "Processing" sketch, I get the following messages, and nothing appears in the Razor_AHRS_test graphics window. Could you please give me some idea of what I might be doing incorrectly?

java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 22
at com.jogamp.common.util.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:58)
at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:103)
at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:206)
at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:172)
at javax.media.opengl.Threading.invoke(Threading.java:191)
at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:541)
at processing.opengl.PJOGL.requestDraw(PJOGL.java:688)
at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1651)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 22
at Razor_AHRS_test.setup(Razor_AHRS_test.java:150)
at processing.core.PApplet.handleDraw(PApplet.java:2361)
at processing.opengl.PJOGL$PGLListener.display(PJOGL.java:862)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:665)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:649)
at javax.media.opengl.awt.GLCanvas$10.run(GLCanvas.java:1289)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1119)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:994)
at javax.media.opengl.awt.GLCanvas$11.run(GLCanvas.java:1300)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Serial error

Good day,

I stumbled upon your code today while working on a project and it is evident that a lot of work was put into it, well done. Upon running the code on an Arduino Due connected to the 9DOF sensor stick (SEN=10724) the serial at first returns correct looking values but after 10 lines or so returns only "#YPR=nan,nan,nan". I am new to Arduino and found that "nan" means that it is not a number. It appears that something has gone awry with the calculations leading to out of limit values, do you have any idea what could be wrong?

Cheers,
Andrew
screen shot 2014-01-06 at 11 11 34 am

Serial Read stuck in Binary and not accepting Commands

Hello all!
I just recently started trying to adapt imus and sensors to some of my projects and I am currently working on the Razor IMU. My issue is after uploading the program to the IMU and testing the Serial Out through the monitor, I am only seeing what I am assuming is the binary output. Also, when I try to use the serial commands, there is no response from the IMU.

I am using:
Windows 10
Arduino 1.0.6
FTDI Cable

I have tried both magnometer chips in the hardware setup and made sure that I am using the correct chip when uploading. I have not changed the original code in anyway except for the Hardware Setup. Thank you ahead of time for your assistance!

32 bit issue

This type of code will fail on 32 bit boards, like Teensy3, Arduino Zero, Arduino Due, ESP8266, ChipKit, etc...

    accel[0] = (((int) buff[3]) << 8) | buff[2];  // X axis (internal sensor y axis)
    accel[1] = (((int) buff[1]) << 8) | buff[0];  // Y axis (internal sensor x axis)
    accel[2] = (((int) buff[5]) << 8) | buff[4];  // Z axis (internal sensor z axis)

On 32 bit boards, "int" is a 32 bit number. Because buff[] is unsigned bytes, these will will produce results from 0 to 65535, because you'd shifting numbers from 0 to 255. On AVR where "int" is 16 bits, this code works, but only because the result which should have been 0 to 65535 is stored into a 16 bit signed number which can only represent -32768 to +32767.

The proper way to make this work involves a cast to int16_t, like this:

    accel[0] = (int16_t)((((int) buff[3]) << 8) | buff[2]);  // X axis (internal sensor y axis)
    accel[1] = (int16_t)((((int) buff[1]) << 8) | buff[0]);  // Y axis (internal sensor x axis)
    accel[2] = (int16_t)((((int) buff[5]) << 8) | buff[4]);  // Z axis (internal sensor z axis)

This fix is fully compatible with AVR and all 32 bit platforms. It explicitly instructs the compiler to consider the result a 16 bit signed integer.

Can't compile!

I am running the same code as the example from the folder and this happens:

Final_arduino_code.ino: In function 'void read_sensors()':
Final_arduino_code:427: error: 'Read_Gyro' was not declared in this scope
Final_arduino_code:428: error: 'Read_Accel' was not declared in this scope
Final_arduino_code:429: error: 'Read_Magn' was not declared in this scope
Final_arduino_code.ino: In function 'void reset_sensor_fusion()':
Final_arduino_code:450: error: 'Vector_Cross_Product' was not declared in this scope
Final_arduino_code:458: error: 'Compass_Heading' was not declared in this scope
Final_arduino_code:462: error: 'init_rotation_matrix' was not declared in this scope
Final_arduino_code.ino: In function 'void compensate_sensor_errors()':
Final_arduino_code:476: error: 'Matrix_Vector_Multiply' was not declared in this scope
Final_arduino_code.ino: In function 'void setup()':
Final_arduino_code:541: error: 'I2C_Init' was not declared in this scope
Final_arduino_code:542: error: 'Accel_Init' was not declared in this scope
Final_arduino_code:543: error: 'Magn_Init' was not declared in this scope
Final_arduino_code:544: error: 'Gyro_Init' was not declared in this scope
Final_arduino_code.ino: In function 'void loop()':
Final_arduino_code:675: error: 'output_calibration' was not declared in this scope
Final_arduino_code:683: error: 'Compass_Heading' was not declared in this scope
Final_arduino_code:684: error: 'Matrix_update' was not declared in this scope
Final_arduino_code:685: error: 'Normalize' was not declared in this scope
Final_arduino_code:686: error: 'Drift_correction' was not declared in this scope
Final_arduino_code:687: error: 'Euler_angles' was not declared in this scope
Final_arduino_code:689: error: 'output_angles' was not declared in this scope
Final_arduino_code:693: error: 'output_sensors' was not declared in this scope

I can't get it to work, these errors normally appear because of a missing library, I already tried to include the .ino in the rest of the folders, didn't worked, created a .h to each of the .ino files and renamed the ino to cpp and didn't work, I don't know how to get rid of this problem, please help me.

Signals switching columns when walking

Hello,

I have this issue intermittently with my razor IMU, where the values for the yaw/pitch/roll switch while walking. I am including a plot for your review. Please let me know if this has happened to you, and/or if there is anything I could do to fix it.

thanks!
Aminat
logsub22

Reading all data using #oscb

Hello!

I'm trying to use the Razor IMU to log all acceleration, gyro, and magnetometer data to an output file. I added some code to log the gyro angles (and a timestamp) from the Razor_AHRS_test.pde sketch into a file and that works well. I get the timestamp and then the three angles correctly. However, when I change it to the #oscb (all calibrated values binary, accel_xyz, mag_xyz, gyr_xyz) mode and try to simply read the six other outputs to the file using the readFloat() function, I don't get the results I'm expecting. The acceleration and magnetometer values appear to make sense, but the gyro angles are not the same (even though I didn't move the IMU between tests) and they appear to shift all over when moving the IMU even slightly (very jittery). It says in the Arduino setup file that the format is 3x3, i.e. 3 rows of 3 binary float values of 4 bytes each, making 36 bytes total. Here is my code for reading the extra data and then printing it to a file. Please let me know if you can see any errors with this. I'm very new to Processing and Java so maybe I missed something simple.

while (serial.available() >= 36) {
accel_x = readFloat(serial);
accel_y = readFloat(serial);
accel_z = readFloat(serial);
mag_x = readFloat(serial);
mag_y = readFloat(serial);
mag_z = readFloat(serial);
gyr_x = readFloat(serial);
gyr_y = readFloat(serial);
gyr_z = readFloat(serial);
}

out.println(time + " " + accel_x + " " + accel_y + " " + accel_z + " " + mag_x + " " + mag_y + " " + mag_z + " " + gyr_x + " " + gyr_y + " " + gyr_z);

Thanks :)

Connecting razor IMU Directly with MEGA 2560/UNO without FTDI Basic Breakout Board

Hi Guys! I've connected the IMU with MEGA in the following configuration, but I kept getting 0 for all the output. Could anyone please give me some hint on how to resolve this problem?
Also, I've been trying to figure out where in the Razor_AHRS script calls the Sensors script? and is it possible for me to just use the Sensor script to get the output using MEGA without the FTDI?

This is my first time posting question, so please let me know if I should be more specific or informative. I really appreciate if anyone could help me out! Thanks!

IMU | MEGA 2560
GND ---- GND
3.3v ----- 3.3v
TX0 ---- RX0
RX1 ---- TX1

GY-85 Issues

When I open the serial monitor, it just says #YPR=0.00,0.00,0.00 over and over again. The Gy-85 is connected to an arduino micro using 5V for VCC, Gnd for Gnd, and uses SCL and SDA. Any suggestions? I have uncommented line 164.

Not what I expected

I guess I misunderstood what the expected behavior is. I breadboarded a sensor stick along with a Teensy 3.1 sat it on the seat of my airplane along with my laptop and went flying. The Razor_AHRS_test did a great job of tracking my heading but not the orientation of the earth. I made some steep turns and it always oriented towards the bottom of the aircraft.

I guess I have to study the math and see what I need to do to return an Earth oriented frame of reference unless someone has already done so.

Getting no GYRO values

Hi all, whilst trying to calibrate the SparkFun "9DOF Sensor Stick" version "SEN-10724" I get only zeros for the gyro x,y, z values. Can anyone suggest why this may be and or a possible solution?

Disable the Magnetometer correction

HI, Can I disable the magnetometer correction just leaving the accelerometer and gyro?? my problem is that I have to use the IMU within a metal box, so the magnetometer can create errors.

Thank you very much

Yaw rate lag / inaccuracy

I am using a Razor on a model aircraft, and find that in a tight turn, using the Euler angles, the yaw is not updated rapidly enough. I plotted Course over ground from the GPS vs Yaw from the Razor, as attached.

Note that COG and Yaw should NOT be identical due to slippage and wind speed, but the graph of COG shows two full circles, while yaw does not rotate fully even once. (the x axis is milliseconds).

Can this be improved, or is the magnetometer inherently slow?

image

Data rate for ITG Gyro

Thank you for your awesome library! I am using it for an experimental model for my PhD.
I need to reduce the data rates because I run this huge loop that takes about 50 ms (20 Hz) and I have some issues with I2C hanging.
I noticed that for the ITG-3200 Gyro you set DLPF_CFG=3, which sets the internal clock to 1 kHz. Then you set the clock divider to 10. From the example they give in the schematic, it seems that you set the sample rate to 1000/(10+1)= 91 Hz.
Am I missing something here?

Convert pitch from -90 - +90 to 0-360 degree (paid job)

Hi,

We have been using this firmware for some time and it serves us well. Thank you very much for this. We would like to convert the output pitch angles from -90-+90 to 0-360 degree. FreeIMU has done it. mjs513/FreeIMU-Updates#27.
FreeIMU.txt
i.e., void FreeIMU::getEuler360deg(float * angles)

We are just not good at this and couldn't get it. Hope someone can help us on this. We are happy to pay for it and share the code with everyone. Thank you in advance.

Regards
KK
[email protected]

YPR rate of change

I would like to access the rates of change for the Euler angles. Is this accessible somewhere inside the calcs, or does it need to be calculated using G_dt and a copy of the previous YPR?

9DOF Stick locks up I2C while reading Gyro

I've been evaluating this *excellent * AHRS code for my project and would like to report a possible bug when using the 9 DOF Sensor Stick. After running perfectly for about an hour at 15Hz (i.e. after more than 50000 successful iterations) the code unexpectedly locks up the Arduino while trying to read from the Gyro sensor.

The line of code that hangs is Wire.requestFrom(GYRO_ADDRESS, 6). It just never comes back -- you have to reset the Arduino! There appears to be a known issue with the ITG-3200 Gyroscope as discussed on the Arduino forum topic (forum.arduino.cc/index.php?topic=66353).

It would appear that this problem is with the Wire I2C implementation. The ITG-3200 Gyroscope can get in a twist and hold the CLK low. Since the Wire library doesn't have a timeout feature you can't get control back and the Arduino waits indefinitely for the data.

I was wondering if anyone had tried to use felias-fogg's SoftI2CMaster library instead which has a timeout feature (github.com/felias-fogg/SoftI2CMaster). I'm not sure if I'm up to the task, but rewriting this way may be my only option for reliable comms...

Or I could increase my sensor cost and purchase the Razor IMU which uses serial instead of I2C.

Any suggestions or ideas are gratefully received!

Weird serial monitor data

Dear all,

I bought several days ago the 9DOF module and setup the hardware as mentioned in your tutorial, uploaded the software code of your tutorial and I set all the parameters correctly (e.b. Baud Rate 57600). However, there seems to be an error somewhere, because the serial monitor shows only weird data readings (see attached screenshot / picture).

I googled a lot to solve the problem by myself, but I haven't been able to solve it - thus, I would appreciate your help to solve this issue :) Thank you in advance for your answer!!!

bildschirmfoto 2014-02-13 um 01 04 01

compass calibration

I'm not sure if it is an issue but maybe you may help me.
I tried to use the AHRS to check my SEN10724. It is connected to an OpenCM9.
Since the GUI failed because java OGL complained about bindTexture(...) calls, I ported a simplified version of the AHRS to OpenGL 2.0/C++.
The object does not move because I get the following output:

YPR=-9.58,0.00,-57.95

YPR=-179.57,0.00,122.63

YPR=0.00,0.00,0.00

YPR=0.00,0.00,0.00

YPR=0.00,0.00,0.00

YPR=0.00,0.00,0.00

YPR=0.00,0.00,0.00

Thus I decided to check the HMC5883L. I added the self test procedure described in the PDF in Sensors.ino.
The output is the following:
(first gain is 390):
test_HMC5883L:X-axis:NOT OK
test_HMC5883L:Y-axis:NOT OK
test_HMC5883L:Z-axis:NOT OK
(second gain is 330)
test_HMC5883L:X-axis:OK
test_HMC5883L:Y-axis:OK
test_HMC5883L:Z-axis:OK
test_HMC5883L: l_gain=330.0000000000
test_HMC5883L:end
The hardware is OK, isn't it ?

I restarted the board and entered in calibration mode.
For the compass, I saw this:
magn x,y,z (min/max) = 65317.00/65317.00 -64977.00/-64977.00 -457.00/-457.00
magn x,y,z (min/max) = 65317.00/65317.00 -64977.00/-64977.00 -457.00/-457.00
magn x,y,z (min/max) = 65317.00/65317.00 -64977.00/-64975.00 -457.00/-456.00
magn x,y,z (min/max) = 65317.00/65317.00 -64977.00/-64975.00 -457.00/-456.00
magn x,y,z (min/max) = 65317.00/65317.00 -64977.00/-64975.00 -457.00/-456.00
magn x,y,z (min/max) = 65317.00/65317.00 -64977.00/-64975.00 -457.00/-456.00
magn x,y,z (min/max) = 65317.00/65317.00 -64977.00/-64975.00 -457.00/-456.00
I used all the gain values of the PDF without success.
Can I use such large data for the calibration ?
Why do only the 2 first values are different from 0 in #YPR mode ?

Fabien

only getting RPY values

I am running Razor-9dof-ahrs with ros but I am only getting RPY values and no acceleration or gyro values. Are there some parameters that I need to change so I will start getting values. The program ends with the following error which is because the word only has 3 elements i.e. RPY.

imuMsg.linear_acceleration.x = -float(words[3]) * accel_factor
IndexError: list index out of range

Processing 3.0 update

After updating to Processing 3.0, a couple of issues arose when trying to run the Razor_AHRS_test program. These can be easily fixed by

  1. replacing the line in setup() function: 'size(640, 480, OPENGL);' with 'size(640, 480, P3D);'

and

  1. comment out or remove the call to the lights() function found in void draw()

Hopefully this helps to prevent anyone else from the same frustration I experienced after upgrading to Processing 3.0.

AHRS plotting using MATLAB

Hello,

Thanks a lot for the code and for the detailed explanation of how to execute it. Can you please upload a MATLAB code for AHRS, coz I want to use MATLAB instead of Processing to achieve the same. Thank you in advance.

9DOF Sensor Stick

I am using the code with SEN-10724 "SparkFun 9 Degrees of Freedom - Sensor Stick" and it is working almost well. I haven't changed anything.

Looking the relative position of the accelerometer, magnetometer and gyroscope, it looks like the relative position is not the same in Razor and Sensor Stick. Do I need to change anything?
stick
razor

Best way to sync with external device?

Hi,
I'd like to synchronize the razor with other device.
The device I am using support output of external trigger signal using GPIO.
I would like to print out most recent attitude when triggering signal in falling edge.
Initial implementation can be external interrupt by using attachInterrupt of arduino
however i am worrying about interruption in the middle of attitude calculation.

What will be the best way to implement this?

BINARY float output (YPR)

Hey, I am currently working with the Razor 9dof and want to set up a serial interface from Razor ---> dSpace MicroAutoBox (one way connection, only TX@Razor and RX@Autobox in use). The output angles in BINARY format are 12 bytes long, so each orientation has 4 bytes = 32 Bit float value. If I want to display the output values with Matlab it seems that my serial receive block gets some values, but Matlab doesn't know where the frame starts or ends. So the values are in fact at random.

Is it possible to use only the one way connection and "listen" to the serial stream or do I have to specify a start and stop bit or bit-sequence for the frame?
(If TEXT output is used the start bit-sequence is obviously "#YPR=" and the end bit-sequence of the frame thus "\r\n"...)

I hope someone has a solution or hint for me :-)

rgds
Kai

Max Values of adxl345

After converting the output to G's I can only get max values around 2 and I am not sure why. Is the code set to +-16G?

Serial.print("#A-"); Serial.print(raw_or_calibrated); Serial.print('=');
// Gs = Measurement Value * (G-range/(2^13)) or Gs = Measurement Value * (32/8192) = 0.00390625
Serial.print(accel[0]_0.00390625); Serial.print(",");
Serial.print(accel[1]_0.00390625); Serial.print(",");
Serial.print(accel[2]*0.00390625); Serial.println();

Gy-80 compatibility

hi, i Have a gy-80 9 dof imu board with this sensors:
-ADXL 345 acc
-L3G4200D gyro
-HMC5883L magn
-BMP085 baro

The gyro Is not the same of Razor 9 dof ahrs that use the ITG-3200, i want to extend the compatibility of this code to my board, i can sobstitute the register of the Arduino code? or it Is more difficult ? I Have tried aniway the code with no changes to my board and i have the pitch and Roma angle that seems to Be right but the yaw angle Is vero slow to change and wrong in many cases... Thanks

Change sensitivity on ADXL to +-16g

Hi
How I can change sensitivity on accelerometer ADXL?
I am is a begginer in programing processors.
I read in adxl datasheet about registers but I dont find in code on tutorial.
Thanks

AHRS fails to compile.

I am getting the following errors when trying to compile the AHRS code prior to uploading to the IMU. Am I missing a library? Please could someone help. The IMU works fine when connected to my PC running the example firmware. The only change to the code is the selection of hardware type.

Razor_AHRS.ino: In function 'void read_sensors()':
Razor_AHRS:392: error: 'Read_Accel' was not declared in this scope
Razor_AHRS:393: error: 'Read_Magn' was not declared in this scope
Razor_AHRS.ino: In function 'void reset_sensor_fusion()':
Razor_AHRS:413: error: 'Vector_Cross_Product' was not declared in this scope
Razor_AHRS:421: error: 'Compass_Heading' was not declared in this scope
Razor_AHRS:425: error: 'init_rotation_matrix' was not declared in this scope
Razor_AHRS.ino: In function 'void setup()':
Razor_AHRS:503: error: 'I2C_Init' was not declared in this scope
Razor_AHRS:504: error: 'Accel_Init' was not declared in this scope
Razor_AHRS:505: error: 'Magn_Init' was not declared in this scope
Razor_AHRS:506: error: 'Gyro_Init' was not declared in this scope
Razor_AHRS.ino: In function 'void loop()':
Razor_AHRS:634: error: 'output_calibration' was not declared in this scope
Razor_AHRS:642: error: 'Compass_Heading' was not declared in this scope
Razor_AHRS:643: error: 'Matrix_update' was not declared in this scope
Razor_AHRS:644: error: 'Normalize' was not declared in this scope
Razor_AHRS:645: error: 'Drift_correction' was not declared in this scope
Razor_AHRS:646: error: 'Euler_angles' was not declared in this scope
Razor_AHRS:648: error: 'output_angles' was not declared in this scope
Razor_AHRS:652: error: 'output_sensors' was not declared in this scope

Sorted problem.

Not loading the additional parts of code.

magn init timeout

Im getting end of address transmission timeout (code 3) after calling wire.endTransmission at magnetometer init function, any tip?

Drift Issues

Hi,

I've ported the Razor IMU code over to a custom ARM platform. All the sensors seem to be working correctly and, having calibrated the accelerometer, gyro and magnetometer I am now getting significant drift on the yaw component.

Having verified that the sensor orientations are the same as the Razor IMU board and having verified that the magnetometer calibration has been successful via Matlab, I'm a little bit confused as I would have expected my platform to be virtually identical.

As an example, if I point my platform such that it reads 0deg yaw and then rotate (either clockwise or anti-clockwise) to 90deg, the yaw reads roughly 60-70deg before slowly returning back towards 30deg.

Could this be an error due to mag calibration? The platform which my 3 sensors on will have some soft-iron and hard-iron interference due to power supply ferrites, inductors, etc.

Any tips or hints would be greatly received.

Regards,
Kevin

Hi

Hi Mr.PeterBa, i just want to ask one question, what is this error when I try to run your code in Processing v2.0.3, it says "unexpected token:def" . what version of Processing would you recommend to run this code of yours?
Thanks for the reply.. :)

DDMarks

Getting avrdude: stk500_getsync(): not in sync: resp=0x00 while using FTDI on a razor board without firmware

Hello,

Just as the title claims, I have followed all the instructions and when I tried to upload the verified code to razor board, it would keep on complaining about "avrdude: stk500_getsync(): not in sync: resp=0x00". Furthermore, it does not have any firmware on it. There is a chance that it may have been burnt but I would like to rule out other issues too.

Has anyone ever faced this issue?

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.