### Kalman Filtering code for ArduIMU (flat)

Hi all -I have an ArduIMU version 2 (flat), and have implemented a kalman filtering code for the x and y axis.I have also created a GUI to test/debug/optimize the kalman filter. I am by no means an expert in this category, so I am asking that you guys please try it out and then try to further optimize/develop the kalman filter. Currently it works well but I am not sure if it is reacting fast enough, or it it rejects enough noise.

#### Replies

• Challenge accepted sir!  The math doesn't scare me.  The processing power is the scary part.  I'll let you all know how it turns out in a month or so.

• Hi Jamie,

Very interesting work.

The left picture represent the process without KF, isn't it? Can you link the sources of GUI test?

Thanks,
• hi Jaime,

i have read your kalman.pde code, i'm impressed about how you did implement the theory of kalman filter.

Would you share your kalman theory paper with me?, I need read this paper for take a better understanding.

thanks, have you nice day
• I´ve watch on my experiments, that i have just glitches on the angles, it reads fine, but it has some glitches, i was thinking in applying a second filter, a filter for the angles, what do you think about that??
• Hi!!!

Im making a RUAV, or for start, the stabilization of a helicopter.

Im using the DCM filtering, but with issues, i just now try your kalman filtering...

I did not use your GUI, i used labview...

I got more problems with kalman than with dcm..... any idea of why?? is not suppose to be better kalman than DCM??

In the picture, the helicopter is on a table, and i got half a throttle on.

The angles are completly lost!!!

Ideas??

10x!!!

• Developer
You are correct about the EKF being non-linear....Including the 6dof equations as your model makes it non-linear. Study the 6dof equations and the Kalman takes the exact same approach as you have written except its only one Kalman with a larger matrix. Simple as that. It becomes quite clear why its non linear once you start working the math in the same approach as you have written except including more equations.
• The code is all there. It should compile fine in the Arduino IDE, does it not? The kalman_update method is in the kalman.pde file...

As for documentation, I am not sure what to write. Basically the firmware in the zip file should compile and upload onto the ArduIMU board without issue. Then, you simply run the "IMU Test.exe" executable in the GUI folder. You can then view the outputted data (both as raw data and in an artificial horizon like above^^).

If you have any specific questions, I am glad to answer them. But the code is far to experimental at this point to provide any formal documentation.

Thanks,

-Jamie
• Hi Jamie,

Can you write some kind of documentation rather than giving us the code ?

Paul
• Developer
It doesn't seem to be complete. Where are all of the function calls?

kalman_update for example is no where in the source?

Perhaps a bit more background would help:

My goal is to implement a kalman filter to fuse the gyro and accel data together, in hopes to get a smooth/fast enough response from the sensors, while also reducing noise (especially from vibration).

My eventual application for this will be a quadrotor: the IMU will supply raw & filtered sensor values (including GPS) via i2c to a parent controller board, and the PID loops and other quadrotor code can run without having to filter the sensor values.

Since posting this code, I have noticed that the kalman is not working properly for all 360 degrees of rotation: at around 90 degrees it gets a bit goofy. I am not sure why it is doing this as the sensor values all respond correctly when viewed as raw values.

I am not the best when it comes to the complex math involved here - I only know enough to get the filter code implemented and working to some degree.

If anyone with good IMU/Math skills can contribute to this I would greatly appreciate it. Also there would then be a good, open-source Arduino-based Kalman filter IMU!!

Thanks,

-Jamie

### Activity

RT @chr1sa: Donkeycar 4.4 released with tons of new features, including path learning (useful with GPS outdoors), better Web and Lidar supp…
Sunday
RT @NXP: We are already biting our nails in anticipation of the #NXPCupEMEA challenge! 😉 Did you know there are great cash prizes to be won…
Nov 24
RT @gclue_akira: レースまであと3日。今回のコースは激ムズかも。あと一歩 #jetracer https://t.co/GKcEjImQ3t
Nov 24
UC Berkeley's DIY robocar program https://roar.berkeley.edu/
Nov 24
RT @chr1sa: The next @DIYRobocars autonomous car race at @circuitlaunch will be on Sat, Dec 10. Thrills, spills and a Brazilian BBQ. Fun…
Nov 24
RT @arthiak_tc: Donkey car platform ... Still training uses behavioral cloning #TCXpo #diyrobocar @OttawaAVGroup https://t.co/PHBYwlFlnE
Nov 20
RT @emurmur77: Points for style. @donkeycar racing in @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/Y2hMyj1…
Nov 20
RT @SmallpixelCar: Going to @diyrobocars race at @UCSDJacobs https://t.co/Rrf9vDJ8TJ
Nov 8
RT @SmallpixelCar: Race @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/kK686Hb9Ej
Nov 8