Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #45 on: May 20, 2011, 06:39:53 am » |
yes sorry i meant z-axis.
ok, i'll try research into that. Or else i might be able to get an arduino mega.
Worst case scenario i can still work with the values i am getting
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #46 on: May 20, 2011, 06:42:21 am » |
Okay. Please upload the code for calculating the angle with only two values from the accelerometer when you get it working  - Lauszus
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #47 on: May 26, 2011, 06:04:22 am » |
I thought a bit about it, and actually you can calculate the axis with just one value. In the code it says: accXangle = acos(accXval/R)*RAD_TO_DEG-90; accYangle = acos(accYval/R)*RAD_TO_DEG-90;
Instead you could write: accXangle = asin(accXval)*RAD_TO_DEG; accYangle = asin(accYval)*RAD_TO_DEG;
Then you should get an angle very close to the first one!! It is not as precise as the first one, but that kind of precision is only important if you are building a balancing robot or something like that. The resolution will also only be 180 degrees. That should fix your problem  - Lauszus
|
|
|
|
« Last Edit: May 26, 2011, 06:54:31 am by Lauszus »
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 8
Arduino rocks
|
 |
« Reply #48 on: May 29, 2011, 12:27:09 pm » |
Guys, I really think I should be getting better yaw values from the Gyro. I found this: http://code.google.com/p/imumargalgorithm30042010sohm/This shows some pretty decent output which leads me to believe that my unit could be broken as the Yaw value doesn't change at all when I rotate around that axis. I noticed that on the sparkfun page for this item, someone else had a similar problem. I've emailed the chap from the link above in the hopes that I can figure this out. At the moment, the lack of decent/any yaw (no need to use a magnometer just yet) is halting my project  Im wondering if there is something else im missing here. I've tried the kalman filter approach as well and that seems worse than just using the raw gyro values :S
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #49 on: May 30, 2011, 07:46:57 am » |
You can not use the kalman filter for the yaw value, because the accelerometer can not measure the yaw  Hope you get it working! - Lauszus
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 8
Arduino rocks
|
 |
« Reply #50 on: May 31, 2011, 07:55:01 am » |
Yeah, I've done a little more research and I see what you mean. I guess i just need to integrate over time for yaw off the gyro and then reset when the drift gets too much... until maybe I get a magnetometer as well!
Thanks though! Its been a big help!
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #51 on: June 09, 2011, 05:13:56 am » |
Hey guys,
Is it possible to also use the kalman filter for only an accelerometer? It will only use one axis (of the three available). I just need a smooth movement of the servo I'm using
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #52 on: June 09, 2011, 06:05:52 am » |
You can not use the kalman filter with only one input. Sorry but you need a gyro too, that is why it called "sensor fusion"  You could perhaps use some other kind of smoothing algorithm. - Lauszus
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #53 on: June 09, 2011, 06:20:23 am » |
Hey Lauszus, I finished my final year project in college. I thought I would show it on here so people can see what can be done with the code and sensor. Thanks again for you help!
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #54 on: June 09, 2011, 06:46:16 am » |
It look and sounds very cool. Thanks for sharing. So which academic degree do have now? - Lauszus
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #55 on: June 09, 2011, 06:59:32 am » |
multimedia 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #56 on: June 09, 2011, 03:59:27 pm » |
You can not use the kalman filter with only one input. Sorry but you need a gyro too, that is why it called "sensor fusion"  You could perhaps use some other kind of smoothing algorithm. - Lauszus Any recommendations? I found these... http://arduino.cc/en/Tutorial/Smoothinghttp://www.arduino.cc/playground/Main/SmoothDon't know how smooth they work, didn't get time to test them yet
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #57 on: June 10, 2011, 03:18:19 am » |
I haven't got any experience myself, but it look likes what you need  Or you could just write something like this: int difference = reading - lastreading; abs(difference); if(difference > 10) reading = lastreading;
It will ignore the data if you for example shake the sensor. The best solution might be combining those two approaches. - Lauszus
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 134
panta rei resist the resistors!
|
 |
« Reply #58 on: June 12, 2011, 12:10:34 pm » |
Hey Lauszus thanks for providing this great guide!! I've read your comments to onidaito and I'm not exactly sure of what you mean when you are saying that the accelerometer can not measure the yaw I'm trying to understand if for my project I need 6 or 9 degrees of freedom So let's be straight and have a visual example:  can the sensor you are using (and the code) measure all these 6 variables? thanks in advance b.
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
Full Member
Karma: 7
Posts: 246
|
 |
« Reply #59 on: June 13, 2011, 06:45:28 am » |
The accelerometer can measure the roll and the pitch, but not the yaw. The gyro can measure both the roll, pitch, and the yaw, but all these will drift. In total that gives only the roll and the pitch. You need a magnetometer to measure the yaw too. - Lauszus
|
|
|
|
« Last Edit: June 13, 2011, 06:47:06 am by Lauszus »
|
Logged
|
|
|
|
|
|