After the huge response I got from this post <g>, I did the port myself. This is for ArduIMU V3 and entailed creating an MPU-6000 (SPI) library, verifying the FreeIMU library for the HMC58X3 worked on the ArduIMU hardware, and updating FreeIMU.cpp and FreeIMU.h to create an ArduIMU_V3 set of defines to conditionally build the code for that hardware. I also updated a couple of the FreeIMU examples for test purposes. In general, to have a program that uses the FreeIMU class, you need to add to the current FreeIMU example includes, two #includes for MPU_6000.h and SPI.h. You should also remove the include for MPU6050.h
The FreeIMU.h code on the ArduIMU hardware runs very well. It has a bit of yaw drift but that should disappear when I run the calibration function that is now available.
You cannot use ArduIMUTest with this system as the output format is not compatible. Use either FreeIMU_cube or FreeIMU_yaw_pitch_roll appropriately modified as above.
I have provided this code to Fabio Varesano, the creator of FreeIMU, and he plans to publish it in his repository.
Hi - Thanks for posting this. I just got an ArduIMU and am starting to play with it. What do you think about the FreeIMU code verses the ArduIMU code? I got the ArduIMU code running but since I'm just starting out this might be a good time to experiment with FreeIMU as well. I found the manual for ArduIMU a bit dated. Is the documentation for FreeIMU decent? I'm fairly new working with Arduino code so at this point the more information that is available the easier it is for me to get started. Have you tried using a GPS with FreeIMU. From a brief search I couldn't find much about integrating GPS with the IMU.
I am somewhat new at IMU's, etc. myself but did find the FreeIMU implementation smoother, less noisy, and more responsive than the DCM based ArduIMU code. It doesn’t have the “catch up” phenomenon where after a rapid movement the orientation slowly comes into position. I can’t handle that in my application. I also found the FreeIMU_cube Processing visualization software better than ArduIMUTest as well. I wrote a sketch to output the FreeIMU data in ArduIMUTest format to test this. However, ArduIMUTest does a whole lot more than the simple FreeIMU_cube including GPS. Is the source code for ArduIMUTest available as that would be useful for several things?
Having said that, I am currently having some issues where I am getting a lot of drift that I don't recall seeing when I sent in the code.
There is a calibration process using Python and Octave that I can't get running and that may be all this needs. My system has been running with the example cal values in calibration.h and, by definition, they are wrong for my sensors as each sensor is different. All of my initial tests were with an older version of the FreeIMU library and that one may not have had the static calibration capability. I am in the process of going back to verify this.
I need to do more work overall to find the source of the drift but am not that experienced in the details of the FreeIMU code or the algorithms, in general. The best way for those of us wanting to run the FreeIMU code on ArduIMU, is to pitch in and make donations to Fabio Varesano's work at the Università di Torino so he can acquire an ArduIMU for test and to add it into the supported platforms. Alternatively, 3D Robotics, may be interested in providing an ArduIMU to this cause.
At some point, GPS can be added to make it even better. Fabio doesn't need GPS for his work in using the IMU for Human-Computer Interaction so he doesn’t plan to do it but he referred me to the MultiWii project for an example.
Thanks for your thoughts. It looks like you've done quite a bit of work and I hope people pick up on your progress. The FreeIMU code seems better suited for Linux which I like.
I tried uploading the FreeIMU_raw code in Arduino but got an error that calibration/calibration.h can't be found. I see you have: #include "calibration/calibration.h" in FreeIMU.h but I can't find calibration.h in the files I downloaded from FreeIMU. Any ideas where I can get that?
Do you think Fabio would be interested in supporting ArduIMU if he had a board?
If you download the FreeIMU library from Varasano.net/LaunchPad you will see there is a calibration folder below it. It is there that the calibration.h file is. However, see my comments in the last post about that file needing to be generated for your own specific sensors.
I cannot speak for Fabio but I do know he cannot support the ArduIMU board unless he has hardware to test as well as regression test as the library is enhanced. I believe it is a matter of his time to do the work but, at this point, most of the code generation is already done... so he may.
I clearly need to do more reading. I wasn't aware of the LaunchPad archive but now have that downloaded. So far I have been able to get the FreeIMU_cube program running and it's more stable than what I was able to achieve using the ArduIMU Test program.
I see what you mean about the drift. I managed to launch the calibrate.py program. The first instruction is to load the FreeIMU_serial program from the FreeIMU library onto arduino but I got an error "‘class FreeIMU’ has no member named ‘accgyro’". I expect I need to do some editing in the FreeIMU_serial program now to deal with the ArduIMU. I'm probably in over my head but I'll try to keep plugging away.
Attached is the FreeIMU serial program I have been using. It has 2 additional includes (MPU_6000.h and SPI.h) as those are required to use the ArduIMU board with my port of the FreeIMU library.
I get as far as calibrate.py generating the two cal files but it bombs out calling Octave to run AccMagnCalib.m. I tried to run AccMagnCalib.m directly in Octave but that won't work saying certain variables are undefined (but they are defined as part of the arg-list of the using functions). See this for my posts on the subject:
As you can see this is on Win XP. Maybe it works properly on Linux. In any case, I would be very interested in knowing how to make a calibration.h file for my sensors so please let me know of your progress.
Thanks for the edited serial program. That seems to have worked just fine. Now I'm stuck running calibrate.py. I get to the step in calibrate.py where I have to rotate the device in 3D so that your rotations define a complete sphere. I rotated it around the roll/pitch/yaw axis for a few minutes (over 200,000 readings) and then canceled the program. How did you do this step?
I see Fabio is working on a new program so maybe I'll just wait for that. Do you know what operating system he is using?
Archlinux with everything updated.
I'll be publishing the new calibration software in a matter of days. It will be GUI and platform independent.
Of course.. If I would have a board I wouldn't mind supporting ArduIMU. Although the FreeIMU and ArduIMU are technically competitors, I don't really care. I'm already supporting sparkfun boards, so .. it's fine.
Unfortunately, I'm not going to support a board like that without having it in my hands.. I can support sparkfun boards because they are I2C and quite similar to my older boards, however the ArduIMU uses SPI which change things a lot.
Suggestion and Question for Fabio:
Suggestion: It would be great if you could set up a user forum where we can discuss FreeIMU, make suggestions, report problems, you could make announcements, etc. There multiple freeware forum packages you could host on varesano.net.
What is the purpose and function of : twoKpDef and twoKiDef? When the following changes (zeroing out both parameters) are made, the stability and response seem significantly improved!
//#define twoKpDef (2.0f * 0.5f) // 2 * proportional gain
#define twoKpDef 0; // 2 * proportional gain
//#define twoKiDef (2.0f * 0.1f) // 2 * integral gain
#define twoKiDef 0 //integral gain
There is a new release of FreeIMU with the updated calibration routines at:
Also attached is a calibration.h file with how perfect sensors on the ArduIMU running FreeIMU should result. I don't know if it is required but I use that version of the calibration.h file to compile and upload to theATMega328 with the FreeIMU_serial example. I replaced the calibration.h file in the library folder FreeIMU\calibration with the attached version of the file and then ran the calibration Python py file
I am getting private emails on ArduIMU with FreeIMU so and am recommending all subscribe to this forum to ask questions and discuss the topic here. Here is some basic information about getting started:
The way to "install" the version of the ArduIMU version of FreeIMU is to copy all of the folders in the libraries folder of the download above and then add the MPU6000 folder from the ArduIMU port to your Arduino folder. Then replace the FreeIMU.h and FreeIMU.cpp files in the FreeIMU folder with the ArduIMU versions. Also include the example file folders in the ArduIMU FreeIMU download to your sketchbook folder. If you want to create your own ArduIMU/FreeIMU examples simply make the following changes to the #includes in the example sketch:
add: #include MPU_6000.h
add: #include SPI.h
delete: #include MPU.6050.h
One other thing I have done recently is to change the integral gain in FreeIMU.h:
//#define twoKiDef (2.0f * 0.1f) // 2 * integral gain
#define twoKiDef 0 //integral gain
This was suggested on Fabio Varesano's blog by another user and seems to really reduce the drift. I readily admit I do not understand what this does (it may be detrimental for all I know!). Please understand I am a user like anyone else and only did the programming so FreeIMU would run on Arduimu.
So what are we going to do to get Fabio a ArduIMU board? I still think either 3D Robotics or Sparkfun should donate a board to Fabio's excellent work.