Hello All, Me again! I came across the following formula to calculate pitch from accelerometer signals. pitch = atan2(Ay, sqrt(Ax^2+Az^2)) Is this correct? Now a slightly complicated stuff. Found this video and it is very interesting and of course it is not for novices like me. https://youtu.be/C7JQ7Rpwn2k?t=1415 How does he obtain Gravity to obtain Linear acceleration? Many thanks :) Sia --------------------------------------- Posted through http://www.DSPRelated.com
Verification of the following formula
Started by ●May 19, 2015
Reply by ●May 19, 20152015-05-19
On Tue, 19 May 2015 13:58:48 -0500, "sia4uin" <105263@DSPRelated> wrote:>Hello All, > >Me again! > >I came across the following formula to calculate pitch from accelerometer >signals. > >pitch = atan2(Ay, sqrt(Ax^2+Az^2)) > >Is this correct? > >Now a slightly complicated stuff. > >Found this video and it is very interesting and of course it is not for >novices like me. > >https://youtu.be/C7JQ7Rpwn2k?t=1415 > >How does he obtain Gravity to obtain Linear acceleration? > >Many thanks :) > >Sia >--------------------------------------- >Posted through http://www.DSPRelated.comStrictly speaking, you can't get pitch from acceleration, only direction of travel. If the direction of travel is restricted, like, for example, a train on a track or a truck, then the direction of travel should be correlated with pitch. For a helicopter or something like that, it may not be at all. Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
Reply by ●May 19, 20152015-05-19
> >Strictly speaking, you can't get pitch from acceleration, only >direction of travel. If the direction of travel is restricted, like, >for example, a train on a track or a truck, then the direction of >travel should be correlated with pitch. > >For a helicopter or something like that, it may not be at all. > > >Eric Jacobsen >Anchor Hill Communications >http://www.anchorhill.comThank you Eric. I found that formula here http://stackoverflow.com/questions/7553417/complementary-filter-gyro-accel-with-android Also, how can I obtain gravity vector so I can subtract it from the measured acceleration and obtain Linear Acceleration. Best Regards Sia --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●May 19, 20152015-05-19
On Tue, 19 May 2015 13:58:48 -0500, "sia4uin" <105263@DSPRelated> wrote:>I came across the following formula to calculate pitch from accelerometer >signals. > >pitch = atan2(Ay, sqrt(Ax^2+Az^2)) > >Is this correct?The x-axis and the z-axis form a plane, and the y-axis is of course perpendicular to that plane, so "atan2(Ay, sqrt(Ax^2+Az^2))" only gives you the angle of the acceleration vector relative to the x/z plane. Trying to call it "pitch" or "roll" or anything else depends upon the context. If the acceleration is due entirely to gravity, and the y-axis is pointed up when no rotations have been applied (gravity pointing down feels to the accelerometers like acceleration pointing up), then "atan2(Ay, sqrt(Ax^2+Az^2))" might be "90�-pitch" or it might be "90�-roll" or it might be a combination of the two.
Reply by ●May 19, 20152015-05-19
>The x-axis and the z-axis form a plane, and the y-axis is of course >perpendicular to that plane, so "atan2(Ay, sqrt(Ax^2+Az^2))" only gives >you the angle of the acceleration vector relative to the x/z plane. > >Trying to call it "pitch" or "roll" or anything else depends upon the >context. If the acceleration is due entirely to gravity, and the y-axis >is pointed up when no rotations have been applied (gravity pointing >down >feels to the accelerometers like acceleration pointing up), then >"atan2(Ay, sqrt(Ax^2+Az^2))" might be "90°-pitch" or it might be >"90°-roll" or it might be a combination of the two.So in the case of mobile device, where the y-axis is pointing ahead, x-axis is pointing sideways and z-axis is pointing up, will this formula work, as being done here: http://stackoverflow.com/questions/7553417/complementary-filter-gyro-accel-with-android --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●May 19, 20152015-05-19
>Hello All, > >Me again! > >I came across the following formula to calculate pitch from >accelerometer >signals. > >pitch = atan2(Ay, sqrt(Ax^2+Az^2)) > >Is this correct? > >Now a slightly complicated stuff. > >Found this video and it is very interesting and of course it is not for >novices like me. > >https://youtu.be/C7JQ7Rpwn2k?t15 > >How does he obtain Gravity to obtain Linear acceleration? > >Many thanks :) > >Sia >--------------------------------------- >Posted through http://www.DSPRelated.comFor the Gravity estimation, I came across this implementation http://developer.android.com/guide/topics/sensors/sensors_motion.html#sensors-motion-accel Is it correct? Best Regards Sia --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●May 20, 20152015-05-20
On Tue, 19 May 2015 13:58:48 -0500, sia4uin wrote:> Hello All, > > Me again! > > I came across the following formula to calculate pitch from > accelerometer signals. > > pitch = atan2(Ay, sqrt(Ax^2+Az^2)) > > Is this correct?As far as it goes, and assuming that y, in your coordinate system, is forward, and assuming that the pitch does not go beyond 180 degrees. So, correct and useless to boot. You need a 3-dimensional rotation vector (or 4, if you want to use quaternions).> Now a slightly complicated stuff. > > Found this video and it is very interesting and of course it is not for > novices like me. > > https://youtu.be/C7JQ7Rpwn2k?t=1415 > > How does he obtain Gravity to obtain Linear acceleration?He says _right in that video_ that it's nearly impossible to obtain a decent gravity vector from the information available on the phone. There simply is not enough information available from the usual inertial sensors + compass to do navigation, unless the inertial sensors are much, much better than the ones found in a phone. -- www.wescottdesign.com
Reply by ●May 20, 20152015-05-20
>> Found this video and it is very interesting and of course it is not >for >> novices like me. >> >> https://youtu.be/C7JQ7Rpwn2k?t15 >> >> How does he obtain Gravity to obtain Linear acceleration? > >He says _right in that video_ that it's nearly impossible to obtain a >decent gravity vector from the information available on the phone. > >There simply is not enough information available from the usual inertial > >sensors + compass to do navigation, unless the inertial sensors are >much, >much better than the ones found in a phone. > >-- >www.wescottdesign.comThank you Tim. But then he also says that by doing some fusion you can get estimate of Gravity. I found this link which uses Complementary filter instead of Kalman filter. http://www.thousand-thoughts.com/2012/03/android-sensor-fusion-tutorial/2/ He uses some inbuilt functions from Android which takes Accelerometer and Magnetometer as inputs and provides orientation. And then he applies Complementary filter on this orientation and Gyro data. Any idea what the Android function is doing when it combines Accelerometer and Magnetometer data? Best Regards sia --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●May 20, 20152015-05-20
On Tue, 19 May 2015 15:16:21 -0500, "sia4uin" <105263@DSPRelated> wrote:>So in the case of mobile device, where the y-axis is pointing ahead, >x-axis is pointing sideways and z-axis is pointing up, will this formula >work ...The axis orientation is appropriate, but trying to use your formula in the real world is extremely naive. It assumes that everything is perfect and free of disturbances. That only happens in homework problems.
Reply by ●May 20, 20152015-05-20
On Tue, 19 May 2015 15:16:21 -0500, "sia4uin" <105263@DSPRelated> wrote:>So in the case of mobile device, where the y-axis is pointing ahead, >x-axis is pointing sideways and z-axis is pointing up, will this formula >work ...The axis orientation is appropriate, but trying to use your formula in the real world is extremely naive. It assumes that everything is perfect and free of disturbances. That only happens in homework problems.