23
Industrial project (234313) Building Indoor Maps by Crowdsourcing Students: Mohammed Gara Michael Margolin Supervisors: Dan Vardi Constantine Elster

Industrial project (234313) Building Indoor Maps by Crowdsourcing Students: Mohammed Gara Michael Margolin Supervisors: Dan Vardi

  • Upload
    ahanu

  • View
    26

  • Download
    4

Embed Size (px)

DESCRIPTION

Industrial project (234313) Building Indoor Maps by Crowdsourcing Students: Mohammed Gara Michael Margolin Supervisors: Dan Vardi Constantine Elster. Project Objectives. - PowerPoint PPT Presentation

Citation preview

Page 1: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Industrial project (234313)

Building Indoor Maps by Crowdsourcing

Students: Mohammed Gara Michael Margolin

Supervisors: Dan Vardi Constantine Elster

Page 2: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Project ObjectivesToday’s GPS technology allow calculating and producing accurate positioning and tracking of the movement path in open environments.On the other hand …Inside a building or any dense urban environment, GPS has communication problems and it can’t help.So, the goals of this project was to:

Create android application which turns standard cellular phone into an accurate pedestrian tracking device, based only on low accuracy inertial sensors such as present on most of the modern cellular phones.

Implement recording server for gathering positions data from multiple devices running the tracking application described above, and display the gathered information graphically.

Page 3: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Demonstration

Page 4: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Experiment resultso The experiments were made on Samsung Nexus 4 device and consisted of

different walk scenarios in intention to test the aspects of the algorithm and its accuracy.

o The average distance from the real (known) path was calculated using the following algorithm:PointToBrokenLineDistance (p – point, L – set of line segments):

1. minDistance <- Infinity2. For each segment s in L:

• minDistance <- min(distance of p from s, minDistance) 3. PointToBrokenLineDistance <- minDistance

PointsToProkenLineAverageDistance (P – set of points, L – set of line segments):4. distanceSum <- 05. For each point p in P:

• distanceSum <- distanceSum + PointToBrokenLineDistance(p,L)6. PointsToBrokenLineAverageDistance <- distanceSum / |P|

Page 5: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Straight line testDistance relative

error)%( Distance absolute error (m)

Measured distance

(m)

Actual distance

(m)

Steps relative

error)%( Steps

absolute error

Measured number of

steps

Actual number of

stepsWalk speed

Test number

3.42000 1.71 51.71 50 1.40845 1 72 71 slow 1

0.86000 0.43 50.43 50 1.35135 1 73 74 slow 2

3.74000 1.87 48.13 50 1.40845 1 70 71 slow 3

2.34000 1.17 51.17 50 1.47059 1 69 68 average 4

1.96000 0.98 50.98 50 0.00000 0 70 70 average 5

1.66000 0.83 50.83 50 1.42857 1 69 70 average 6

1.26000 0.63 49.37 50 1.49254 1 66 67 average 7

3.06000 1.53 48.47 50 1.63934 1 62 61 fast 8

3.74000 1.87 48.13 50 0.00000 0 60 60 fast 9

3.60000 1.8 48.2 50 0.00000 0 60 60 fast 10

Page 6: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Right angles path test

Final position relative error

(%)

Final position absolute error

(m)

Average distance from real path (m)

Path length (m)

Test number

7.873618 2.834502 0.76292 36 1

2.659753 0.957511 0.56355 36 2

2.879021 1.036448 0.46709 36 3

0.99129 0.356864 0.6075 36 4

1.932337 0.695641 0.67954 36 5

Real

Test 1

Test 2

Test 3

Test 4

Test 5

Page 7: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Curved path test

Final position relative error

(%)

Final position absolute error

(m)

Average distance from real path (m)

Path length (m)

Test number

1.550316 0.403082 0.41041 26 1

4.601345 1.19635 0.46288 26 2

0.765093 0.198924 0.35491 26 3

0.840568 0.218548 0.28991 26 4

2.704194 0.703091 0.45175 26 5

Real

Test 1

Test 2

Test 3

Test 4

Test 5

Page 8: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

How it works?o Most of the modern cellular phones have accelerometer, gyroscope and

magnetometer sensors. For this reason we choose to use those three sensors in our implementation.

o The naive implementation would be calculation of second degree integral on the accelerometer data in three axes, which theoretically should produce current position relatively to the starting point.

o Because of the low accuracy of the sensors and the high accelerations when walkers foot hits the ground, such strategy produces totally wrong results.

o In our implementation the position calculation is done by a cyclic iterative algorithm, which is divided into three components:

1. Step detection algorithm: uses accelerations data and signals step ending combined with its length estimation.

2. Direction calculation algorithm: uses magnetometer and gyroscope sensors in order to produce current direction.

3. Position calculation algorithm: uses the two previous algorithms and combines their calculations into an accurate relative to the starting point position.

o The algorithm is executed on the device and constantly produces position updates based on the last known position, it’s state and current sensors’ reading.

Page 9: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Algorithm data flow

PositionAlgorithm

Step DetectionAlgorithm

Direction CalculationAlgorithm

Accelerations

Magnetometer& Gyroscope Data

Step Indications & Length

Direction

Sensors Data

Current Position

InstallationAngles

Sensor Errors

Page 10: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Step detection algorithmo This algorithm is based on “Pedometer” application, developed on previous semester

project, but it found to be too specific to be used as is:• This application has been written and tested on a single device and didn’t work as expected on

our device (nexus 4) as a result of sensor differences – almost a half of the steps haven’t been detected.

• It’s algorithm uses only current step acceleration data for step length calculation, so there is a difference in step length between right and left steps (this is negligible when walking in straight line, but has high influence on the results for our purposes).

o Step detection is done by acceleration pattern identification on the vertical and horizontal axes (forward and up) using acceleration borders.

o We found that installing the device on one side of the body creates bigger acceleration on this side’s leg step in comparison to the other leg step, so we change the borders dynamically and separately for even and odd steps (image on the next slide).

o Step length is calculated using ((accelerationDiff)0.25)*K formula which is an approximation to 2*h / tan(a), when accelerationDiff is a moving average on the difference between the maximum and the minimum accelerations during the step.

Page 11: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Step Detection Algorithmdynamic limits example

1 13 25 37 49 61 73 85 97 109121133145157169181193205217229241253265277289301313325337349361373385397409421433445

-4

-2

0

2

4

6

8

10

vertical acceleration upper border lower border

Page 12: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Direction calculation algorithmo This algorithm’s goal is to produce accurate heading indication in different

environments including those which have magnetic disturbances.o Combining between magnetometer and the gyroscope sensors in a way that

avoids each sensor’s weaknesses and maximizing each sensor’s advantages, is a quite hard mission:• The magnetometer is easily affected by magnetic disturbances in the environment, but

it’s error is local and it isn’t accumulated.• The gyroscope values can be integrated in order to receive angular change, but it is

accurate only for short time as it’s error is accumulated.o The solution is to use the magnetometer data when it is “clean” enough and to

calculate an integral on the gyroscope readings when there are too many magnetic disturbances.

o The question is: How do we know if the magnetometer reading values represent the true earth magnetic field or maybe a local magnetic field (disturbance)?

Page 13: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Disturbance detectiono One way to answer this question that we found, is to compare the measured

magnetic field power (magnetic vector size) to the known earth’s magnetic field power. If the measured magnetic power is too strong or too weak, there are magnetic disturbances.

o This is a quite good way to examine magnetic measurements, but there are still many scenarios on which this method won’t detect a disturbed magnetic field. For example, another field in the opposed direction with double power will show as correct. What else can we do?

o Another constant (in time) magnetic property is the magnetic vector inertial pitch (the angle between this vector and the horizon), so we can calculate the difference in the pitch angle between the measured values and the correct (known) pitch.

o We combined both methods into one single accurate method for detecting magnetic interferences in the received magnetic values.

Page 14: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Position calculation algorithmo Till now we have step ending indication, last step length and the current direction,

so in order to calculate the change in position we need to decide which angle best describes the step direction.

o The azimuth at the end of the step found to be the most accurate expression of the step direction:• Step direction is the azimuth of the vector connecting the leg behind to the leg in front

when they both on the ground, this is the direction when a leg strikes the ground. • Angular average has also been tried, and was less accurate.

Page 15: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Position correctiono We already seen that the magnetometer accuracy can suffer from various local

magnetic fields and in that case was decided to use gyroscope data instead.o The weakness of the direction calculation using gyroscope, is that it doesn’t rely on

any absolute data, so its error tend to accumulate.o When the user exits the magnetic interference area, there will be some error in

the calculated heading, that can be found by the difference between the integrated (gyroscope) angle and the real (magnetic) angle. We will call it θ.

o Indeed the direction calculation algorithm corrects it’s calculation and from now on it will return the true direction, but assuming gyroscope linear error accumulation, there is already an error in the position.

o We proposed a method of correcting this possible position error on the run, at the point of it’s detection.

Page 16: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Position correction

Page 17: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Calibrationo Calibration of the sensors need to be done to ensure accurate results:

• There is a constant error in the acceleration sensors.• We need to know the parameters of the real earth’s magnetic field in the area in order

to decide when there is an error in the measurements. o Android OS performs hard iron calibration (inner magnetic fields) for the

magnetometer sensor on the flight. The device should be rotated for a while in three axes to ensure correct results.

o For the other parameters, we have created calibration mode on the application level.

Page 18: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

System structure overviewo The system is composed of multiple android devices running the Pedotracker

application, sending position message to the recording server.o The position message contains the step counter, initial location and the

current position relative to that location.o The communication between the devices and the server is made above

TCP protocol.

Recording server

Page 19: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Pedotracker Android application designObjectFactory

Object FactoryActivities MainLogicSensorSampler RecordingServer CommDevice

UCTracking UCCalibration

PositionCalculationAlgorithm

StepDetectionAlgorithm DirectionCalculationAlgorithm

Page 20: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Pedotracker Android applicationo The SensorSampler runs on the main thread and when is activated, waits

for sensor updates and collects the provided data. Its purpose is to provide random access to the most recent sensors data.

o The MainLogic runs on the logic thread with 50 Hz cycle, collects triggers from the user interface, executes the UCTracking and the UCCalibration cyclic logic and updates interface if needed.

o UCTracking is responsible for the algorithm operation by supplying it with the needed data from all the various sources (preferences, calibration data and sensors data), calling its cycle logic and sending and/or saving its calculation results.

o RecordingServerCommDevice is executed on the communication thread and responsible for the connection maintenance and for sending messages to the server.

Page 21: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Recording server design

MultiServer

ClientsCollector

XYSeries

ConnectedClient

XYSeries

TracksChart

Page 22: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Recording servero XYSeries is a list of points that represents a track in two axes chart.o TracksChart is a track drawer which is synchronized with adding and

removing points to the XYSeries that it works with. The TracksChart draws multiple plots on one single chart.

o The MultiServer runs on the main thread and when is activated, waits for new clients (Android device) which try to connect to the server, and builds new sockets for communicating with each one of them. Also the MultiServer holds the TracksChart.

o The ConnectedClient represents one client (one Android device) and holds all the points (the full track) that the device visited in it’s XYSeries. At each new received point, the TracksChart is updated to show the changes in the main chart.

Page 23: Industrial project (234313) Building Indoor  Maps by Crowdsourcing Students:   Mohammed  Gara   Michael  Margolin Supervisors:  Dan  Vardi

Summaryo The purpose of this project was to study the feasibility of implementing an

accurate tracking device based only on low accuracy inertial sensors such as present on most of the modern cellular phones.

o It was shown that such implementation can be made and can have acceptable accuracy of the position calculation results.

o Further development option is to add a third axis (height) to the position algorithm. This can be very useful addition to the application for its intended environment - indoor.

o Possible derivatives of this project, can use the developed algorithm for tracking, mapping and navigation.

o This project exposed us to new fields of knowledge and experience, from learning to develop for android platform and understanding its API levels, physics of forces and body rotations, algorithmic calculations and more. We are pleased and satisfied from the project and its results.