开发者

Accelerometer not returning 0 values when the iphone is not moving

I have a simple app that just implements the accelerometer stuff and the NSLogs the results to the console.

2011-03-11 00:35:38.248 Accel[1070:307] ************
2011-03-11 00:35:38.737 Accel[1070:307] x: -0.0362244
2011-03-11 00:35:38.743 Accel[1070:307] y: -0.0181122
2011-03-11 00:35:38.747 Accel[1070:307] z: -1.03239
2011-03-11 00:35:38.750 Accel[1070:307] ************
2011-03-11 00:35:39.238 Accel[1070:307] x: -0.0181122
2011-03-11 00:35:39.243 Accel[1070:307] y: -0.0181122
2011-03-11 00:35:39.248 Accel[1070:307] z: -1.03239
2011-03-11 00:35:39开发者_开发问答.250 Accel[1070:307] ************
2011-03-11 00:35:39.739 Accel[1070:307] x: -0.0181122
2011-03-11 00:35:39.744 Accel[1070:307] y: -0.0181122
2011-03-11 00:35:39.749 Accel[1070:307] z: -1.03239
2011-03-11 00:35:39.751 Accel[1070:307] ************
2011-03-11 00:35:40.240 Accel[1070:307] x: -0.0362244
2011-03-11 00:35:40.245 Accel[1070:307] y: -0.0362244
2011-03-11 00:35:40.249 Accel[1070:307] z: -1.05051
2011-03-11 00:35:40.252 Accel[1070:307] ************
2011-03-11 00:35:40.741 Accel[1070:307] x: -0.0362244
2011-03-11 00:35:40.746 Accel[1070:307] y: -0.0362244
2011-03-11 00:35:40.750 Accel[1070:307] z: -1.05051
2011-03-11 00:35:40.752 Accel[1070:307] ************
2011-03-11 00:35:41.241 Accel[1070:307] x: -0.0362244
2011-03-11 00:35:41.247 Accel[1070:307] y: -0.0181122
2011-03-11 00:35:41.251 Accel[1070:307] z: -1.03239
2011-03-11 00:35:41.253 Accel[1070:307] ************

I would have expected 0 for x,y & z, as the phone is resting on the table and not being moved.

So from research i find that accelerometers always read the a resting phone always read that the +1g on the z-axis unless the phone is in free fall. So that explains some of the z-axis reading.

But the .03 to .01 extra on the x,y,z(after adjusting the z-axis for the +1g) is some kind of margin for error ?

Should i be doing something to all these values to get a more true reading?

As i would like to graph the results.

Many Thanks, -Code


This just means that your table isn't perfectly level and gravity is above average in your area. There is probably a little error, but it should be accurate to a few decimal places at least.


When using accelerometer values for any kind of practical uses, use a high pass filter on the values. You can also normalise the gravity vector returned by the accelerometer to get a normal gravity vector.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜