waleedAhmad1 / google-glass-api

Automatically exported from code.google.com/p/google-glass-api
0 stars 0 forks source link

Develop Glass Standard Menu Controls #653

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Glass team should develop a standard hands-free control API that every 
developer should adopt. I just did this and it works very well and I will be 
happy if it is made standard for other developers so that every user who gets 
glass will be able to use this feature without having to re-learn another 
control a developer implemented.

New Feature:
A way of quickly selecting menus on screen without using the touchpad. Very 
easy compared to using the touchpad. 

Where will this be important?
When someone is born without right hand, when someone loses their hand either 
from a military mission, car accident, work place accident or disease. Also 
suitable for quick Menu selection so that the user won't have to raise their 
hands towards the touchpad.

What applications will this benefit?
Applications with menus or pick selection that requires the user to select and 
item with left, right, up, down, and select key. Also, an application that 
requires user to scroll up, down, left and right. 

For example, video game menus needs select menus, and the scrolling method for 
sliding a vertical slider up and down. Also for sliding a horizontal slider 
left or right.

What sensors are needed?
Accelerometer and the eye gesture sensor.

What functions are required?
For selecting menu, the following callback functions or something similar 
should be implemented:
onUpArrow(), onDownArrow(),onLeftArrow(),onRightArrow()

For scrolling/sliding sliders or scroll bars, the following callback functions 
or something similar should be implemented: 
onSliderUp(),onSliderDown(),onSliderLeft(),onSliderRight()

How does it work?
It works by using the accelerometer and the eye gesture(IR) sensor. For the 
accelerometer sensor, the Glass OrientationManager class seems to have every 
value we need. We need to get the heading and pitch of the glass. The pitch is 
for onUpArrow,onDownArrow && onSliderUp(),onSliderDown while the heading is for 
onLeftArrow(),onRightArrow() && onSliderLeft(),onSliderRight(). 

There should be a moveThreshold and also a updateTimeThreshold for the 
developer to modify. The moveThreshold is like a sensitivity filter that will 
be used to determine how fast the user should move head up,down, left or right 
before determining if the move is valid acceptable. If it is, we can then call 
onUpArrow,onDownArrow is called depending if we moved up or down. If head is 
moved right or left, and the move is considered to be valid, the  
onLeftArrow(),onRightArrow()  functions is called depending on if we moved left 
or right. 

We CAN'T listen to onLeftArrow(),onRightArrow() while listening to 
onSliderLeft(),onSliderRight(). So, we can have a Boolean that determines when 
we are in Selection Mode or Sliding/Scrolling Mode as both will interfere with 
each other. The default mode should be Selection Mode which is used to select 
menus by moving head up, down, left and right while the callback functions are 
being called. 

To enable Sliding/Scrolling Mode, the user will use Selection Mode to select 
the scroll bar they which to modify, then look at the screen and blink twice. 
Once the user blinks twice, the mode variable will switch to Sliding/Scrolling. 
Now, when the user moves their head up,  onSliderUp() function is called. 
There, the programmer can increase the scroll bar value or decrease it 
depending on the direction the user is moving their head.
When the user is done modifying the scroll bar, they can blink twice again and 
the Scroll Mode will be disabled while the Selection Mode will be re-enabled 
again.

Also, if the user blinks twice and we are in Sliding/Scrolling Mode but the 
user doesn't move head to any direction for 2 seconds, the Sliding/Scrolling 
Mode will disable right away and the Selection Mode should be re-enabled. 

The updateTimeThreshold is used just like the moveThreshold. It is used to 
determine how many times the API should read the sensor in a second. 
The API should have a way of reading or writing to these two values to 
calibrate the API. 

The biggest difference between Selecting && Sliding/Scrolling Mode is that each 
mode has different updateTimeThreshold && moveThreshold values. The 
Sliding/Scrolling Mode should be more sensitive, meaning that when the user 
moves their head a little bit, the slider call back functions should be called 
2 or 3 times to help smooth the increase and decrease of the scroll bar. 

The Selection Mode shouldn't be sensitive as it will be hard to select a menu 
if it is. In conclusion, during each Mode, the updateTimeThreshold and 
moveThreshold variables must be modified to make the Mode work properly. 

What inspired me to make something like this is the game I am working on and 
the result that came out of it. Also the touchpad Gesture API with TAP && 
SWIPE_RIGHT enum made me come up with these.

It took time to write this so I am expecting a good reply from the Glass Team.

Original issue reported on code.google.com by innocla...@gmail.com on 1 Jan 2015 at 10:58