jsug.at University of Technology Vienna October 25 th 2010 Android Sensors by Stefan Varga, Michal Kostic touchqode.com

Similar documents
Android Sensors. CPRE 388 Fall 2015 Iowa State University

Using the Android Sensor API

Android Sensors. XI Jornadas SLCENT de Actualización Informática y Electrónica

Objective. Android Sensors. Sensor Manager Sensor Types Examples. Page 2

Sensors & Motion Sensors in Android platform. Minh H Dang CS286 Spring 2013

Android Sensor Programming. Weihong Yu

Sensors. Marco Ronchetti Università degli Studi di Trento

E0-245: ASP. Lecture 16+17: Physical Sensors. Dipanjan Gope

Android Sensors. Mobile Applica1ons Jay Urbain, Ph.D. Credits:

App Development for Smart Devices. Lec #5: Android Sensors

Using Sensors on the Android Platform. Andreas Terzis Android N00b

ELET4133: Embedded Systems. Topic 15 Sensors

HP TouchPad Sensor Setup for Android

Mobile applications can benefit from being location-aware This mean to allow application to determine and manipulate location For example:

Developing Sensor Applications on Intel Atom Processor-Based Android* Phones and Tablets

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II)

Obsoleted chapter from The Busy Coder's Guide to Advanced Android Development

CS 403X Mobile and Ubiquitous Computing Lecture 6: Maps, Sensors, Widget Catalog and Presentations Emmanuel Agu

! Sensors in Android devices. ! Motion sensors. ! Accelerometer. ! Gyroscope. ! Supports various sensor related tasks

( Modified from Original Source at )

Android Programming Lecture 18: Menus Sensors 11/11/2011

Using the Adafruit Unified Sensor Driver. Created by Kevin Townsend

CSE476 Mobile Application Development. Yard. Doç. Dr. Tacha Serif Department of Computer Engineering Yeditepe University

Tegra Android Accelerometer Whitepaper

Android Concepts and Programming TUTORIAL 1

Designing An Android Sensor Subsystem Pitfalls and Considerations

Module 1: Sensor Data Acquisition and Processing in Android

Lab 1 (Reading Sensors & The Android API) Week 3

Sensor Fusion Mobile Platform Challenges and Future Directions Jim Steele VP of Engineering, Sensor Platforms, Inc.

06 Team Project: Android Development Crash Course; Project Introduction

Android. Learning Android Marko Gargenta. Tuesday, March 11, 14

Android Framework. How to use and extend it

Effective Use of Android Sensors Based on Visualization of Sensor Information

Fitness Motion Recognition

Location and Sensors

Android. Lecture 1. Learning Android Marko Gargenta. Friday, March 22, 13

Android Sensors This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. CC-BY Google

Sensors and Cellphones

Internal Services. CSE 5236: Mobile Application Development Instructor: Adam C. Champion Course Coordinator: Dr. Rajiv Ramnath

Programming Mobile Applications with Android

Performance issues in writing Android Apps

Kathy Au Billy Yi Fan Zhou Department of Electrical and Computer Engineering University of Toronto { kathy.au, billy.zhou }@utoronto.

Solar Shading Android Application v6.0. User s Manual

Motion Sensing with mcube igyro Delivering New Experiences for Motion Gaming and Augmented Reality for Android Mobile Devices

SENSORS ON ANDROID PHONES. Indian Institute of Technology Kanpur Commonwealth of Learning Vancouver

Making Android Motion Applications Using the Unity 3D Engine

Using Extensions or Cordova Plugins in your RhoMobile Application Darryn

Android app development course

Frequently Asked Questions (FAQs)

How to Convert 3-Axis Directions and Swap X-Y Axis of Accelerometer Data within Android Driver by: Gang Chen Field Applications Engineer

ANDROID. Programming basics

ECE 455/555 Embedded System Design. Android Programming. Wei Gao. Fall

Sensors CS 4720 Web & Mobile Systems

Selection and Zooming using Android Phone in a 3D Virtual Reality

Arduino & Android. A How to on interfacing these two devices. Bryant Tram

Pedometer Project 1 Mr. Michaud /

Introduction to Android Programming. Khuong Vu, Graduate student Computer Science department

Expert Android Apps Development

K.Prasanna NIT Rourkela,India Summer Internship NUS

Use It Free: Instantly Knowing Your Phone Attitude

MGL Avionics Compass operation and calibration

Applications of Magnetic Sensors for Low Cost Compass Systems

Mobilelogging: Assessing Smartphone Sensors for Monitoring Sleep Behaviour

WEARIT DEVELOPER DOCUMENTATION 0.2 preliminary release July 20 th, 2013

An inertial haptic interface for robotic applications

Implementing Positioning Algorithms Using Accelerometers

The 8 th International Scientific Conference elearning and software for Education Bucharest, April 26-27, / X

Indoor Positioning using Sensor-fusion in Android Devices

ELDERLY SUPPORT - ANDROID APPLICATION FOR FALL DETECTION AND TRACKING TEJITHA RUDRARAJU. B.E, Anna University, India, 2011 A REPORT

Mobile Fragmentation. FIA Aalborg, 10 May 2011 Philippe COUSIN WP2 Leader, ETSI Thanks to Cuihtlauac ALVARADO WP1 Leader, ORANGE

Android. Mobile Computing Design and Implementation. Application Components, Sensors. Peter Börjesson

Scripting Language Reference. SimpleBGC 32bit

Developing Android Apps for BlackBerry 10. JAM854 Mike Zhou- Developer Evangelist, APAC Nov 30, 2012

UNMANNED AERIAL VEHICLE (UAV) SAFETY SYSTEM USING ANDROID APP

Application Note IMU Visualization Software

Robot Perception Continued

International Journal of Advanced Research in Computer Science and Software Engineering

YOUR INTERACTIVE SECURITY

Graduate presentation for CSCI By Janakiram Vantipalli ( Janakiram.vantipalli@colorado.edu )

Introduction to NaviGenie SDK Client API for Android

How To Control Gimbal

Charith Pereral, Arkady Zaslavsky, Peter Christen, Ali Salehi and Dimitrios Georgakopoulos (IEEE 2012) Presented By- Anusha Sekar

Google Android: An Emerging Innovative Software Platform For Mobile Devices

Cookbook. Flash ios Apps. Christopher Caleb. 100 practical recipes for developing ios apps with Flash Professional and Adobe AIR PUBLISHING MUMBAI

A Web Service Platform for Building Interoperable Augmented Reality Solutions

ios SDK possibilities & limitations

ix3m Dive Computer Installable Apps Manual ver. 1.1

CS297 Report. Accelerometer based motion gestures for Mobile Devices

Basic Principles of Inertial Navigation. Seminar on inertial navigation systems Tampere University of Technology

Quick Start Guide ActiGraph GT9X Link + ActiLife

PROGRAMMING IN ANDROID. IOANNIS (JOHN) PAPAVASILEIOU OCTOBER

Android and OpenGL. Android Smartphone Programming. Matthias Keil. University of Freiburg

AUTOMATIC HUMAN FREE FALL DETECTION USING ANDROID

Android Development Tutorial. Nikhil Yadav CSE40816/ Pervasive Health Fall 2011

Tracking devices. Important features. 6 Degrees of freedom. Mechanical devices. Types. Virtual Reality Technology and Programming

8. Linear least-squares

ix3m Dive Computer Installable Apps Manual ver. 1.0

Tutorial 1. Introduction to robot

Real Time Control Framework Using Android

Information regarding the Lockheed F-104 Starfighter F-104 LN-3. An article published in the Zipper Magazine #48. December Theo N.M.M.

Transcription:

jsug.at University of Technology Vienna October 25 th 2010 Android Sensors by Stefan Varga, Michal Kostic touchqode.com

Why sensors? 2

3

4

Applications Resizing screen / tilt Environment adjustment of apps, user comfort Adjustment in cinema, prediction of movement Gaming AR AR Gaming AR Navigation Bar codes Geo tagging, grafitti, recomendations.. Network of objects, locations and people, 3D social Giant distributed sensor system Noise mapping.. And anything you can imagine 5

Presentation Outline 1. Introduction + API 2. Simple sensors 3. Position 4. Camera 5. About us touchqode.com 6

Android 3 rd in sales Operating System 2Q10 Units 2Q10 Market Share (%) Symbian 25,386.8 41.2 RIM BlackBerry 11,228.8 18.2 Android 10,606.1 17.2 ios 8,743.0 14.2 Microsoft Windows Mobile 3,096.4 5.0 Source: http://www.gartner.com/it/page.jsp?id=1421013 7

Overview of android phones from web sources - might not be complete, plus some brands have several versions of their phones with different hw setups! 8

API (I.) Package: android.hardware Classes: SensorManager android service Sensor specific sensor SensorEvent specific event of the sensor = data 9

API example setup public class MainActivity extends Activity implements SensorEventListener {.. private SensorManager sm = null; public void oncreate(bundle savedinstancestate) {.. sm = (SensorManager) getsystemservice(sensor_service); } protected void onresume() {.. List<Sensor> typedsensors = sm.getsensorlist(sensor.type_light); // also: TYPE_ALL if (typedsensors == null typedsensors.size() <= 0) error sm.registerlistener(this, typedsensors.get(0), SensorManager.SENSOR_DELAY_GAME); // Rates: SENSOR_DELAY_FASTEST, SENSOR_DELAY_GAME, // SENSOR_DELAY_NORMAL, SENSOR_DELAY_UI } } 10

API example processing event public class MainActivity extends Activity implements SensorEventListener {.. private float currentvalue; private long lastupdate; public void onsensorchanged(sensorevent event) { currentvalue = event.values[0]; lastupdate = event.timestamp; }.. } It is recommended not to update UI directly! 11

API example cleanup public class MainActivity extends Activity implements SensorEventListener { protected void onpause() { sm.unregisterlistener(this); } protected void onstop() { sm.unregisterlistener(this); }.. } 12

Light sensor Sensor.TYPE_LIGHT values[0] = ambient light level in SI lux units SensorManager s constants LIGHT_CLOUDY: 100 LIGHT_FULLMOON: 0.25 LIGHT_NO_MOON: 0.001 LIGHT_OVERCAST: 10000.0 (cloudy) LIGHT_SHADE: 20000.0 LIGHT_SUNLIGHT: 110000.0 LIGHT_SUNLIGHT_MAX: 120000.0 LIGHT_SUNRISE: 400.0 13

Proximity sensor Sensor.TYPE_PROXIMITY values[0]: Proximity sensor distance measured in centimeters (sometimes binary near-far) 14

Temperature sensor Sensor.TYPE_TEMPERATURE values[0] = temperature 15

Pressure sensor Sensor.TYPE_PRESSURE values[0] = pressure no constants 16

Position sensors 17

Magnetic sensor Sensor.TYPE_MAGNETIC_FIELD values[3] = in micro-tesla (ut), magnetic field in the X, Y and Z axis SensorManager s constants MAGNETIC_FIELD_EARTH_MAX: 60.0 MAGNETIC_FIELD_EARTH_MIN: 30.0 18

Accelerometer sensor TYPE_ACCELEROMETER Values[3] = m/s^2, measure the acceleration applied to the phone minus the force of gravity (x, y, z) GRAVITY_EARTH, GRAVITY_JUPITER, GRAVITY_MARS, GRAVITY_MERCURY, GRAVITY_MOON, GRAVITY_NEPTUNE 19

Orientation sensor TYPE_ORIENTATION Deprecated (use getorientation (float[] R, float[] result)) Values[3] (Azimuth, Pitch, Roll) angles 0-360 azimuth, rotation around the Z axis pitch, rotation around the X axis roll, rotation around the Y axis Different from plane yaw, pitch, roll (different axes and clockwise-ness) 20

Gyroscope sensor TYPE_GYROSCOPE Measure the orientation of a device Detect all rotations, but only few phones have it Values[] iphone gives radians/sec., and makes it possible to get the rotation matrix 21

Accelerometer vs. Gyroscope Accelerometer senses linear movement, but worse rotations, good for tilt detection, Does not know difference between gravity and linear movement, shaking, jitter can be filtered out, but the delay is added Gyroscope measure all types of rotation not movement does not amplify hand jitter A+G = both rotation and movement tracking possible 22

How to use the data the maths SensorManager.getRotationMatrix( matrixr, matrixi, matrixaccelerometer, matrixmagnetic); matrixr rotation matrix R device coordinates -> world's coordinates R t = R -1 matrixi - inclination matrix I rotation around the X axis getinclination (I) computes geomagnetic inclination angle in radians 23

How to use the data example float[] matrixr = new float[9]; float[] matrixi = new float[9]; SensorManager.getRotationMatrix( matrixr, matrixi, matrixaccelerometer, matrixmagnetic); float[] lookingdir = MyMath3D.matrixMultiply(matrixR, new float[] {0.0f, 0.0f, -1.0f}, 3); float[] topdir = MyMath3D.matrixMultiply(matrixR, new float[] {1.0f, 0.0f, 0.0f}, 3); GLU.gluLookAt(gl, 0.4f * lookingdir[0], 0.4f * lookingdir[1], 0.4f * lookingdir[2], lookingdir[0], lookingdir[1], lookingdir[2], topdir[0], topdir[1], topdir[2]); 24

Open GL The rotation matrix can be used with open GL Directly load into glloadmatrixf(float[], int) With some computations glulookat(..) 25

Special cases Unexpected results free fall north pole acceleration other sources of magnetic field present 26

Accelerometer noise - simple const float kfilteringfactor = 0.1f; //play with this value until satisfied float accel[3]; // previous iteration //acceleration.x,.y,.z is the input from the sensor accel[0] = acceleration.x * kfilteringfactor + accel[0] * (1.0f - kfilteringfactor); accel[1] = acceleration.y * kfilteringfactor + accel[1] * (1.0f - kfilteringfactor); accel[2] = acceleration.z * kfilteringfactor + accel[2] * (1.0f - kfilteringfactor); result.x = acceleration.x - accel[0]; result.y = acceleration.y - accel[1]; result.z = acceleration.z - accel[2]; Return result; 27

Accelerometer noise - notes If it is too slow to adapt to sudden change in position, do more rapid changes when angle(accel, acceleration) is bigger You can throw away single values that are way out of average. The acc does not have to equal g! Kalaman filters too complicated? 28

Calibration Phone laying on the table rarely gives [0, 0, -1] on accelerometer Adding negative vectors is not the right idea Useful solution is the use of rotation matrix 29

Apps to play with Any compass app I like the Marine Compass Sensor reading apps It s simple make your own Some are at androidsensors.com 30