getting yaw-pitch-roll data from the hardware

How to get yaw-pitch-roll values from the device using Corona SDK (not a custom code written in Obj-C/Java)?

On iOS this data can be reached by

CMMotionManager.deviceMotion.attitude.yaw

CMMotionManager.deviceMotion.attitude.pitch

CMMotionManager.deviceMotion.attitude.roll

 

So far, in CoronaSDK, I see only one way: to cumulate xRotation, yRotation and zRotation values of gyroscope in a runtime. But I didn’t test it yet.

Please assist.

 

 

I don’t believe we provide yaw, pitch and roll using those terms.  I believe that is what xRotation, yRotation and zRotation provide those values.

Rob

I tried to cumulate xRotation, yRotation and zRotation values received from the gyroscope in CoronaSDK but it didn’t help.

When I run an app the initial values are 0, 0 and 0. Then I turn device to some direction little bit and values are changing properly, then I turn the device back to initial position and I can see how cumulate values return to zero which is nice. However, if I rotate device more (like 3-4 full turns to same direction and then back) values are significantly off of zero.

In this approach I see 2 problems:

  1. the value doesn’t return to 0 as I expect;

  2. the initial value is 0,0,0 and I cannot determine the device’s position in space according to the ground.

On iOS that can be easily reached by calling 

CMMotionManager.deviceMotion.attitude.yaw

CMMotionManager.deviceMotion.attitude.pitch

CMMotionManager.deviceMotion.attitude.roll

 

Are you planning to improve the gyroscope in CoronaSDK?

I’m unaware of any plans to add extra features.  You could put in a feature request at:

http://feedback.coronalabs.com

Rob

I don’t believe we provide yaw, pitch and roll using those terms.  I believe that is what xRotation, yRotation and zRotation provide those values.

Rob

I tried to cumulate xRotation, yRotation and zRotation values received from the gyroscope in CoronaSDK but it didn’t help.

When I run an app the initial values are 0, 0 and 0. Then I turn device to some direction little bit and values are changing properly, then I turn the device back to initial position and I can see how cumulate values return to zero which is nice. However, if I rotate device more (like 3-4 full turns to same direction and then back) values are significantly off of zero.

In this approach I see 2 problems:

  1. the value doesn’t return to 0 as I expect;

  2. the initial value is 0,0,0 and I cannot determine the device’s position in space according to the ground.

On iOS that can be easily reached by calling 

CMMotionManager.deviceMotion.attitude.yaw

CMMotionManager.deviceMotion.attitude.pitch

CMMotionManager.deviceMotion.attitude.roll

 

Are you planning to improve the gyroscope in CoronaSDK?

I’m unaware of any plans to add extra features.  You could put in a feature request at:

http://feedback.coronalabs.com

Rob