Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Gyroscope offset
Started by Eritar Jun 13 2017 07:03 AM

2 replies to this topic
gyroscope orientation orientation in space offset degree

Best Answer roaminggamer , 13 June 2017 - 07:40 AM

It occurs to me, that you may actually be thinking of the kind of output that the accelerometer gives.

 

Try the accelerometer example too as that may be more suitable to your needs:

https://docs.coronalabs.com/api/event/accelerometer/index.html

>>> https://docs.coronalabs.com/api/event/accelerometer/xGravity.html#gotchas

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Eritar

[GLOBAL: userInfoPane.html]
Eritar
  • Observer

  • 15 posts
  • Corona SDK

Is it possible to get just a raw Gyroscope data? I don't need delta rotation, I just need an offset relative to gravity (like in portrait orientation my device rotated to 15 degrees to right, relatively to the gravity,  and I need to get that 15 degrees as variable). 

Thx. 

Attached Files

  • Attached File  gyro.png   75.29KB   0 downloads


[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,281 posts
  • Corona SDK

1. Have you examined the sample that comes with the simulator?

You can build that and install it on your device and see if the values you get are what you need.

 

2. Whatever the case, you'll probably need to do some math to convert the values to what you need.  The values don't come out in degrees.

https://docs.coronalabs.com/api/event/gyroscope/index.html

radians to degrees calc required>>> https://docs.coronalabs.com/api/event/gyroscope/xRotation.html#gotchas

 

 

Note: A gyroscope by (as determined by the physics of the concept) is designed to measure torque which is then translated to changes in rotation over time, not orientation of the device held in a static position.

 

Please build and install the sample 'Gyroscope' that comes with the simulator, then modify it to display in degrees and I think you'll be fine to convert/use it from there.


Edited by roaminggamer, 13 June 2017 - 07:42 AM.


[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,281 posts
  • Corona SDK

  Best Answer

It occurs to me, that you may actually be thinking of the kind of output that the accelerometer gives.

 

Try the accelerometer example too as that may be more suitable to your needs:

https://docs.coronalabs.com/api/event/accelerometer/index.html

>>> https://docs.coronalabs.com/api/event/accelerometer/xGravity.html#gotchas




[topic_controls]
[/topic_controls]