New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gyroscope Implementation for android #3361

Closed
wants to merge 7 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@snovak

snovak commented Aug 19, 2015

This works for me on android. It’s a copy over of the accelerometer implementation… just wiring up another sensor for use in libGDX!

I haven’t written any test, nor implemented for iOS. My test is an app I’m working on.. Will go to production in Sept to check out.

uxxr added some commits Jun 5, 2015

Initial Gyro implementation.
Now I see a BUNCH of ERRORS that need implementation of :
Input.getGyroscopeX()
Input.getGyroscopeY()
Input.getGyroscopeZ()
Show outdated Hide outdated .gitignore Outdated
@snovak

This comment has been minimized.

Show comment
Hide comment
@snovak

snovak Aug 19, 2015

Appologies,, my first pull request ever. My day job lives in SVN. So, I'm learning. I like the review layout. Easier to see my mistakes ;-). I'll get these fixed pronto.. I'm also noticing something that I'll need to recompile and test on the device before committing. I'll change the comments and have the rest done today.

snovak commented Aug 19, 2015

Appologies,, my first pull request ever. My day job lives in SVN. So, I'm learning. I like the review layout. Easier to see my mistakes ;-). I'll get these fixed pronto.. I'm also noticing something that I'll need to recompile and test on the device before committing. I'll change the comments and have the rest done today.

@snovak

This comment has been minimized.

Show comment
Hide comment
@snovak

snovak Aug 19, 2015

Okay.. some changes were made. Looking much cleaner. Ready for review.

snovak commented Aug 19, 2015

Okay.. some changes were made. Looking much cleaner. Ready for review.

@Tom-Ski

This comment has been minimized.

Show comment
Hide comment
@Tom-Ski

Tom-Ski Aug 20, 2015

Member

Whats wrong with checking isPeripheralAvailable?

Member

Tom-Ski commented Aug 20, 2015

Whats wrong with checking isPeripheralAvailable?

@Tom-Ski

This comment has been minimized.

Show comment
Hide comment
@Tom-Ski

Tom-Ski Aug 20, 2015

Member

I don't follow, isPeripheralAvailable(Peripheral.Accelerometer) will actually return that.

edit: too late, no takey backsies!

Member

Tom-Ski commented Aug 20, 2015

I don't follow, isPeripheralAvailable(Peripheral.Accelerometer) will actually return that.

edit: too late, no takey backsies!

@nooone

This comment has been minimized.

Show comment
Hide comment
@nooone

nooone Aug 20, 2015

Contributor

Sorry @Tom-Ski for my confusion. It actually still leaves me in doubt about the isAccelerometerAvailable (and similar) methods in some of the implementations. Why do we have them, if isPeripheralAvailable actually checks that?

Contributor

nooone commented Aug 20, 2015

Sorry @Tom-Ski for my confusion. It actually still leaves me in doubt about the isAccelerometerAvailable (and similar) methods in some of the implementations. Why do we have them, if isPeripheralAvailable actually checks that?

@Tom-Ski

This comment has been minimized.

Show comment
Hide comment
@Tom-Ski

Tom-Ski Aug 20, 2015

Member

Looks like its just LwjglInput that does this? If so its probably just old code that needs to removed.

Member

Tom-Ski commented Aug 20, 2015

Looks like its just LwjglInput that does this? If so its probably just old code that needs to removed.

@snovak

This comment has been minimized.

Show comment
Hide comment
@snovak

snovak Aug 20, 2015

Those additional comments have been removed. Thanks for the guidance!

@nooone, are you saying that I remove isGyroscopeAvailable() and isAccelerometerAvailable()? Would that be out of scope for this?

snovak commented Aug 20, 2015

Those additional comments have been removed. Thanks for the guidance!

@nooone, are you saying that I remove isGyroscopeAvailable() and isAccelerometerAvailable()? Would that be out of scope for this?

@Tom-Ski

This comment has been minimized.

Show comment
Hide comment
@Tom-Ski

Tom-Ski Aug 20, 2015

Member

You can leave it for now.

Member

Tom-Ski commented Aug 20, 2015

You can leave it for now.

@snovak

This comment has been minimized.

Show comment
Hide comment
@snovak

snovak Aug 20, 2015

I can add a TODO ;-)

snovak commented Aug 20, 2015

I can add a TODO ;-)

@@ -570,6 +570,12 @@ private static void initializeKeyNames () {
/** @return The value of the accelerometer on its y-axis. ranges between [-10,10]. */
public float getAccelerometerZ ();
public float getGyroscopeX ();

This comment has been minimized.

@Tom-Ski

Tom-Ski Aug 21, 2015

Member

Should have some javadoc as to what is expected to return from these functions, namely the un-normalized gyro sample data.

"return The rate of rotation around the x axis. (rad/s)" should be good enough.

@Tom-Ski

Tom-Ski Aug 21, 2015

Member

Should have some javadoc as to what is expected to return from these functions, namely the un-normalized gyro sample data.

"return The rate of rotation around the x axis. (rad/s)" should be good enough.

@Tom-Ski

This comment has been minimized.

Show comment
Hide comment
@Tom-Ski

Tom-Ski Aug 21, 2015

Member

Looks good, if you could just add javadoc to the Input interface methods, and squash these commits to one, that would be great!

Member

Tom-Ski commented Aug 21, 2015

Looks good, if you could just add javadoc to the Input interface methods, and squash these commits to one, that would be great!

@cypherdare

This comment has been minimized.

Show comment
Hide comment
@cypherdare

cypherdare Oct 17, 2015

Contributor

Might want to check the iOS API and the frame of reference it uses to make sure this can be future proofed for the eventual iOS implementation. I suppose the iOSInput class could reorient to the Android frame of reference so it doesn't have to be done in the core of a project.

Also, it might be nice to also add support for the Rotation Vector Sensor, which probably provides better results than pure gyroscope. It melds gyroscope with the accelerometer, tilt sensor and compass and smooths the results all behind the scenes. iOS has something similar in Core Motion CMAttitude. But that could be done in a separate pull.

Contributor

cypherdare commented Oct 17, 2015

Might want to check the iOS API and the frame of reference it uses to make sure this can be future proofed for the eventual iOS implementation. I suppose the iOSInput class could reorient to the Android frame of reference so it doesn't have to be done in the core of a project.

Also, it might be nice to also add support for the Rotation Vector Sensor, which probably provides better results than pure gyroscope. It melds gyroscope with the accelerometer, tilt sensor and compass and smooths the results all behind the scenes. iOS has something similar in Core Motion CMAttitude. But that could be done in a separate pull.

@snovak

This comment has been minimized.

Show comment
Hide comment
@snovak

snovak Nov 23, 2015

@cypherdare I've created a new pull request for this here #3594 I will certainly take a look at the Rotation Vector Sensor for a future implementation.

snovak commented Nov 23, 2015

@cypherdare I've created a new pull request for this here #3594 I will certainly take a look at the Rotation Vector Sensor for a future implementation.

@snovak snovak closed this Nov 23, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment