Building Sensor-based Apps Windows Phone Windows Store Windows Desktop

Slides:



Advertisements
Similar presentations
Novel © 2002 emed-at software This presentation will give a brief overview of the novel emed-at software.
Advertisements

TouchDevelop Chapter 5-7 Chapter 5 Audio Chapter 6 Camera, Graphics and Video Chapter 7 Sensors Mengfei Ren.
Understanding Mobile App Development Concepts and Working with APIs Lesson 6.
Use it Free: Instantly Knowing Your Phone Attitude Pengfei Zhou*, Mo Li Nanyang Technological University Guobin (Jacky) Shen Microsoft Research.
Use it Free: Instantly Knowing Your Phone Attitude Pengfei Zhou*, Mo Li Nanyang Technological University Guobin (Jacky) Shen Microsoft Research.
PATRICK ARMSTRONG Pervasive Gaming as a means of reminding the user of daily events.
Looking out at the Night Sky What questions do you have?
© Copyright 2011 MicroStrain Inc. High Performance Miniature Inertial Measurement Systems MicroStrain Inc Mike Robinson
The Accelerometer CSE 391 Fall 2011 Tony Scarlatos.
Augmented Reality COMP 1701 Nicholas Alberts. What is Augmented Reality? Augmented reality is a combination of a real life scene from a person, and a.
Windows 8 Tips & Tricks for XAML based Windows Store App Ronnie Saurenmann Microsoft
Get Moving With Core Motion!
Mobile Technology for Real Property Assessment Tax Assessor’s Office Davie County, North Carolina.
Grading for ELE 5450 Assignment 28% Short test 12% Project 60%
Session 1.1. Windows Phone Topics Session 1.1 Windows Phone The Windows Phone Device.
Windows 8 empowers you to build apps that can seamlessly adapt to your customer’s environment using sensors and location.
The Accelerometer and Gyroscope
The Visual Display Transform for Virtual Reality Cyrus Moon Computer Integrated Surgery II ( )
Using Maps with Photos. When used together, maps and photos can give us a very good idea of what an area is like. The map may show us the overall pattern.
Win8 on Intel Programming Course Modern UI : Sensors Cédric Andreolli Intel Software.
Cosc 5/4730 Augmented Reality. What is Augmented Reality? Generally: – Using a phone/tablet/glasses/smartwatch/etc – And one more “sensors” GPS – Location.
EEC-492/592 Kinect Application Development Lecture 10 Wenbing Zhao
What’s new for Windows 8 Devs Part 3 Lewis Benge Devices & Integration Team TBWA\Digital Arts Network DEV216.
Introduction to Robotics and ASU Robots Yinong Chen (Ph.D.) School of Computing, Informatics, and Decision Systems Engineering.
Rotations and Translations
Smartphone Overview iPhone 4 By Anthony Poland 6 Nov 2014.
CS 104 October 26, 2011 App Inventor. Agenda Discuss guest speakers Discuss quiz Finish Paint Pot Discuss concepts from Chapters 2 & 3 Mole Mash (if time.
Indoor Localization Carick Wienke Advisor: Dr. Nicholas Kirsch University of New Hampshire ECE 791H Using a Modern Smartphone.
Lecture # 9 Hardware Sensor. Topics 2  SensorManger & Sensor  SensorEvent & SensorEventListener  Example Application.
App Inventor You are going to use App Inventor to make an application for your phone Smart Phone ‘s can hold many entertaining apps due to the amount of.
Tinker CAD Lesson STEM LAB Sherman Ortiz. WORK SPACE  This is your work area.  Right click: To look around object.  Left click: - drag objects inside.
ReachFood ASMITA SHINDE. Index  Assumptions  Features  Technology  App Structure  Screenshots  Future Enhancements  References.
Sensors – Part I SE 395/595.
CS378 - Mobile Computing Sensing and Sensors Part 2.
INEMO™ Demonstration Kit DOF (Degrees of Freedom) platform  The STEVAL-MKI062V2 combines accelerometers, gyroscopes and magnetometers with pressure.
Phonegap Bridge – Compass API CIS 136 Building Mobile Apps 1.
2014 Defense Health Information Technology Symposium – Meeting Mobile App 1. Download the DHA Events App to your device. This can be found in the AppStore.
ScanShot : Detecting Document Capture Moments and Correcting Device Orientation Jeungmin Oh, Woohyeok Choi, Joohyun Kim, Uichin Lee (Dept. of Knowledge.
Touchdevelop api api gyroscope measure device rotation rate Disclaimer: This document is provided “as-is”. Information and views expressed in this document,
Source: Computer Vision and Pattern Recognition Workshops (CVPRW), 2010 IEEE Computer Society Conference on Author: Paucher, R.; Turk, M.; Adviser: Chia-Nian.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 6B Methods (Tutorial)
December 19, Bring the Outside World Into Your Game Computer generated image of water balloon fight Real time image from side window Composite image.
Novel © 2004 emed-at software This presentation will give a brief overview of the novel emed-at software.
Sensors in android. App being more applicable Keeping track of your heart beat while jogging. Pointing the phone camera towards the night sky to know.
Double click here to add event title Double click here to add event date Double click here to add event time Double click here to add event location.
App Inventor You are going to use App Inventor to make an application for your phone Smart Phone ‘s can hold many entertaining apps due to the amount of.
1.Accelerometer:Accelerometer in an iPhone. Definition: An accelerometer is a sensor which measures the tilting motion and orientation of a mobile phone.
Sensors For Mobile Phones  Ambient Light Sensor  Proximity Sensor  GPS Receiver Sensor  Gyroscope Sensor  Barometer Sensor  Accelerometer Sensor.
After viewing information about the Elements and Principles of Design from the powerpoint presentations, type the Element or Principle that you thing best.
App Inventor You are going to use App Inventor to make an application for your phone Smart Phone ‘s can hold many entertaining apps due to the amount of.
App Inventor You are going to use App Inventor to make an application for your phone Smart Phone ‘s can hold many entertaining apps due to the amount of.
? Is my application available? Is my application performing? Is my application succeeding?
Make an information leaflet about what the sensors do in a Smart Phone for people over 65 years of age. You can use PowerPoint, Word or Publisher.
CPE 490/590 – Smartphone Development
Phonegap API & Phonegap Bridge CIS 136 Building Mobile Apps 1.
Star Map 3D+: Guide to the Night Sky, Planets, Constellations, and Astronomy.
Chapter 8 Sensors and Camera. Figure 08.01: The Accelerometer can gauge the orientation of a stationary device.
The Doodlz app enables you to paint by dragging one or more fingers across the screen. The app provides options for setting the drawing color.
Advanced Windows 8 App Development Using JavaScript Jump Start Exam Prep M2: Hardware and Sensors Michael Palermo Microsoft Technical Evangelist.
Android Android Sensors Android Sensors: – Accelerometer – Gravity sensor – Linear Acceleration sensor – Magnetic Field sensor – Orientation.
Mobile phone sensors. Sensors Sensors gyroscope The gyroscope is a sensor that can provide orientation information as well. This sensor can tell how.
Sensors in Android.
5/5/2018 1:12 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS.
What this activity will show you
Inertial Measurement Unit (IMU) Basics
Fusion, Face, HD Face Matthew Simari | Program Manager, Kinect Team
How To Use Sticky Notes.
Android Topics Sensors Accelerometer and the Coordinate System
Device,Network, Vibration, Console, Accelerometer
Device,Network, Vibration, Console, Accelerometer
Presentation transcript:

Building Sensor-based Apps Windows Phone Windows Store Windows Desktop Tim Binkley-Jones manning.com/binkley

Sky Map for Windows Phone SkyMap is an amazing planetarium for your windows phone. It enables you to point your phone at the sky and see what stars, constellations, planets or deep space objects are out there in real time.

Where is my server? Where is the conference room? HERE City Lens Simply hold up your phone as though taking a photo, and HERE City Lens overlays the best shops, restaurants and points of interest right on your display.

Windows 8 Windows RT Windows Runtime Windows Store Windows Desktop Windows What??? Windows RT Windows 8 and Windows RT are two different operating systems that both use the Windows 8 kernel. Windows Runtime (a.k.a WinRT) is the set of common APIs used to interact with the Windows 8 kernel. The Windows 8 kernel and the Windows Runtime APIs have been built to run on both Intel x86 based PCs and ARM based devices. Windows Store applications use the Windows Runtime and only the Windows Runtime. Windows Store applications run on both Windows 8 and Windows RT. Windows Desktop applications are the same Windows applications that you are familiar with – just a new name. Only run on Windows 8. Desktop applications can also use the Windows Runtime APIs.

Windows Phone 8 an upgrade of Windows Phone 7 both and a slimmed down version of Windows 8 is an upgrade of Windows Phone 7 What about Windows Phone 8? In the Windows Phone 8 SDK there are two separate Sensor APIs. The APIs found in Microsoft.Devices.Sensors were originally part of the Windows Phone 7 SDK and have been brought forward to Windows Phone 8. The second Sensor API, found in the Windows.Devices.Sensors comes from the Windows 8 Runtime that the Windows Phone shares with the Windows 8 operating system.

Image taken from the MSDN article “Windows Phone API reference” The API surface area of Windows Runtime is very large, with over 11,000 members. This is represented by area 2 in the above diagram and consists of approximately 2,800 members. These are represented by area 3 in the diagram and total about 600 members. Image taken from the MSDN article “Windows Phone API reference” http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff626516(v=vs.105).aspx

Taken from the MSDN documentation for the Windows Runtime Accelerometer class

Taken from the MSDN documentation for the Windows Runtime Geolocator class

Taken from the MSDN documentation for the Windows Runtime LightSensor class

Available Sensors Camera, Microphone Geolocator LightSensor Accelerometer, Gyrometer Compass, Inclinometer, OrientationSensor Camera and microphone do not have shared APIs. Geolocator is service over the GPS and location database. It will use cell towers, ip addresses, and GPS. Compass, Inclinometer, and OrientationSensor are also services over sensors.

Each of the sensors reports data relative to the x, y, z coordinate system defined by the Windows Phone device. The device’s coordinate system is fixed to the device, and moves as the phone moves. The x axis extends out the sides of the device, with positive x pointing to the right side of the device, and negative x pointing to the left side of the device. The y axis runs through the top and bottom of the device, with positive y pointing toward the top. The z axis runs from back to front, with positive z pointing out the front of the device. The coordinate system used by the sensors doesn’t necessarily match the coordinate system used by other APIs. One example is the coordinate system used by XAML. In portrait mode XAML, the y axis points in the opposite direction, with positive y pointing out the bottom of the device.

<PropertyGroup> <TargetPlatformVersion>8.0</TargetPlatformVersion> </PropertyGroup> What about Windows Desktop? Using the Windows Runtime API’s in a Windows Desktop application Manually edit project file, add reference to core, add reference to System.Runtime façade

For more details, see the MSDN article titled C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\ .NETFramework\v4.5\Facades\System.Runtime.dll For more details, see the MSDN article titled “Managed desktop apps and Windows Runtime”

A static factory method that returns a sensor instance. Member Type Description GetDefault Method A static factory method that returns a sensor instance. GetCurrentReading Returns a read-only object containing the currently available sensor data. ReadingChanged Event An event raised when ever the current reading changes. ReportInterval Property Specifies how often the sensor reads new data. The data returned by the GetCurrentReading will only change once every time interval. MinimumReportInterval A read-only value specifying the smallest value that can be passed set in the ReportInterval property. The Accelerometer, Compass, Gyrometer, Inclinometer and OrientationSensor do not share a common base class, the all have a number of identical properties, methods, and events

The acceleration along the each axis in g’s. Accelerometer The acceleration along the each axis in g’s. public sealed class AccelerometerReading { public double AccelerationX { get; } public double AccelerationY { get; } public double AccelerationZ { get; } public DateTimeOffset Timestamp { get; } }

The accelerometer measures the acceleration component of the forces being applied to a device. Note that acceleration due to gravity isn’t reported by the sensor. Unless the device in is free fall, forces are always being applied to a device. The Accelerometer reports numbers in terms of the constant g, which is defined as the acceleration due to Earth’s gravity at sea level. The value of g is -9.8 m/s2. When a device is at rest lying on a table, the table is exerting a force on the device that offsets the pull of gravity. The Accelerometer measures the acceleration of the force the table applies. When the device is falling, the accelerometer reports zero acceleration

When you move a device, you apply a force along the direction you want the device to move. The force causes the device to accelerate, acceleration changes the velocity of the device, and it starts to move. Let’s say your phone is resting flat face up on the surface of a table at point A. Now you give your device a modest push so that it slides along the surface to point B. The initial push is a moderate force in the positive X axis. After you release the device, allowing it to slide, your initial force stops, and the force due to friction begins to slow down the device until it stops moving. Figure 10.6 shows the values reported by the accelerometer in this scenario. The numbers are somewhat contrived, as real numbers will vary based on how hard the initial push is, and the amount of friction between the phone and the surface it’s resting upon.

The angular velocity, in degrees per second, about each axis. Gyrometer The angular velocity, in degrees per second, about each axis. public sealed class GyrometerReading { public double AngularVelocityX { get; } public double AngularVelocityY { get; } public double AngularVelocityZ { get; } public DateTimeOffset Timestamp { get; } } The Gyrometer sensor reports how quickly the device is turning on one or more of its axes. The rotational velocity is reported in degrees per second, and when a device is rotated in a complete circle it’ll rotate 360 degrees. The values are reported with counterclockwise being the positive direction. The Gyrometer only reports turning motion around an axis and if the device is held still, the sensor will report values of zero. If the device is moved from point A to point B without any twisting motion, the Gyrometer will also report zero. The Gyrometer reports values with the GyrometerReading struct. Rotational velocities are read from the GyrometerReading through the AngularVeclocityX, AngularVelocityY, and AngularVelocityZ properties that break absolute movement into rotation about the x, y, and z axes.

Compass Heading - the angle between the magnetic field, and the direction the device is pointed public sealed class CompassReading { public double HeadingMagneticNorth { get; } public double? HeadingTrueNorth { get; } public DateTimeOffset Timestamp { get; } } The Compass is useful when an application needs to know which direction a device is pointed relative to the real world. The Compass reports direction relative to the Magnetic North Pole. This information is useful for applications such as the astronomy application we discussed earlier, where the application updates the display based on the direction the user is facing. The compass is also useful in motion-sensitive applications that need to know when a device is rotated.

The Compass senses the strength and direction of the Earth’s magnetic field. If the compass detects that a device is aligned with the Earth’s magnetic field, then it knows that the device pointed, or headed, north. If a device is not aligned with the magnetic field, then the compass measures the device’s heading - the angle between the magnetic field, and the direction the device is pointed,

However the Earth’s Magnetic North Pole is not in the same location as the Earth’s actual North Pole. Not only are the two poles not in the same location, the Magnetic North Pole is constantly moving about. Each year the Magnetic North Pole shifts approximately 25 miles. As you might have guessed, the HeadingMagneticNorth property measures the device’s heading relative to the Magnetic North Pole. The HeadingTrueNorth property measures the device’s direction relative to the actual North Pole. The difference between the two heading measurements is called magnetic declination.

Inclinometer and Orientation Sensor Rotation around each access public sealed class InclinometerReading { public float PitchDegrees { get; } public float RollDegrees { get; } public float YawDegrees { get; } public DateTimeOffset Timestamp { get; } } Rotation matrix and quaternion Unlike the other sensors we’ve covered so far in this chapter, the Inclinometer and OrientationSensor are not hardware-based sensors. These two classes are wrappers around the Accelerometer, Compass, and Gyrometer. Instead of sensing data from hardware, the Inclinometer and OrientationSensor consume data from the other sensors and perform some convenient number crunching. The Inclinometer class reports the results of its data analysis in the InclinometerReading class. The InclinometerReading class reports Yaw, Pitch, and Roll values. The OrientationSensor class delivers data via the OrientationSensorReading class, which provides both a rotation matrix and a quaternion that can be used for coordinate mapping public sealed class OrientationSensorReading { public SensorQuaternion Quaternion { get; } public SensorRotationMatrix RotationMatrix { get; } public DateTimeOffset Timestamp { get; } }

Real world point: (0, 10, 0) Relative point: (0, 10, 0) To understand the uses of the Inclinometer and the OrientationSensor you need to understand the frame of reference, or coordinate system for both the real world and the device. These two classes assume a real-world coordinate system where y points due north, z points straight up, and x points due east. When the device is lying flat, face up, with the top of the device pointing north, the device’s frame of reference matches the real world frame of reference. An object at point (0, 10, 0) in the world frame will have the same coordinates in the device frame Real world point: (0, 10, 0) Relative point: (0, 10, 0)

Real world point: (0, 10, 0) Relative point: (-10, 0, 0) When the device is rotated, its frame of reference no longer matches the real world frame of reference. If the top of the device lying flat is rotated to point east, the device is considered to be rotated 270 degrees. The inclinometer reading will have a Yaw reading of 270 degrees. The Yaw, rotation about the z axis, is read as the counterclockwise angle between the two y axes. Now the device’s y axis is pointing east and the x axis is pointing south. Again, consider an object at the coordinate (0, 10, 0) in the world frame. This same object will have the coordinates (-10, 0, 0) in the device frame. Real world point: (0, 10, 0) Relative point: (-10, 0, 0)

Real world point: (0, 10, 0) Relative point: (-10, 0, 0) With the top of the device still pointed east, raise the top of the device until it’s in the standing portrait orientation with the back of the device facing east. This is shown in figure 10.12. In this case you’ve rotated the device frame about the x axis and changed the Pitch of the device. The inclinometer reading will still have a Yaw reading of 270 degrees, but will now also have a Pitch reading of 90 degrees. The Pitch, or rotation about the x axis, is read as a counterclockwise angle. Now the device’s y axis is pointing up toward the sky, aligned with the world frame’s z axis. The device’s z axis is pointing to the west. The device’s x axis is still pointing south. Again, consider an object at the coordinate (0, 10, 0) in the world frame. This same object will still have the coordinates (-10, 0, 0) in the device frame because changing the pitch didn’t change the direction of the device’s x axis. When working with the InclinometerReading, you must remember that the Yaw, Pitch, and Roll values are order-dependent. To translate a point in one frame of reference to a point in another frame of reference, you must apply Yaw first, followed by Pitch, then by Roll. Real world point: (0, 10, 0) Relative point: (-10, 0, 0)

Building Sensor-based Apps Windows Phone Windows Store Windows Desktop Tim Binkley-Jones manning.com/binkley