Orientation Component, versus orientation sensor and gyroscope sensor

399 views
Skip to first unread message

ClickApp

unread,
Jul 11, 2014, 11:13:16 AM7/11/14
to app-inventor-o...@googlegroups.com
Hello,

I am using MIT AppInventor2 and made use of the Orientation Component that has worked nicely in testing with Android devices that have the orientation sensor.  
But my questions (because I really do not know, and need to find out so I understand this better) is does the existing Orientation Component support only the orientation sensor, or does it support the gyro also?   Or, does there have to be a new Gyroscope Component created first to support gyro sensors ? 

Many thanks in advance for info about this.

ClickApp

unread,
Jul 11, 2014, 3:15:07 PM7/11/14
to app-inventor-o...@googlegroups.com
Addendum to my previous question.   Reading up here:   http://developer.android.com/guide/topics/sensors/sensors_motion.html#sensors-motion-gyro

There is the orientation sensor (software using the Accelerometer and Magnetic Field Sensors),  and then again there is the Rotational Vector Sensor which is also called an orientation sensor at times.  I do not know which of these methods the AI2 Orientation Component uses ?    It would be helpful to me to know this, when looking at all the various Android devices out there to support.   And at the same time, based on the URL above, it looks me like the Gyroscope Sensor does need its own AI2 Component, not yet implemented in AI2?   Wondering if this is possibly in an up and coming version? (I am not a Java developer.)   ;)   

Jos Flores

unread,
Jul 11, 2014, 3:33:09 PM7/11/14
to app-inventor-open-source-dev
Hi there,

this is a link to the source for the orientation sensor:
https://github.com/mit-cml/appinventor-sources/blob/master/appinventor/components/src/com/google/appinventor/components/runtime/OrientationSensor.java

Whatever is used (I don't really know) it will be in there.

There are currently no ongoing projects on this area, as far as I know.

cheers,
José
> --
> You received this message because you are subscribed to the Google Groups
> "App Inventor Open Source Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to app-inventor-open-so...@googlegroups.com.
> To post to this group, send email to
> app-inventor-o...@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/app-inventor-open-source-dev.
> For more options, visit https://groups.google.com/d/optout.

ClickApp

unread,
Jul 11, 2014, 3:55:48 PM7/11/14
to app-inventor-o...@googlegroups.com

Thank you Jose.  

Coincidentally, I was just looking at the source code from http://appinventor.mit.edu/appinventor-sources/  download page, this source:  mit-cml-appinventor-sources-nls-269-gcffc624.tar.gz
and also found what you pointed out - the OrientationSensor.java.   It it, I found this, and like references, which tells me the AI2 Orientation Component is indeed using the software orientation sensor, not the RVS previously also mentioned.

// Get sensors, and start listening.
    sensorManager =
      (SensorManager) container.$context().getSystemService(Context.SENSOR_SERVICE);
    accelerometerSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    magneticFieldSensor = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);


I'm sorry to hear there is no project to add a Gyro Sensor Component to AI2, as this is one of the very things that Android needs to catch up to Apple's devices.  

I could probably rack my brain and attempt to see what I could do, but I don't have any java experience.   I am hoping this might be re-considered by the MIT developers and helpers with java experience to add the Gyroscope Component?

(He said with great hope.)

;)


Jos Flores

unread,
Jul 11, 2014, 4:11:04 PM7/11/14
to app-inventor-open-source-dev
If you want to have a go at it, there's plenty of documentation in
that site. Let us know how it goes!

cheers,
José

ClickApp

unread,
Jul 11, 2014, 5:11:42 PM7/11/14
to app-inventor-o...@googlegroups.com
Well, thank you, but nobody wait up for me.   :)    And if anyone has this already going, please keep running with it.  

ClickApp

unread,
Jul 11, 2014, 8:25:20 PM7/11/14
to app-inventor-o...@googlegroups.com


Another reason MIT App Inventor really really needs to add support for Gyroscope Sensor as alternative to the Orientation Sensor (which is software combination of Accelerometer and Magnetic Field sensors):

https://www.google.com/nexus/7/index.html?feature=ha-text-sem-n7&utm_source=ha&utm_medium=text&utm_campaign=sem_exp&utm_content=n7&gclid=CPjWkM-_vr8CFULK4AodqhEAdA&gclsrc=ds

  • Sensors
    • GPS
    • Gyroscope
    • Accelerometer
    • Compass
    • Ambient Light

  NOTE:  The complete absence of the Magnetic Field sensor in Google's Nexus 7 tablet.  This is not just a no-name brand but Google's device.  
               In this case the Gyro is there to do the orientation, and needs to be supported.

 

Jos Flores

unread,
Jul 11, 2014, 8:34:24 PM7/11/14
to app-inventor-open-source-dev
We welcome pull requests :)

cheers,
José

Hal Abelson

unread,
Jul 11, 2014, 10:52:09 PM7/11/14
to app-inventor-o...@googlegroups.com
Peter:

Thanks for sending me email, but please keep this on the forum, so that other people can see it and reply.

I'm reposting your mail to me, and I'll reply in the next message.
I hope you don't mind me reposting this.

== Hal


=============
email to Hal from Peter

Hal:
I realize you are busy, and have an open discussion on your forum

https://groups.google.com/forum/#!forum/app-inventor-open-source-dev


But I felt you realy need to be aware of this:  

Another reason MIT App Inventor really really needs to add support for Gyroscope Sensor as alternative to the Orientation Sensor (which is software combination of Accelerometer and Magnetic Field sensors):

https://www.google.com/nexus/7/index.html?feature=ha-text-sem-n7&utm_source=ha&utm_medium=text&utm_campaign=sem_exp&utm_content=n7&gclid=CPjWkM-_vr8CFULK4AodqhEAdA&gclsrc=ds

  • Sensors
    • GPS
    • Gyroscope
    • Accelerometer
    • Compass
    • Ambient Light

  NOTE:  The complete absence of the Magnetic Field sensor in Google's Nexus 7 tablet.  This is not just a no-name brand but Google's device.  
               In this case the Gyro is there to do the orientation, and needs to be supported.

I am also noticing this more and more with other brand tablets.

What this means is the current AI2 Orientation Component which relies on the Accelerometer and the Mag Field sensor, will not work in these devices where the mag field sensor is no longer being included. 

I am not a java developer, and would not be able to provide this kind of assisance to MIT AI2 project, but I know your internal engineers could probably knock this out much quicker. 

Many thanks for hearing this out,
FYI
Peter


Hal Abelson

unread,
Jul 11, 2014, 11:05:08 PM7/11/14
to app-inventor-o...@googlegroups.com

Peter:

Thanks for commenting on the Gyro sensor.    I'll file this request as an issue, but I can't promise we will get to it quickly.   MIT may be a large institution, but you can count the number of App Inventor developers here on the fingers of one hand, and we have a ton of other priorities.

A couple of notes;

(1) I just checked that the current App Inventor orientation sensor works on the Nexus 7.   Do you know of any Android devices that the present orientation sensor does work on?

(2)  Could you say a bit about why implementing the Gyro is critical for App Inventor?  For example, can you provide a couple of examples of apps you  want to write  that do not work with the orientation sensor and require the Gyro?  Having those examples would be help elevate the priority of implementing Gyro in our queue and help the person implementing it in knowing what to aim for.

(3) My initial impression is to agree with José that the quickest way to get this done is for someone in the AI open source community to implement it.    I appreciate your saying that you can't do this yourself.  But maybe you could find a friend to work with who knows Java. 

Thanks for pointing this issue out.

== Hal




ClickApp

unread,
Jul 12, 2014, 9:52:46 AM7/12/14
to app-inventor-o...@googlegroups.com
Thank you for your replies, Jose and Hal.

Hal, regarding your numbered notes.   Some responses.

(1) While I could be wrong about the latest 2014 Nexus 7, it looks to me that the manufacturer (aka. Google ultimitately) has removed the mag field sensor in the 2014 model.   I see online the 2013 model still has it through a youtube video of someone showing it.  As for myself, I have been hunting around for a Kitkat tablet and realized that it appears more and more manufacturers are selling cheap devices without the mag field sensor, some even with an accelerometer and nothing else, or a gyro and no mag field, etc.    Of course, this situation will tend to break the Orientation Software Sensor scenerio which AI2 supports (accel + mag sensors). 

(2) I already have two apps on the Google Play market which use your Orientation Sensor, and of course they work on two cellphones I have, and on a 2 year old Toshiba tablet which has all the sensors, but now I am looking for a Kitkat device too for testing.   May many other apps are on the Google Play and other Android app markets which make use of the software orientation sensor and mag field sensors, from games to compasses to you name it, they got it.  These will all break as what I think are cheapened Android knockoffs from overseas are being sold by the likes of Sears and other companies here.  But, the trend is toward including Gyros instead, but I see this is displacing some of what were standard sensors for years before this.  So, again, support of the gyro in AI2 would be just as critical as why you have the Orientation Sensor there. 

(3) I understand your desire to build the community to support AI2, and I may get more involved over time, but meanwhile those of us who are not Java programmers (which is why we use AI2 in the first place - and AI2 is an extremely cool way to program) will have difficulty leaping into the mix, while the Gyro component is trully needed now.   Perhaps you have heard that Android is lagging behind Apple devices which have used Gyros for much longer, but now Gyros are catching on in the newest Android devices, but buyers beware they may lose out on other sensors like the magnetic field.     I think this is a trend to be aware of.  

Please do the research on the Android devices now on the market, and think about the ones priced for youngsters - these cheaper ones are missing what was once a standard set of sensors for Android, but gyros have risen up on them.  I do hope the gyro component addition might become a project on the board.   :)

Peter


ClickApp

unread,
Jul 12, 2014, 10:06:30 AM7/12/14
to app-inventor-o...@googlegroups.com

PS:  I should also point out that the input from gyroscopes is more accurate than from the software orientation sensor model.    This better accuracy much improves developers ability to write better performing apps that make use of motion of the device, for games, instruments, etc.   Looking to the Apple market you will see this is also the case because the gyro is what they use.  


ClickApp

unread,
Jul 15, 2014, 8:00:50 AM7/15/14
to app-inventor-o...@googlegroups.com

I do hope that the project will consider moving Gyroscope support onto the plate, because with so many new cheap android devices on the market not putting the magnetic sensor in them, it breaks the software orientation sensor, and the only alternative is to begin to support the gyroscope.    (And yes, some of the cheap android devices on the market don't even have a gyroscrope so then one is out of luck, both user and developer, but at lease if there is gyro support, one can can make a user setting for orientation sensor or gyro sensor, and if neither is supported, just tell the user to return that android device for a better equipped one.)  

Zipper Du

unread,
Jul 17, 2014, 7:57:57 AM7/17/14
to app-inventor-o...@googlegroups.com
Hi ClickApp

We already have developed the gyroscrope component on App Inventor.

And by using gyroscrope sensor and Google USB ADK component,we build a self-balancing robot.

PGB App

unread,
Jul 17, 2014, 8:23:11 AM7/17/14
to app-inventor-o...@googlegroups.com
Hello, I just saw this after a previous email/post, and thank you for letting the group know, I think this is awesome.  And your project is of course great!  :) 

So, pardon my ignorance, but AI2 developers, how does this fit into the AI2 project, far as when this could be made available? 

Many thanks for some insight.  



--
You received this message because you are subscribed to a topic in the Google Groups "App Inventor Open Source Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/app-inventor-open-source-dev/SG9wOp2v6_s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to app-inventor-open-so...@googlegroups.com.

James Slawson

unread,
Feb 13, 2015, 3:55:54 PM2/13/15
to app-inventor-o...@googlegroups.com
Hi Zipper Du,
Is this component published anywhere?  My app could greatly benefit from Gyroscope output data.
Reply all
Reply to author
Forward
0 new messages