LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview AHRS Community Document Nightmare

This post is in reference to this document:  https://decibel.ni.com/content/docs/DOC-18964#/?page=4

 

I have two of the Razor boards from SparkFun and they have been killing me.  (I bought a second just to make sure the board wasn't bad)  I can't get either of them to calibrate correctly.  I have tried the AHRS9DOF firmware and multiple calibration methods.  I consider myself to be a smart person so I must be doing something horribly wrong.  My best results so far have actually come from example magnetometer calibrations rather than my own measurenents!

 

I am developing a system for my father with ALS (he can only move his head and fingers a small amount).  A head mounted IMU will take measurenets of his head position and generate very large movements of a Nintendo Wii remote control.  This way he will be able to play video games with the family.  I've already built and tested the robot Wii remote manipulator, the bluetooth device that pushes buttons on the robot held remote, an interface box that debounces large 3" diameter buttons, a large joystick, and a +/- 0.3psi pressure transducer for sip and puff control  This is the LAST step!  I thought I had it figured out, but after accomplishing all of the above I noticed the problems.

 

After a day of head banging, I don't have success but I do have a lot to report.

 

This video here shows a modified version of the program to include:

-average of raw sensor values (used for gyro offset creation)

-min/max values from a resettable buffer (accelerometer and magnetometer)

-last acquired sample of raw sensor values

-last acquired sample corrected sensor values

 

Current problems:

-Yaw seems to move 180 degrees for a 90 degree sensor movement, possibly 1 degree of drift every 5-7 seconds...but all gyros are 0.

-Pitch and roll seem to have the same problem, but they drift even more

 

Here is a youtube video showing the problem.  It should be ready in 25 minutes after posting this message.

https://www.youtube.com/watch?v=sKGOEbDdkRU

 

 

How I calibrated:

 

I calibrated my gyros by sitting the PCB down, not disturbing it, and averaging 500 values.  Here are my gyro offsets:

 

    sen_offset.gyro_offset[0]      = (float)-2;

    sen_offset.gyro_offset[1]      = (float)0;

    sen_offset.gyro_offset[2]      = (float)0;

 

I calibrated my accelerometers by holding the PCB to get the highest max and the lowest min readings.  I would hold they sensor close to vertical and then very slowly move it around to find the highest gravity reading.  I would reset the average array frequently to make sure I had a good number and not one with acceleration mixed in with gravity.  Here are my accelerometer calibrations.  I stole the formulas from the Razor ahrs package.  I put in comments behind the sen_offset variables what they are being set to at runtime.

 

#define ACCEL_X_MIN ((float) -258)

#define ACCEL_X_MAX ((float) 262)

#define ACCEL_Y_MIN ((float) -257)

#define ACCEL_Y_MAX ((float) 274)

#define ACCEL_Z_MIN ((float) -262)

#define ACCEL_Z_MAX ((float) 252)

 

#define ACCEL_X_OFFSET ((ACCEL_X_MIN + ACCEL_X_MAX) / 2.0f)

#define ACCEL_Y_OFFSET ((ACCEL_Y_MIN + ACCEL_Y_MAX) / 2.0f)

#define ACCEL_Z_OFFSET ((ACCEL_Z_MIN + ACCEL_Z_MAX) / 2.0f)

#define ACCEL_X_SCALE (GRAVITY / (ACCEL_X_MAX - ACCEL_X_OFFSET))

#define ACCEL_Y_SCALE (GRAVITY / (ACCEL_Y_MAX - ACCEL_Y_OFFSET))

#define ACCEL_Z_SCALE (GRAVITY / (ACCEL_Z_MAX - ACCEL_Z_OFFSET))

 

    sen_offset.accel_offset[0]     = (float)ACCEL_X_OFFSET; //2

    sen_offset.accel_offset[1]     = (float)ACCEL_Y_OFFSET; //8.5

    sen_offset.accel_offset[2]     = (float)ACCEL_Z_OFFSET; //-5

    

    sen_offset.accel_scale[0]     = (float)ACCEL_X_SCALE; //.98

    sen_offset.accel_scale[1]     = (float)ACCEL_Y_SCALE; //.96

    sen_offset.accel_scale[2]     = (float)ACCEL_Z_SCALE;  //1

 

Finally, I calibrated the magnetometer by aligning the sensor with magentic north and rotating each axis to find the min and max readings.

 

#define MAGN_X_MIN ((float) -871)

#define MAGN_X_MAX ((float) 887)

#define MAGN_Y_MIN ((float) -1054)

#define MAGN_Y_MAX ((float) 674)

#define MAGN_Z_MIN ((float) -783)

#define MAGN_Z_MAX ((float) 874)

 

 

#define MAGN_X_OFFSET ((MAGN_X_MIN + MAGN_X_MAX) / 2.0f)

#define MAGN_Y_OFFSET ((MAGN_Y_MIN + MAGN_Y_MAX) / 2.0f)

#define MAGN_Z_OFFSET ((MAGN_Z_MIN + MAGN_Z_MAX) / 2.0f)

 

    sen_offset.magnetom_offset[0]  = MAGN_X_OFFSET;  //8

    sen_offset.magnetom_offset[1]  = MAGN_Y_OFFSET;  //-190

    sen_offset.magnetom_offset[2]  = MAGN_Z_OFFSET;  //45.5

 

So, WHY DOES THE IMU HATE ME?????    ; (

 

I will attach my current arduino and labview code.

 

Thanks for any help you guys can give me.  I hope what I'm going through can help someone else!  The labview code is messy...it gets cleaned when it works.  : )  Since I can't attach code here, I am starting a discussion at this link:

 

Where ever a solution is find to my nightmare, I will update both places.

 

Grant

 

 

0 Kudos
Message 1 of 6
(3,881 Views)

Just something to fill in the blanks...

 

Here is a proof of concept manipulator holding the wii remote:

https://www.youtube.com/watch?v=13cWH2Z91aA

 

There is no scaling or gain applied to the IMU driving the robot.  The idea is that a small head movement can create a big manipulator movement.  My dad won't be able to play this game in 6-8 months.  He is going down hill fast.  : (

 

The current manipulator has two yaw, two roll, and one theta motor.  No more tape.  : )  The remote is now disassembled and surrounded by heat shrink tubing, an ardunio, a bluetooth adapter, and lithium battery.

 

Don't even try to search google for "Wii remote robot", if you're looking for robots holding a wii remote.  : )

0 Kudos
Message 2 of 6
(3,875 Views)
Since it does not seem like you have a LabVIEW problem and you are getting help in the community that you linked to, the discussion should be kept there.
0 Kudos
Message 3 of 6
(3,857 Views)

I can't upload files in private messages or the document page, so I thought a discussion here would be best in order to keep the discussion public for everyone else.

0 Kudos
Message 4 of 6
(3,837 Views)

hey there!!

could you help me in acquiring data from ahrs

and could you also tell me the prerequisite hardware and software

 

thank you

0 Kudos
Message 5 of 6
(3,616 Views)

Hi Jaskii,

 

Have you tried posting on the group page the original poster linked for AHRS? It seems to be relatively active still with the last post being from February, so you might be able to find more information there. A link to it can be found here: http://forums.ni.com/t5/UAV-Interest-Group/Quaternion-based-AHRS-Library-Tested-on-the-Sparkfun-9dof...

0 Kudos
Message 6 of 6
(3,601 Views)