# mobile acceleration/rotation

Consensus IMAP jmac at consensustech.com
Thu Jan 14 09:02:36 EST 2016

```Hopefully, I've got this right but.....
I think of it as the "apparent" acceleration a mass attached to phone feels relative to the body of the device. At rest, if it wasn't attached, it would slide down the inside of the device and end up rattling inside the case. The force trying to make that happen is the mass in the sensor times the acceleration it feels: 1 g (gravity) = 9.8 m/sec^2 = 32 ft/sec^2. The "acceleration" is in units of g's.

Not, drop the whole device. Both the mass and the device fall at the same velocity. The force require to hold them together is almost nothing because they are moving together. Thus the indicated acceleration would be near 0.

When the device hits the floor, it stops but the mass tries to keep going. It takes a lot of force to hold it in place so it will indicate a huge acceleration. That acceleration is, in essence, the opposite of what the device itself experienced.

Likewise for "sideways", accelerations. That little mass inside the device experiences forces that hold it in place and feels those as imposed accelerations due to the movement of the device

Bet this just confused things.

Bottom line.
When at rest, the acceleration will have a magnitude of 1 with a vector pointing towards the middle of the earth. When the device is in free fall, it will indicate 0 because there is no relative force between the mass and the device. Do something that might "break the mass free inside the device" and it will indicate the force (apparent acceleration) between the device and the mass as a vector with a large magnitude.

If you want the "imposed acceleration" the device is feeling, you'll have to "subtract" the 1 g acceleration vector from what "put the acceleration" returns.

J

> On Jan 14, 2016, at 3:06 AM, Ben Rubinstein <benr_mc at cogapp.com> wrote:
>
> Thanks Jim.
>
> So if the device is vertical at rest (y=-1), and falls down vertically, it won't register any acceleration because it's already measuring the maximum in that axis?
>
> In short, it's static acceleration rather than dynamic acceleration, is that correct?
>
> Many thanks,
>
> Ben
>
>
>> On 13/01/2016 17:11, Jim MacConnell wrote:
>> The device can't measure actual acceleration. It measures the forces on
>> sensors in 3 axes. One of those axes will feel force from gravity. That's
>> the 1.
>> Jim
>>
>> -----Original Message-----
>> From: Ben Rubinstein [mailto:benr_mc at cogapp.com]
>> Sent: Wednesday, January 13, 2016 5:08 AM
>> To: Use LiveCode
>> Subject: mobile acceleration/rotation
>>
>> Hmmmm - I've just tried reading the acceleration and rotation sensors.  I
>> admit to finding the whole business confusing, but it seems to me that the
>> data accompanying the accelerationChanged message represents the static
>> orientation of the device.
>>
>> At first I thought that the "rotation" and "acceleration" had been swapped -
>> but then I realised it wasn't "rotation" but "rotation rate".
>>
>> At any rate, the readings I'm getting for acceleration, with my phone lying
>> flat on the desk, have x and y approximately 0, and z at -1.  If I bring the
>> phone upright on its short end, y shifts to -1 and z to 0.  If instead I
>> bring it upright to lie on its left edge, x goes to -1 and y and z to 0; if
>> I bring it upright on the right edge, x goes to 1, y and z to 0.
>>
>> These seem perfectly reasonable things to me, i.e. they seem to represent
>> the state of rotation around the various axes; but I don't understand how
>> they relate to acceleration.
>>
>> Can someone explain this to me?
>>
>> Many thanks,
>>
>> Ben
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

```