sensors

Article Analyzing Gait in the Real World Using Wearable Movement Sensors and Frequently Repeated Movement Paths

Weixin Wang and Peter Gabriel Adamczyk * Department of Mechanical Engineering, University of Wisconsin–Madison, Madison, WI 53706, USA; [email protected] * Correspondence: [email protected]

 Received: 22 March 2019; Accepted: 22 April 2019; Published: 24 April 2019 

Abstract: Assessing interventions for mobility disorders using real-life movement remains an unsolved problem. We propose a new method combining the strengths of traditional laboratory studies where environment is strictly controlled, and field-based studies where subjects behave naturally. We use a foot-mounted inertial sensor, a GPS receiver and a barometric altitude sensor to reconstruct a subject’s path and detailed foot movement, both indoors and outdoors, during days-long measurement using strapdown navigation and sensor fusion algorithms. We cluster repeated movement paths based on location, and propose that on these paths, most environmental and behavioral factors (e.g., terrain and motivation) are as repeatable as in a laboratory. During each bout of movement along a frequently repeated path, any synchronized measurement can be isolated for study, enabling focused statistical comparison of different interventions. We conducted a 10-day test on one subject wearing athletic shoes and sandals each for five days. The algorithm detected four frequently-repeated straight walking paths with at least 300 total steps and repetitions on at least three days for each condition. Results on these frequently-repeated paths indicated significantly lower foot clearance and shorter stride length and a trend toward decreased stride width when wearing athletic shoes vs. sandals. Comparisons based on all straight walking were similar, showing greater statistical power, but higher variability in the data. The proposed method offers a new way to evaluate how mobility interventions affect everyday movement behavior.

Keywords: wearable sensor; gait analysis; gait variability; location tracking; pedestrian dead-reckoning

1. Introduction Treatment for musculoskeletal mobility disorders includes many products and rehabilitation strategies, but there is little sound assessment about how these affect individuals in their daily lives. Current research assessing outcomes and developing standards of care is based on either (i) focused, laboratory-based studies, or (ii) studies based on wearable sensors such as pedometers, accelerometers, and heart rate monitors in everyday life. Both approaches have drawbacks that make them inadequate for fully assessing the effects of interventions on mobility. Laboratory tests enable well-controlled comparisons of detailed data, but also impose unrealistic influences on subjects, such as social pressure to perform well, heightened attention, instructions for the walking task, etc. [1]. Furthermore, these tests require extensive infrastructure and are only available in limited locations to a small number of individuals [2]. On the other hand, long-term monitoring through field-based wearable sensors provides a minimally-altered window into everyday movement [2], but these data can be difficult to distill into generalizable knowledge because many influencing factors are left uncontrolled, such as terrain, weather, setting, and purpose of locomotion. Neither approach enables a thorough assessment of how interventions influence individuals’ movement.

Sensors 2019, 19, 1925; doi:10.3390/s19081925 www.mdpi.com/journal/sensors Sensors 2019, 19, 1925 2 of 17

In this paper, we propose an assessment method that combines the strengths of a controlled laboratory study and those of a more realistic wearable measurement in daily life. The key idea is to focus the wearable assessment on the most informative and repeatable everyday activities, and make a detailed comparison of movement during these specific activities. Our approach recognizes that a days-long record of movement may include a variety of behaviors including walking, standing, sitting, running, and more, which may be performed in a variety of settings including homes, offices, parks, sidewalks, stores, and others [3]. This variety calls into question the validity of comparisons that include all movements without checking for comparable conditions. Our core hypothesis is that this variety leads to high variability in movement metrics, which can be reduced by focusing on frequently-repeated movements. Our goal is to provide a method to identify these repeated movements and thereby eliminate irrelevant or confounding data, leaving a subset of highly repeatable movements that can be analyzed with laboratory-like confidence. The resulting analysis is intended for use in comparing mobility interventions such as different prostheses, orthoses, or rehabilitation programs to establish their relative effectiveness and clinical value.

1.1. Studying Mobility with Wearable Sensors Most approaches to studying movement with wearable movement sensors fall into two categories: (i) Comprehensive movement studies using sensors mounted on multiple individual segments of the body, and (ii) studies of bulk motion using single sensors, usually mounted on the waist. Multi-segment sensor networks estimate detailed motion of the skeleton using inertial sensors on different segments and an underlying skeleton model (e.g., XSens MVN [4] or LegSys [5]). Since movement sensors do not measure ground forces, they have sometimes been combined with force sensors in the shoes [6–8]. These techniques enable lab-like analysis using wearable sensors, but are inappropriate for long-term monitoring due to the need for daily mounting and charging of many sensors—from 5 to 17 or even more. Alternatively, single-sensor approaches typically focus on estimating macro-scale behavior such as number of walking steps or overall activity level; these measures can be informative in some circumstances [3,9–12], but can also be insensitive to changes in movement capacity or satisfaction [13,14]. Some single-sensor studies target finer gait characteristics like step length, turning frequency, or disease-specific outcomes [12,13,15,16], but these approaches still lack detail about foot and leg movement that can be important for understanding underlying biomechanical function. Efforts to focus on a middle-ground of achieving low burden to the user with relatively fine measured detail have focused on reconstructing gait kinematics from shoe-mounted inertial sensors [1,17–22]. This motion reconstruction provides a high-fidelity, model-free estimate of foot motion that can form the basis for analyses of gait stability and control and even losses-of-balance [1,23,24]. All these approaches are subject to significant scientific limitations when used to compare mobility conditions or experimental interventions using everyday data. Daily life contains a wide variety of activities [3], which may not all demonstrate the same movement characteristics. For example, walking to the morning bus is different from walking in a grocery store—different in purpose, urgency, terrain, surroundings, interactions, carried load, and more. In continuous monitoring with wearable sensors, such different contexts add variability to the recorded data. Furthermore, unique activities like participation in tours, hikes, or festivals could also be recorded, and existing analytical approaches would have no means of rejecting them. In the worst case, these real-world data sets could be so inclusive that their variability obscures important differences among mobility conditions. Even when they do differentiate, there is no way to be sure that observed differences are attributable to the conditions, rather than the uncontrolled circumstances of the data collection.

1.2. Laboratory-Like Mobility Analysis on Frequently-Repeated Paths Fortunately, within the great variability of everyday movement, certain components of the daily routine are repeated as regularly as controlled laboratory conditions. For example, an individual may walk from the same home to the same bus stop, or from the same parking lot to the same building Sensors 2019, 19, 1925 3 of 17 entry, or from the same workstation to the same break room, every day or even several times per day. Moreover, the motivation, terrain, and location are similar for these movements nearly every time they occur. This similarity suggests that in these frequently-repeated circumstances, most of the behavioral factors are as repeatable as in a controlled laboratory study. In this paper we propose a method to identify and analyze these frequently-repeated natural movements to assess the effects of different experimental interventions on gait. The paper describes the method and applies it to a simple comparison of two types of footwear, with the intention of future application to clinical mobility interventions. In the proposed method we use location data to isolate repeated paths from the person’s movement trajectory during days-long wearable recordings. The trajectory is reconstructed from global positioning system (GPS) location data, foot motion data from a shoe-mounted inertial movement sensor, and altitude data from a barometric pressure sensor. Data from all these sensors are combined through strapdown inertial navigation and sensor fusion algorithms. During each bout of movement along a frequently-repeated path, we isolate spatiotemporal parameters of walking [1,17–19,25] and any other synchronous measurements. Finally, we compare these measurements across different conditions of interest, such as before and after some form of intervention, or across multiple interventions such as different assistive devices. This approach enables the study of how these interventions affect everyday movement, without the challenges of a laboratory environment.

2. Materials and Methods

2.1. Overview The trajectory reconstruction method is based on a standard inertial navigation algorithm termed pedestrian dead-reckoning (PDR), which uses a shoe-mounted inertial measurement unit (IMU, including a 3-axis accelerometer, a 3-axis angular rate gyroscope, and optionally a 3-axis magnetometer). The algorithm integrates angular velocity and linear acceleration into position, and corrects drift errors using zero-velocity update (ZUPT) [26], zero-angular-rate update (ZARU) [27], GPS location, and barometric altitude (BA) through a 15-state Kalman smoother [26,28] (details in AppendixB). ZUPT is used to correct velocity and orientation drift by assuming that foot velocity is zero during each stance phase of walking, running, or standing. ZARU uses angular velocity to estimate gyroscope bias during long stationary periods, with the goal of reducing heading drift that cannot be corrected by ZUPT. GPS and BA are used to correct latitude/ and altitude errors. The Kalman smoother is used to fuse all available sensor readings and assumptions into a maximum likelihood estimate of the user’s location. The different corrections are fed into the Kalman smoother based on specific movement conditions, listed in Table1 and described below.

Table 1. Correspondence between different movement conditions and Kalman filter corrections.

Indoors Outdoors Movement Conditions Stationary Elevator Others Vehicle Others Kalman filter corrections ZUPT, ZARU Horizontal ZUPT, BA ZUPT GPS GPS, ZUPT

2.2. Using Outdoor GPS Data for Position Corrections GPS is a good reference for absolute position correction of inertial sensors during outdoor periods in the horizontal plane. In the vertical direction, GPS data is usually less accurate and therefore not usable. On the other hand, because barometric altitude is sensitive to weather conditions and can only be used for relative altitude change, an absolute reference in the vertical direction is still needed. We use altitude data over a grid with 10-m (1/3 arc second) resolution from the USA Geological Survey’s National Elevation Dataset [29] (a component of The National [30]) as the absolute altitude Sensors 2019, 19, 1925 4 of 17 Sensors 2019, 19, x FOR PEER REVIEW 4 of 17 reference.Map [30]) This as database the absolute covers altitude the United reference. States; This other database similar covers databases the United may be States; used inother other similar areas. For eachdatabases GPS locationmay be used fix, the in other altitude areas. is interpolated For each GPS from location the grid fix, the based altitude on the is latitudeinterpolated and longitude.from the gridIn addition, based on GPSthe latitude accuracy and degrades longitude. greatly inside of buildings and therefore cannot be used for indoor positionIn addition, correction. GPS accuracy The challenge degrades of greatly using inside GPS data of buildings is that a and GPS therefore receiver cannot can often be used receive for a locationindoor fix position indoors, correction. but we have The verychallenge limited of using knowledge GPS data of is its that accuracy; a GPS receiver thus, it can is very often di receivefficult a to separatelocation it from fix indoors, usable outdoor but we have location very fixes. limited Moreover, knowledge even of if its a receiveraccuracy; sits thus, still it inside is very of difficult a building, to its locationseparate fixesit from can usable wander, outdoor including location to locations fixes. Moreover, that appear even to if be a outdoorsreceiver sits on thestill map.inside In of our a method,building, using its anlocation erroneous fixes can GPS wander, location including for indoor to locations position that correction appear to can be outdoors be destructive, on the map. while recognizingIn our method, outdoor using locations an erroneous as indoor GPS without location position for indoor correction position merely correction degrades can be the destructive, trajectory accuracywhile forrecognizing a short time. outdoor Therefore locations our algorithmas indoor iswithout designed position to avoid correction the first circumstancemerely degrades as much the as possibletrajectory to maintainaccuracy for an overalla short acceptable time. Therefore accuracy. our Generally, algorithm outdooris designed GPS isto characterizedavoid the first by: (i) Lowcircumstance horizontal as dilution much as of possible precision to (HDOP,maintain a an measure overall of acceptable GPS sensitivity accuracy. to signalGenerally, timing outdoor error); GPS is characterized by: (i) Low horizontal dilution of precision (HDOP, a measure of GPS (ii) small time gaps between consecutive location fixes (e.g., a few seconds); (iii) small spatial separation sensitivity to signal timing error); (ii) small time gaps between consecutive location fixes (e.g., a few between consecutive location fixes; and (iv) location fixes that do not gather near a single building’s seconds); (iii) small spatial separation between consecutive location fixes; and (iv) location fixes that footprint. We used these characteristics to build a rule-based classification for recognizing indoor vs. do not gather near a single building’s footprint. We used these characteristics to build a rule-based outdoor GPS; details are presented in AppendixA and an example is shown in Figure1. Building classification for recognizing indoor vs. outdoor GPS; details are presented in Appendix A and an footprintsexample were is shown obtained in Figure from the1. Building footprints database were OpenStreetMap obtained from the [31 ],open which source is available database in manyOpenStreetMap geographical [31], areas. which is available in many geographical areas.

FigureFigure 1. Indoor 1. Indoor vs. vs. Outdoor Outdoor GPS GPS recognition. recognition. Indoor Indoor GPSGPS locationslocations are indicated by by blue blue circles; circles; outdooroutdoor GPS GPS locations locations are are indicated indicated by by red red crosses. crosses. Black Black lines lines are are building building footprintsfootprints downloaded fromfrom OpenStreetMap. OpenStreetMap. Indoor Indoor GPS GPS locations locations are are not not necessarily necessarily within within aa building’sbuilding’s footprint, which which makesmakes the the recognition recognition very very challenging. challenging. For For example, example,the the GPSGPS fixesfixes inin thethe green ellipse are are in in fact fact insideinside the buildingthe building on on their their south; south; using using these these erroneous erroneous data data for for position position correctioncorrection would ruin ruin the the indoorindoor trajectory trajectory reconstruction. reconstruction.

2.3.2.3. Special Special Movement Movement Conditions Conditions for for Di Differentfferent Corrections Corrections DuringDuring outdoor outdoor periods, periods, we we also also detect detect periods periods of vehicle of vehicle use, use, which which are definedare defined by (i)by high (i) high GPS speedGPS and speed (ii) absence and (ii) of absence large and of long-lastinglarge and long-lasti IMU movements.ng IMU movements. In a vehicle, In ZUPT a vehicle, is not ZUPT applied is sincenot the velocityapplied ofsince the the IMU velocity is not zero, of the but IMU GPS is updatesnot zero, are but sufficient GPS updates to correct are sufficient position drift. to correct During position indoor periods,drift. special During conditions indoor periods, such as special stationary conditions periods such and as elevators stationary provide periods additional and elevators corrections provide and challenges.additional Stationary corrections conditions and challenges. are defined Stationary by long-lasting conditions low are angular defined velocity, by long-lasting such as low while angular sitting velocity, such as while sitting or standing at a workstation. We use these stationary conditions to or standing at a workstation. We use these stationary conditions to adjust the gyroscope bias using adjust the gyroscope bias using measured angular velocity. Elevator use is detected by a rapid measured angular velocity. Elevator use is detected by a rapid change in barometric altitude without change in barometric altitude without large movements indicated by the IMU. In this case, the large movements indicated by the IMU. In this case, the assumption of zero foot velocity is violated in

SensorsSensors2019 2019, 19,, 19 1925, x FOR PEER REVIEW 5 5of of 17 17

assumption of zero foot velocity is violated in the vertical direction, so we use relative BA for vertical the vertical direction, so we use relative BA for vertical position correction. These special movement position correction. These special movement conditions can be detected by proper thresholding on conditions can be detected by proper thresholding on the respective signals mentioned above. the respective signals mentioned above. 2.4. Indoor Heading Angle Correction 2.4. Indoor Heading Angle Correction Outdoors, heading angle can be corrected by a series of GPS measurements, but because GPS is Outdoors, heading angle can be corrected by a series of GPS measurements, but because GPS is not reliable indoors it cannot correct heading inside buildings. Indoors, ZUPT is the primary correction, not reliable indoors it cannot correct heading inside buildings. Indoors, ZUPT is the primary but because heading error is only weakly correlated to velocity in stance phase [26,27], ZUPT is not correction, but because heading error is only weakly correlated to velocity in stance phase [26,27], adequateZUPT is to not stabilize adequate heading to stabilize over heading long durations. over long Withoutdurations. adequate Without correction,adequate correction, sensor bias sensor and numericalbias and integration numerical errorsintegration lead to errors the build-up lead to ofthe unbounded build-up of errors unbounded in heading errors and in consequently heading and in theconsequently estimated location. in the Theestimated magnetometer location. availableThe magn inetometer some IMUs available does give in some a heading IMUs measurement, does give a butheading magnetic measurement, field fluctuations but magnetic due to metallic field fluctuations objects (beams, due pipes, to metalli wires,c objects etc.) make (beams, this measurementpipes, wires, practicallyetc.) make unusable this measurement indoors. Therefore,practically anotherunusable means indoors. is requiredTherefore, to another correct means sensor is heading required and to estimatecorrect position sensor heading over the and long estimate indoor position periods over in a typicalthe long day. indoor periods in a typical day. WeWe address address this this problem problem by usingby using a Kalman a Kalman smoother smoother (Appendix (AppendixB) to B) propagate to propagate GPS dataGPS bothdata forwardboth forward and backward and backward in time, therebyin time, reducingthereby redu the errorcing growththe error time growth to half time of eachto half continuous of each periodcontinuous spent indoors.period spent The Kalmanindoors. smootherThe Kalman uses smoo thether same uses Kalman the same filter Kalman twice:once filter forward twice: once and onceforward backward and inonce time. backward A final positionin time. estimateA final positi is producedon estimate by averaging is produced the twoby averaging one-way estimates, the two eachone-way weighted estimates, by its uncertainty each weighted [28], whichby its uncertai grows withnty the[28], amount which ofgrows time with since the the amount last GPS of update. time Thesince forward the last filter GPS is update. more accurate The forward at first filter because is mo ofre shortaccurate integration at first beca timeuse after of short the lossintegration of GPS. Thus,time the after estimated the loss of position GPS. Thus, variance the estimated is lower, posi meaningtion variance forward is positionlower, meaning contributes forward more position to the smoothedcontributes position. more to The the forward smoothed Kalman position. filter The becomes forward less Kalman accurate filter as becomes the integration less accurate time grows,as the andintegration its estimated time position grows, varianceand its estimated grows with positi it; simultaneouslyon variance grows the backwardwith it; simultaneously Kalman filter timethe shrinksbackward (time Kalman until the filter next futuretime shrinks GPS update) (time unt andil itsthe estimated next future position GPS varianceupdate) alsoand reduces.its estimated As a result,position the forwardvariance position also reduces. estimate As contributes a result, the less forward to the smoothed position estimate position contributes as GPS-denied less periods to the progress,smoothed and position the backward as GPS-denied estimate contributesperiods progress, more (Figure and the2). backward The smoothed estimate position contributes is statistically more the(Figure best estimate 2). The insmoothed terms of position the least is mean statistically squared the errors. best estimate in terms of the least mean squared errors.

FigureFigure 2. 2.Comparison Comparison of of (a ()a forward) forward (blue (blue dashed dashed line), line), backwardbackward (red(red dash-dot),dash-dot), and smoothed (yellow(yellow solid) solid) position position and and (b ()b their) their standard standard deviations deviations during during a a 2 +2+hour hour indoorindoor period.period. The subject enteredentered the the building building from from the norththe nort (roundh (round dot ondot the on left the graph), left graph) stayed, stayed more than more 2 hthan in the 2 h building in the andbuilding left from and the left south from (star the south on the (star left graph).on the left It cangraph) be. seen It can that be forwardseen thatfilter’s forward position filter’s isposition accurate is at firstaccurate but graduallyat first but driftsgradually counter-clockwise; drifts counter-clockwise; the backward the backward filter’s position filter’s position is accurate is accurate at the end at butthe drifts end clockwisebut drifts inclockwise reverse in time. reverse The time. smoothed The smoothed position followsposition the follows forward the positionforward atposition first and at graduallyfirst and shifts gradually to the backwardshifts to position,the backward maintaining position, a smaller maintaining standard a smaller deviation standard throughout. deviation Note thatthroughout. the standard Note deviations that the standard on the right deviations graph are on estimatesthe right graph from the are Kalman estimates filter from and the smoother, Kalman wherefilter only and theirsmoother, relative wher magnitudee only their is important.relative magnitude is important.

Sensors 2019, 19, 1925 6 of 17 Sensors 2019, 19, x FOR PEER REVIEW 6 of 17

2.5. 2.5.Finding Finding Repeated Repeated Paths Paths To findTo find repeated repeated movements movements of the of theperson, person, we wefirst first discretize discretize the thereconstructed reconstructed trajectory trajectory by by stancestance phases phases during during walking walking and and by byintermittent intermittent GPS GPS waypoints waypoints when when the the subject subject is is in in a vehicle. We We thenthen simplifysimplify the the discretized discretized trajectory trajectory using using the Ramer-Douglas-Peuckerthe Ramer-Douglas-Peucker algorithm algorithm [32] in [32] which in the whichdistance the distance parameter parameter is set to is 1 set m. to This 1 m. algorithm This algorithm combines combines sequential sequential location location readings readings to reduce to the reducepoint the density point ofdensity a trajectory. of a trajectory. Then we useThen a modifiedwe use a Visvalingam’s modified Visvalin algorithmgam’s [ 33algorithm] to further [33] simplify to furtherthe trajectoriessimplify the and trajectories identify straight and identify segments. straight The modified segments. Visvalingam’s The modified algorithm Visvalingam’s recursively algorithmdeletes recursively any point deletes at which any the point angle at formedwhich the by angle itself formed and its by two itself neighbors and its two is above neighbors a specified is above“straightness” a specified threshold “straightness” (here setthreshold to 2.85 radians). (here set Segments to 2.85 longerradians). than Segments a specified longer length than threshold a specified(here 15length m) are threshold picked out(here as 15 straight m) are walking picked trajectories.out as straight An walking example trajectories. of an original An trajectory example and of its an originalstraight-segment trajectory approximationand its straight-segment is shown inapproximation Figure3a. is shown in Figure 3a. WithinWithin the theresulting resulting set setof straight of straight trajectory trajectory segments, segments, we weidentify identify groups groups of segments of segments that that occuroccur in the in thesame same location location and andwalking walking direction. direction. We define We define a curve a curve distance distance incorporating incorporating parallel, parallel, perpendicularperpendicular and andangular angular difference differencess [34] [ (see34] (see Figure Figure 3b)3 tob) evaluate to evaluate the thespatial spatial separation separation between between eacheach pair pair of segments. of segments. Segments Segments in the in same the same locati locationon are grouped are grouped into intoa cluster a cluster such such that thatfor each for each segment,segment, there there is at is least at least one oneother other segment segment in th ine same the same cluster cluster for which for which the distance the distance between between them them is withinis within a threshold a threshold (here (here set to set 0.2, to 0.2,dimensionles dimensionless).s). We Weretain retain clusters clusters only only if they if they contain contain enough enough stridesstrides to make to make a robust a robust statistical statistical comparison comparison acro acrossss conditions conditions (here (here 300 300strides strides per percondition condition with with occurrencesoccurrences on at on least at least three three days days per percondition). condition). Future Future work work could could elaborate elaborate this thisand andother other curve curve simplificationsimplification and and matching matching techniques techniques to to identify otherother trajectoriestrajectories of of interest, interest, such such asstairs, as stairs, turning, turning,specific specific locations, locations, etc. etc.

FigureFigure 3. Curve 3. Curve simplification simplification and anddistance. distance. (a) Simplification (a) Simplification result result of a ofsample a sample path: path: the original the original trajectorytrajectory before before discretization discretization is indicated is indicated by th bye thin the thinred redcurve, curve, the thestraight straight segments segments separated separated fromfrom the original the original curve curve are indicated are indicated by bold by bold blue blue lines lines and andblack black markers. markers. Typical Typical straight straight walking walking trajectoriestrajectories in hallways in hallways are singled are singled out after out after curve curve simplifications. simplifications. (b) Definition (b) Definition of “curve of “curve distance”, distance”, for assessingfor assessing spatial spatial separation separation of two of twopaths, paths, length lengthss L1 (shorter) L1 (shorter) and andL2 (longer). L2 (longer). Curve Curve distance distance is a is a compositecomposite of: Parallel of: Parallel distance distance (distance (distance between between two two segments’ segments’ starting pointspoints alongalong the the longer longer path); path);perpendicular perpendicular distance distance (distance (distance of theof the start star andt and end end of L1 of fromL1 from the linethe line of L2); of andL2); angularand angular distance distance(angle (angle between between path path directions, directions, including including progress progress direction, direction, times times L1). L1).

2.6. Statistical Comparison of Conditions along Repeated Paths

Sensors 2019, 19, 1925 7 of 17

Sensors 2019, 19, x FOR PEER REVIEW 7 of 17 2.6. Statistical Comparison of Conditions along Repeated Paths For statistical analysis, gait parameters and other measures of interest are pooled by condition for Foreach statistical cluster of analysis, path segments. gait parameters Here, we and recons othertruct measures foot motion of interest anew are for pooled each segment by condition in the forremaining each cluster clusters, of path using segments. only acceleration Here, we reconstruct and angular foot velocity motion data anew from for the each IMU segment to avoid in the any remainingdiscontinuity clusters, or distorti usingon only due acceleration to GPS or BA and corrections. angular velocity We compute data from stride the length, IMU to stride avoid speed, any discontinuityand stride width or distortion from the due reconstructed to GPS or BA trajectori corrections.es using We the compute method stride described length, in stride Ref. speed,[1]. We andfurther stride compute width from stride the clearance reconstructed as the trajectories minimum using height the methodduring swing described phase in Ref.above [1]. a Weline furtherconnecting compute successive stride clearance footfalls. as We the minimumpool these height measures during for swing each phase experimental above a line condition connecting and successivecompare footfalls.across conditions. We pool theseAny other measures synchronized for each experimental measurement condition (e.g., heart and rate, compare temperature, across conditions.perspiration, Any muscle other synchronizedactivity, tremor, measurement etc.) could (e.g., be similarly heart rate, segmented temperature, and perspiration, pooled based muscle on the activity,repeated tremor, paths. etc.) could be similarly segmented and pooled based on the repeated paths. AsAs many many gait gait parameters parameters and and mobility mobility metrics metrics change change systematically systematically with with the behavioralthe behavioral factor factor of walkingof walking speed, speed, we first we check first eachcheck parameter each parameter for such dependencefor such dependence by computing by computing its linear regression its linear againstregression walking against speed. walking If no speed. significant If no relationshipsignificant relationship is found (p -valueis found of ( slopeP-value> 0.05),of slope we > apply0.05), we a two-sampleapply a two-sample t-test or Analysis t-test or of Analysis Variance of (ANOVA) Variance to(ANOVA) compare to the compare mean values the mean of the values parameter of the acrossparameter different across conditions. different If conditions. the slope of If the the regression slope of the is significant, regression we is applysignificant, Analysis we ofapply Covariance Analysis (ANCOVA)of Covariance to estimate (ANCOVA) the di tofference estimate across the conditionsdifference usingacross populationconditions marginalusing population means and marginal their variancesmeans and at the their mean variances speed. at the mean speed.

2.7.2.7. Preliminary Preliminary Testing Testing WeWe conducted conducted a a preliminary preliminary test test to to verify verify the the eff eectivenessffectiveness of of the the method method described described above above in in comparingcomparing spatially spatially repeated repeated straight straight walking walking in in di differentfferent conditions conditions during during everyday everyday life. life. One One of of thethe authors authors wore wore an an integrated integrated sensor sensor system system (Figure (Figure4) 4) containing containing an an IMU, IMU, a barometrica barometric pressure pressure sensorsensor and and an an embedded embedded GPS GPS receiver receiver on his on right his right foot, andfoot, also and recorded also recorded GPS data GPS on data his cell on phone.his cell Dataphone. were Data recorded were forrecorded 10 workdays, for 10 workdays, with footwear with as footwear the explanatory as the explanatory variable of variable interest: of five interest: days eachfive with days athletic each with shoes athletic and hiking-style shoes and sandalshiking-s (Figuretyle sandals4). The (Figure study was4). The conducted study was according conducted to proceduresaccording approvedto procedures by the approved University by ofthe Wisconsin University Institutional of Wisconsin Review Institutional Board. Review Board.

FigureFigure 4. 4.Sensor Sensor systemsystem usedused for the pilot pilot study. study. (a ()a )The The sensors sensors include include a full a full IMU IMU (9Dof (9Dof Razor Razor IMU IMUM0, M0, Spark Spark Fun Fun Electronics, Electronics, including including an an InvenS InvenSenseense MPU-9250 MPU-9250 IMU chip),chip), aa barometric barometric pressure pressure sensorsensor (Adafruit (Adafruit Electronics Electronics breakout breakout for Bosch for BMP280Bosch BMP280 chip), and chip), a GPS and receiver a GPS (Adafruit receiver Electronics (Adafruit UltimateElectronics GPS BreakoutUltimate versionGPS Breakout 3, using MediaTekversion 3, Labs using MTK3339 MediaTek chip). Labs GPS MTK3339 data include chip). a time GPS stamp data usedinclude to synchronize a time stamp the embeddedused to synchronize system with the enhanced embedded location system data with collected enhanced on a smartlocation phone data (notcollected shown). on The a smart sensors phone are powered (not shown). by an 850The mAh sensors 1-cell are lithium powered polymer by an battery 850 mAh that lasts1-cell roughly lithium 17 h (behind the sensors in photograph). (b) The sensor package (70 48 26 mm; 69 g including polymer battery that lasts roughly 17 h (behind the sensors in photograph).× × (b) The sensor package battery)(70 × 48 is × small 26 mm; and 69 light g including enough to battery) avoidimpeding is small and movement; light enough future to versions avoid impeding are expected movement; to be evenfuture smaller versions with are custom expected circuitry. to be Iteven is mounted smaller with on the custom foot using circuitry. a strap It is of mounted hook-and-loop on the material.foot using Thea strap system of ishook-and-loop recharged each material. night using The a system USB cable. is recharged For this preliminary each night study,using thea USB sensor cable. was For worn this withpreliminary athletic shoes study, (shown) the sensor and withwas hiking-styleworn with athl sandalsetic shoes (inset). (shown) and with hiking-style sandals (inset).

Sensors 2019, 19, 1925 8 of 17

Sensors 2019, 19, x FOR PEER REVIEW 8 of 17 3. Results 3. Results The movement reconstruction algorithm rebuilt 48831 total foot displacements over 10 days. Not The movement reconstruction algorithm rebuilt 48831 total foot displacements over 10 days. all foot displacements are walking, as the foot is frequently moved even when sitting or standing in Not all foot displacements are walking, as the foot is frequently moved even when sitting or one place. Figure5 shows the reconstruction of all bouts of straight line walking of 15 m or more, standing in one place. Figure 5 shows the reconstruction of all bouts of straight line walking of 15 m accounting for 27,302 strides (56% of the total foot displacements). Paths that were repeated are shown or more, accounting for 27,302 strides (56% of the total foot displacements). Paths that were repeated in matched clusters in color; unique or unmatched paths are shown in black. are shown in matched clusters in color; unique or unmatched paths are shown in black.

FigureFigure 5. Straight 5. Straight walking walking trajectories trajectories reconstructed reconstructed during during a 10-day a 10-day walking walking test, including test, including proper proper relativerelative geographic geographic location location (absolute (absolute coordinates coordinates removed). removed). The subject The subject wore wore athletic athletic shoes shoes (solid (solid lines) and sandals (dashed lines) for 5 days each. The figure shows all straight paths longer than 15 m lines) and sandals (dashed lines) for 5 days each. The figure shows all straight paths longer than 15 m over all 10 days. Matched clusters are shown in different colors, and un-clustered paths are shown in over all 10 days. Matched clusters are shown in different colors, and un-clustered paths are shown black. The same route traversed in opposite directions counts as two separate paths. Gaps and in black. The same route traversed in opposite directions counts as two separate paths. Gaps and disconnects in the data arise from several sources, such as: Stationary periods; walking bouts less disconnects in the data arise from several sources, such as: Stationary periods; walking bouts less than than 15 m long; corners and other turns; travel by , bus or ; erroneous path reconstructions; 15 m long; corners and other turns; travel by car, bus or bicycle; erroneous path reconstructions; and and any other path that did not satisfy the criterion “straight paths longer than 15 m”. Note: this any other path that did not satisfy the criterion “straight paths longer than 15 m”. Note: this figure is figure is available in vector graphics format in the Supplementary Material for closer study. available in vector graphics format in the Supplementary Material for closer study.

Sensors 2019, 19, 1925 9 of 17 Sensors 2019, 19, x FOR PEER REVIEW 9 of 17

TheThe algorithmalgorithm identifiedidentified four four frequently-repeated frequently-repeated walking walking paths paths with with at at least least 300 300 strides strides over over at leastat least three three days days in each in each condition condition (Figure (Figure6). These 6). pathsThese are: paths (i, ii)are: the (i, hallway ii) the betweenhallway thebetween subject’s the osubject’sffice and office the restroom and the and restroom water fountain,and water in fountain, both directions; in both (iii) directions; the sidewalk (iii) the connecting sidewalk the connecting building wherethe building the subject where works the subject and a nearby works busand stop; a nearby and (iv)bus thestop; sidewalk and (iv) connecting the sidewalk the sameconnecting building the andsame a diningbuilding location. and a dining 4811 strides location. were 4811 recorded strides onwe thesere recorded specific on paths, these accounting specific paths, for 10% accounting of total footfor 10% displacements of total foot and displacements 18% of strides and in 18% straight-line of strides walking. in straight-line walking.

FigureFigure 6. 6.Frequently-repeated Frequently-repeated straight straight walking walking trajectories trajectories found found from from a 10-day a 10-day walking walking test. The test. subject The woresubject athletic wore shoesathletic and shoes sandals and for sandals 5 days for each, 5 days indicated each, by indicated solid lines by and solid dashed lines linesand dashed respectively. lines Matchedrespectively. colors Matched indicate colors clustered indicate paths clustered with atpaths least with 300 at strides least 300 over strides at least over three at least days three in eachdays condition.in each condition. These paths These all paths occurred all occurred within the within green the box green at the box bottom at the ofbottom Figure of5, Figure near the 5, labelednear the featureslabeled (colorsfeatures are (colors changed are forchanged greater for contrast). greater Blue contrast). and red Blue lines and (i,ii) red are lines walking (i,ii) trajectories are walking in thetrajectories hallway in between the hallway the subject’s between o ffithece subject’s and the restroomoffice and and the waterrestroom fountain and water (different fountain directions (different are separateddirections intoare separated two different into paths).two different Yellow paths). lines (iii) Yellow represent lines (iii) the sidewalkrepresent betweenthe sidewalk the buildingbetween wherethe building the subject where works the subject and a nearbyworks and bus stop.a nearby Purple bus linesstop. (iv)Purple represent lines (iv) a sidewalk represent between a sidewalk the samebetween building the same and building a dining location.and a dining location.

StrideStride lengthlength wearingwearing athleticathletic shoesshoes waswas significantlysignificantly shortershorter onon allall repeatedrepeated pathspaths (mean(mean 1.421.42 vs.vs. 1.471.47 m,m, pP< < 0.0001).0.0001). Stride width was not didifferentfferent ((pP> > 0.05)0.05) onon threethree ofof thethe fourfour paths,paths, withwith oneone exceptionexception onon the the hallway hallway from from the the restroom restroom to the to subject’sthe subject’s office whereoffice where stride widthstridewearing width wearing athletic shoesathletic was shoes significantly was significantly smaller (0.067smaller vs. (0.067 0.081 vs. m, 0.081p = 0.0012). m, P = 0.0012). Foot clearance Foot clearance wearing wearing athletic athletic shoes wasshoes significantly was significantly smaller smaller on three on of three the fourof the frequent four frequent paths (meanpaths (mean 0.030 vs.0.030 0.035, vs. 0.035,p < 0.0001), P < 0.0001), with onewith exception one exception on the on sidewalk the sidewalk between between the office the building office andbuilding dining and location dining where location the diwherefference the wasdifference not significant was not (significantp = 0.7797). (P The= 0.7797). results The in theresults hallway in the from hallway the subject’s from the o subject’sffice to the office restroom to the (pathrestroom (ii) in (path Figure (ii)6 )in are Figure shown 6) inare Figure shown7 asin anFigure example. 7 as an example. We also performed a similar comparison of stride length, width and clearance across footwear conditions using all straight paths longer than 15 m (i.e., all paths shown in Figure5). Figure8 shows the ANCOVA results using this larger set; it can be compared to Figure7 to observe the di fferences in outcome relative to the restricted set of frequently-repeated paths. Using all straight walking, stride length wearing athletic shoes was significantly shorter (mean 1.43 vs. 1.47 m, p < 0.0001), stride width was significantly smaller (mean 0.067 vs. 0.072, p < 0.0001), and foot clearance was significantly lower (mean 0.032 vs. 0.036, p < 0.0001) as well. Mean speed across all strides recorded on straight paths was 1.34 m/s.

Sensors 2019, 19, x FOR PEER REVIEW 10 of 17

Sensors 2019, 19, 1925 10 of 17 Sensors 2019, 19, x FOR PEER REVIEW 10 of 17

Figure 7. Spatiotemporal gait parameters on path (ii) (Figure 6), the hallway from the subject’s office to the restroom and drinking fountain. Blue and red indicate wearing athletic shoes (a.s.) and sandals (s.), respectively. (a) Linear regression of stride length on walking speed. Dotted lines represent 95% confidence intervals and the vertical dashed line represents the mean speed (1.32 m/s) where population marginal means of the two conditions are compared. The slopes of both fitted lines are significantly different from zero (P < 0.0001), indicating significant dependence on speed. Thus, ANCOVA is used for the comparison to account for the differences caused by different speeds. (b) Population marginal means of stride length, stride width and clearance; error bars indicate 95% confidence intervals.

We also performed a similar comparison of stride length, width and clearance across footwear FigureFigure 7. 7.Spatiotemporal Spatiotemporal gait gait parameters parameters on on path path (ii) (ii) (Figure (Figure6), the6), the hallway hallway from from the subject’sthe subject’s o ffi ceoffice to conditions using all straight paths longer than 15 m (i.e., all paths shown in Figure 5). Figure 8 shows theto the restroom restroom and and drinking drinking fountain. fountain. Blue Blue and and red red indicate indicate wearing wearing athletic athletic shoes shoes (a.s.) (a.s.) and and sandals sandals the ANCOVA results using this larger set; it can be compared to Figure 7 to observe the differences (s.),(s.), respectively. respectively. ( a()a) Linear Linear regression regression of of stride stride length length on on walking walking speed. speed. Dotted Dotted lines lines represent represent 95% 95% in outcome relative to the restricted set of frequently-repeated paths. Using all straight walking, confidenceconfidence intervals intervals and and the verticalthe vertical dashed dashed line represents line represents the mean the speed mean (1.32 speed m/s) where(1.32 populationm/s) where stride length wearing athletic shoes was significantly shorter (mean 1.43 vs. 1.47 m, P < 0.0001), marginalpopulation means marginal of the means two conditions of the two are conditions compared. ar Thee compared. slopes of The both slopes fitted linesof both are fitted significantly lines are stridedisignificantlyff widtherent from was zerodifferent significantly (p < 0.0001),from zero smaller indicating (P < (mean0.0001), significant 0.067indicating dependence vs. 0.072, signific onPant < speed. 0.0001),dependence Thus, and ANCOVA onfoot speed. clearance is usedThus, was significantlyforANCOVA the comparison lower is used (mean tofor account the 0.032 comparison for vs. the 0.036, di fftoerences Paccount < 0.0001) caused for asthe by well. differences different Mean speeds. causedspeed (b byacross) Population different all strides speeds. marginal recorded (b) on straightmeansPopulation of paths stride marginal was length, 1.34 means stride m/s. width of stride and length, clearance; stri errorde width bars indicateand clearance; 95% confidence error bars intervals. indicate 95% confidence intervals.

We also performed a similar comparison of stride length, width and clearance across footwear conditions using all straight paths longer than 15 m (i.e., all paths shown in Figure 5). Figure 8 shows the ANCOVA results using this larger set; it can be compared to Figure 7 to observe the differences in outcome relative to the restricted set of frequently-repeated paths. Using all straight walking, stride length wearing athletic shoes was significantly shorter (mean 1.43 vs. 1.47 m, P < 0.0001), stride width was significantly smaller (mean 0.067 vs. 0.072, P < 0.0001), and foot clearance was significantly lower (mean 0.032 vs. 0.036, P < 0.0001) as well. Mean speed across all strides recorded on straight paths was 1.34 m/s.

FigureFigure 8. 8. SpatiotemporalSpatiotemporal gait parameters parameters using using all all straight-line straight-line walking walking bouts bouts longer longer than than 15 15m. m.All Allconventions conventions are are similar similar to to Figure Figure 7.7.( (aa) )Linear Linear regression regression of stride lengthlength onon walkingwalking speed speed showing showing thethe mean mean speed speed (1.34(1.34 mm/s)/s) where population margin marginalal means means of of the the two two conditions conditions are are compared. compared. (b) (bPopulation) Population marginal marginal means means of of stride stride length, length, stride stride width, width, and clearance;clearance; errorerror barsbarsindicate indicate 95% 95% confidenceconfidence intervals. intervals.

Finally,Finally, because because the the goal goal of the of repeatedthe repeated paths waspath tos was reduce to variabilityreduce variability in the data, in wethe compared data, we thecompared standard the deviation standard of eachdeviation outcome of each for strides outcome within for 2%strides of the within mean 2% speed, of the using mean repeated speed, paths using vs. using all straight paths longer than 15 m. Figure9 shows that variability in the data is reduced using repeated paths for all outcome measures. No statistical comparison is possible because there is only oneFigure value 8. Spatiotemporal for the all-straight-paths gait parameters case. using all straight-line walking bouts longer than 15 m. All conventions are similar to Figure 7. (a) Linear regression of stride length on walking speed showing the mean speed (1.34 m/s) where population marginal means of the two conditions are compared. (b) Population marginal means of stride length, stride width, and clearance; error bars indicate 95% confidence intervals.

Finally, because the goal of the repeated paths was to reduce variability in the data, we compared the standard deviation of each outcome for strides within 2% of the mean speed, using

Sensors 2019, 19, x FOR PEER REVIEW 11 of 17 repeated paths vs. using all straight paths longer than 15 m. Figure 9 shows that variability in the dataSensors is reduced2019, 19 ,using 1925 repeated paths for all outcome measures. No statistical comparison is possible11 of 17 because there is only one value for the all-straight-paths case.

FigureFigure 9. Comparison 9. Comparison of variability of variability of ofthe the spatiotemporal spatiotemporal gait gait parameters parameters between between all straight pathspathsand andrepeated repeated paths paths when when wearing wearing (a) athletic(a) athletic shoes shoes and (andb) sandals. (b) sandals. Dark columnsDark columns indicate indicate the variability the variabilityof each of outcome each outcome metric using metric all using straight all pathsstraight over paths 15 m over (standard 15 m deviation(standard acrossdeviation strides across within strides2% ofwithin the mean 2% of speed). the mean Light speed). columns Light with columns error barswith indicate error bars the indicate variability theof variability each outcome of each using outcomeonly frequently-repeatedusing only frequently-rep pathseated (mean paths and standard(mean and deviation standard across deviation frequent across paths frequent of the standardpaths of thedeviations standard of deviations the individual of the paths individual using stridespaths using within strides 2% of within the mean 2% speed).of the mean speed).

4. Discussion4. Discussion

4.1.4.1. Utility Utility and andApplicability Applicability of the of theMethod Method ThisThis preliminary preliminary result result demonstrates thethe promise promise of theof proposedthe proposed method method to identify to identify frequently- frequently-repeatedrepeated walking walking paths from paths wearable from wearable measurements measurements across multipleacross multiple days. The days. paths The identified paths identifiedinclude include both indoor both hallwaysindoor hallways and outdoor and sidewalks,outdoor sidewalks, potentially potentially enabling theenabling study the of various study of daily varioussettings daily that settings may have that di ffmayerent have contextual different influences contextual on subjects. influences Focusing on subjects. on frequently-repeated Focusing on frequently-repeatedpaths may eliminate paths many may confounds eliminate that many cannot confounds be excluded that incannot typical be activity-trackingexcluded in typical studies, activity-trackingsuch as unique studies, events such that occuras unique within events the studythat occur window within (e.g., the running study window a race, attending (e.g., running a festival, a race,touring attending a museum, a festival, and touring riding aa cyclemuseum, [3]); theseand ri uniqueding a activitiescycle [3]); are these eliminated unique automaticallyactivities are by eliminatedthe repeated-paths automatically selection by the process. repeated-paths The result selection is a set process. of focused The activitiesresult is thata set are of morefocused likely activitiesto be comparablethat are more across likely experimentalto be comparable conditions, across experimental enabling meaningful conditions, statistical enabling comparisons meaningful of statisticalspecific comparisons explanatory of variables specific of explanatory primary interest variab suchles of as primary different interest features such of prostheses as different or features surgical vs. of prosthesesrehabilitative or surgical interventions vs. rehabilitative for injury. interventions for injury. TheThe relative relative benefits benefits of using of using only only frequently-repeated frequently-repeated paths paths or all or allstraight-line straight-line walking walking paths paths are arerevealed revealed by byFigures Figures 7–9.7– 9The. The presence presence of ofstatistical statistical differences di fferences in the in thecomparison comparison using using all all straightstraight walking walking (Figure (Figure 8) illustrates8) illustrates the the potential potential value value for for that that simpler simpler approach. approach. Indeed, Indeed, related related all-stridesall-strides analyses analyses have have been been foun foundd useful useful in some in some prior priorwork work(e.g., Reference (e.g., Reference [12]). However, [12]). However, the repeated-pathsthe repeated-paths analysis analysis shows showsa benefit a benefit in reducing in reducing the variability the variability in the data in the compared data compared to using to all using straightall straight paths paths(Figure (Figure 9). This9). Thisreduced reduced variability variability is likely is likely attributable attributable to greater to greater similarity similarity among among the thelimited limited bouts bouts included included in the in therepeated-paths repeated-paths analysis. analysis. Reduced Reduced variability variability may may enable enable improved improved sensitivitysensitivity to differences to differences across across experimental experimental conditions. conditions. The The repeated-paths repeated-paths analysis analysis also also has hasthe thea a prioripriori conceptualconceptual benefit benefit of of eliminatingeliminatingunique unique behaviors behaviors or eventsor events from from the analysis, the analysis, thereby thereby ensuring a ensuringdefensible a defensible “apples-to-apples” “apples-to-apples” comparison comparison among conditions, among muchconditions, as in controlled much as laboratory in controlled studies. laboratoryComparison studies. of Figures Comparison5 and6 ofillustrates Figure 5 the and unique Figure or 6 infrequent illustrates pathsthe unique that were or infrequent excluded. paths Among thatthese were are excluded. several thatAmong occurred these only are inseveral one condition that occurred that could only potentiallyin one condition bias the that results could of an potentiallyall-strides bias analysis. the results Further of application an all-strides of the proposedanalysis. repeated-pathsFurther application analysis of shouldthe proposed continue to repeated-pathsinclude comparison analysis againstshould all-stridescontinue to analysis include to comparison further clarify against their all-strides relative utility. analysis to further clarify theirThe relative present studyutility. highlights straight-line walking, but further curve matching algorithms could be used to find repeated turning, stairs or ramps, which are seldom studied quantitatively but are Sensors 2019, 19, 1925 12 of 17 important in assessing clinical interventions. In addition, the IMU itself is a rich resource for gait analysis, providing much finer spatiotemporal and kinematic gait parameters than a typical step counter [1,17–20,25,35]. The key finding is that the method enables detailed comparisons with many samples in semi-controlled data sets—an approach that could be powerfully applied to evaluate interventions such as prostheses, orthoses, surgeries, or medications. The subtle differences in walking with athletic shoes vs. sandals are not as dramatic nor as important as clinical interventions are likely to be. Nevertheless, these two types of footwear are commonly used and the preliminary finding of differences between them may motivate further study of how humans accommodate different footwear. We speculate that the two main findings—greater clearance and longer stride length with sandals—may be related to the fear of tripping or stubbing the toes. We suspect that clearance is increased deliberately to prevent the sandal from catching on obstacles, which is more likely to occur and to result in foot injury when wearing sandals. We further speculate that once the foot is lifted, the longer stride is simply a consequence of inertia: the foot travels forward at the same rate, but takes longer to reach the ground, resulting in a longer stride. More detailed outcome metrics such as toe and heel clearance [20] (rather than the IMU’s estimated stride clearance measured here) would be useful to better understand these effects. This single-subject study cannot definitively prove the effect nor its cause, but the potential mechanism is relevant to clinical applications such as foot drop and lower-limb prosthetics and orthotics. The proposed method can be extended to study outcomes beyond those captured by the foot-mounted inertial sensors. Any other sensor could be recorded synchronously and analyzed during comparable bouts of movement based on this location reconstruction. Potential examples include heart rate, electromyographic activity, plantar pressure distribution, prosthetic socket load, postural control of the trunk, gait symmetry, respiration rate, use of an impaired arm for manipulation, and more. Additionally, the proposed method could be used to infer the locations the subjects have visited during the test with a finer resolution than GPS, especially indoors. These location histories could be used in some social activity measurements to build up Location-Based Social Networks aimed at providing location-based services [36] or interventions against negative behaviors [37]. The method as presented was mainly designed to enable scientific comparison of different interventions, but it could also be extended to assess the performance or capacity of individual patients in a clinical context. For scalable deployment in the clinic, issues of cost, compactness, longevity and interpretability are of paramount concern. The system as used in this study is already sufficiently simple, adding only an inexpensive GPS and barometer compared to commodity IMU’s; it mainly needs miniaturization and automation of the processing. The frequent-paths analysis has potential clinical utility for improved comparison of individuals against normative data or for repeated-measures comparisons such as tracking recovery or decline over time. The method may also be extended to study movement across different types of terrain; for example, many persons with lower limb amputation walk well on smooth level ground, but their stability on uneven surfaces like grass or gravel varies widely. Wearable sensor data on spontaneous movement in all these environments could be used with the proposed clustering methods to identify paths that differ only in terrain. Then, the response of an individual to differences in terrain could be a tool for assessing his/her overall movement capacity. Finally, the location-aware data sets resulting from this method have the potential to provide unique information on unexpected events that occur in daily life, such as falls. For example, a recent study recorded motion from older adults for two weeks and reconstructed body movement surrounding the losses of balance they reported [23]. The proposed method uses a similar reconstruction but could extend the analysis to compare these events against movements in the same location that did not result in loss of balance. This approach could enable improved understanding of the circumstances that lead to falls. Sensors 2019, 19, 1925 13 of 17

4.2. Limitations and Future Work As a dead reckoning navigation method, the trajectories reconstructed from IMU data do inevitably suffer from some limitations. For example, indoor parking lots can corrupt the subsequent indoor localization, because of the extended absence of available corrections (neither GPS nor ZUPT can be applied during driving and GPS may not be reestablished prior to entering a building). The same thing happens for walking or running on a treadmill in a gym, and other indoor activities during which the ZUPT assumption is violated. Identifying and handling these special cases remains a challenge for further algorithm development. Additionally, despite the success of the Kalman smoother technique, heading drift still poses a substantial threat to the accuracy of the trajectory, especially during long indoor periods with high activity level. The simple (but costly) way of handling it is to use an angular rate gyroscope with lower drift error. Ongoing research aims to further correct heading drift. Some potential approaches are based on adding hardware, such as placing Bluetooth beacons at the subject’s most frequented places (e.g., office desk) for absolute position correction. Other improvements are algorithmic, such as Foot SLAM (simultaneous localization and mapping) [38], which uses past trajectories as a map to constrain future trajectories, and other SLAM techniques to further improve the location estimate such as using ambient WiFi network signals [39] or magnetic field fluctuations [40]. Additional improvements may also refine the inertial reconstruction, such as tilt angle corrections based on gravity [19]. Fortunately, the proposed method generally rejects faulty reconstructions from statistical analysis because they are not frequently repeated. Another limitation of the proposed method is that there is no ground truth to verify the clustering of spatially repeated trajectories. Two types of errors may occur in the clustering: (i) Some indoor trajectories with large drift may not be grouped into the cluster where they are supposed to be and (ii) worse, some trajectories may be wrongly grouped into a cluster. Unfortunately, there is no way to discover these mistakes. However, proper thresholds and grouping methods can balance the two errors. For example, tightening the clustering criterion such that each candidate trajectory must have two or more other close trajectories in the same cluster (we used one in this study) would bias the errors toward the first type—a more conservative strategy for making meaningful comparisons. The structure of indoor movement in multi-level buildings provides additional challenges and opportunities for error management. Indoor trajectories are usually constrained by hallways, so heading drift is unlikely to cause faulty clustering since there is little chance for the drifted trajectory to be aligned with other hallways just right. On the other hand, hallways on different floors are usually aligned with each other, so vertical position drift can easily cause faulty clustering. Efforts to limit vertical position drift are ongoing, such as assuming that indoor walking does not change altitude and using additional measurements such as the barometric altitude data to detect ramps and stairs. The repeated-paths technique relies on the assumption that frequently-repeated movement paths imply repeatable circumstances during locomotion. This assumption is clearly imperfect, as common variations such as carrying a backpack or package, walking with other people, navigating crowds or encountering rain can occur on even the most-frequented paths. These variations are expected to be less common and less severe in restricted clusters of repeated paths than in larger data sets like “all movement”. However, the current set of sensors has no way to detect and reject these circumstances, so their presence could increase variability in the data. Future improvements may pursue a range of techniques to reject specific variations, such as using pressure insoles to detect load carriage, microphones to detect the wearer’s speech (implying accompaniment), LIDAR or step-frequency-based classification [41] to detect a crowd, or weather records to detect weather variations.

5. Conclusions The proposed technique for analyzing movement along frequently-repeated paths harvested from long-duration wearable monitoring promises to enable studies of mobility patterns and interventions with laboratory-like precision, but without the artificial laboratory environment. The movements thus studied are by definition the most common movements an individual performs and are therefore Sensors 2019, 19, 1925 14 of 17 arguably the most impactful movements to understand. By analyzing these common movements before vs. after an intervention or across multiple interventions, outcomes can be assessed to determine the comparative benefits of the interventions. This technique can potentially be extended to analyze specific targeted movements such as stairs or ramps; broadened to assess whole families of movements such as all indoor straight level walking; or adapted to compare movement features across different indoor and outdoor terrains.

Supplementary Materials: The following are available online at http://www.mdpi.com/1424-8220/19/8/1925/s1. Author Contributions: The authors contributed as follows: conceptualization, P.G.A.; methodology, P.G.A. and W.W.; software, W.W.; formal analysis, W.W.; writing—original draft preparation, W.W.; writing—review and editing, W.W. and P.G.A.; visualization, W.W.; supervision, P.G.A.; project administration, P.G.A.; funding acquisition, P.G.A. Funding: This research was funded by institutional funds from the University of Wisconsin–Madison College of Engineering, Department of Mechanical Engineering and Office of the Vice Chancellor for Research and Graduate Education. Acknowledgments: The authors thank Adrienne Nienow for assistance in preparing the Graphical Abstract. Conflicts of Interest: P. G. Adamczyk is an owner of Intelligent Prosthetic Systems, LLC, which develops technology related to this research.

Appendix A. Recognition of Indoor vs. Outdoor GPS To determine if a GPS fix is outdoors, we examine its preceding 20 fixes and subsequent 19 fixes and itself. If the following criteria are all met, the fix is recognized as outdoors: (i) at most 2 of the 40 fixes have HDOP larger than 10 (dimensionless); (ii) the average time gap between consecutive fixes is less than 3 s (GPS is sampled at 1 Hz); (iii) the maximum spatial separation between consecutive fixes is smaller than 30 m; (iv) mean speed is larger than 0 m/s; (v) if mean speed is smaller than 0.8 m/s, then either the nearest building is not the same for all 40 fixes or the mean distance from the nearest building is larger than 10 m and (vi) if mean speed is larger than 0.8 m/s, then either the nearest building is not the same for all 40 fixes or the mean distance from the nearest building is larger than 0 m. The mean speed is the average speed calculated from consecutive fixes. The distance between a fix and a building is defined as the shortest distance from the fix to the edges of the building if the fix is outside and 0 if the fix is inside of the building’s footprint.

Appendix B. Kalman Filter and Smoother

Appendix B.1. Structure of the Kalman Filter In this appendix, the Kalman filter and smoother used in the proposed method are detailed. The structure of the Kalman filter is referenced from [42], but the differences are minor compared to [26,27]. The method involves two sets of states: nominal states and error states. Nominal h iT = T T T T T states x r v θ ab ωb represent position, velocity, orientation, accelerometer bias and gyroscope bias integrated from IMU measured angular velocity and linear acceleration. Nominal states are corrected by the output of the Kalman filter when applicable corrections arrive. Error states h iT = T T T T T δx δr δv δθ δab δωb are the estimated errors of the nominal states and are where the Kalman filter operates. Here the error of orientation is represented by rotation vector δθ = δθ →n, k k · which is the rotation about axis →n by an angle δθ in world-fixed coordinates. The linearized transition k k matrix for the error states is given by

 I I ∆t 0 0 0   3 3 3 3   × ×   0 I3 3 [R(am ab)] ∆t R ∆t 0   × − − × −  F =  0 0 I 0 R ∆t , (A1)  3 3   × −   0 0 0 I3 3 0   ×  0 0 0 0 I3 3 × Sensors 2019, 19, 1925 15 of 17

where I3 3 is the 3-by-3 identity matrix, ∆t is the sampling period, R is the rotation matrix from × IMU coordinates to world-fixed coordinates, am is measured linear acceleration, ab is estimated accelerometer bias, and [ ] is the skew operator which produces the cross product matrix [42]. • The covariance matrix P of the× error states is iterated by the standard equation P FPFT + Q, where ← Q is the covariance matrix of IMU’s noise estimated from product specifications or experiments. Whenever applicable corrections arrive, such as GPS and ZUPT, a measurement matrix H selects the corresponding states. In the case of GPS and ZUPT, H is given by " # I3 3 0 0 0 0 H = × . (A2) 0 I3 3 0 0 0 ×   1 The Kalman gain is calculated by K = PHT HPHT + V − , where V is the covariance matrix of the measurement noise which can be optimized for best accuracy. The error states are updated by δx = K(y Hx), where y is the measurement, in the case of GPS and ZUPT, h − iT y = rx,GPS ry,GPS rz,GPS 0 0 0 . The posterior covariance matrix is then updated by P (I15 15 KH)P. Finally, the nominal states are corrected by the error states, x x + δx. Note ← × − ← that though “+” is used here, the correction of orientation involves applying the error rotation to the nominal orientation rather than a simple addition [42].

Appendix B.2. Kalman Smoother for Location: Forward and Backward Kalman Filters The Kalman smoother makes use of the fact that the covariance matrix P is an estimate of how accurate the nominal states are. The same Kalman filter and integration process are run backward from the last sample to the first sample. The only difference is the sampling period ∆t is replaced by its negative, ∆t. The forward and backward Kalman filters produce two posterior covariance − + + matrices at a timestamp, P and P−, which are used to average the nominal states r and r− [28] component-wise by + + rx /var(rx ) + rx−/var(rx−) rx,smoothed = + , (A3) 1/var(rx ) + 1/var(rx−) + + where var(rx ) and var(rx−) are the left-top entry of P and P− respectively, which are the estimated variances of the position in x-axis. Position in y-axis and z-axis are averaged in the same fashion. The intuitive description of this process is that forward and backward positions are averaged according to their estimated accuracy to produce the smoothed position.

References

1. Ojeda, L.V.; Rebula, J.R.; Kuo, A.D.; Adamczyk, P.G. Influence of contextual task constraints on preferred stride parameters and their variabilities during human walking. Med. Eng. Phys. 2015, 37, 929–936. [CrossRef][PubMed] 2. Muro-de-la-Herran, A.; Garcia-Zapirain, B.; Mendez-Zorrilla, A. Gait Analysis Methods: An Overview of Wearable and Non-Wearable Systems, Highlighting Clinical Applications. Sensors 2014, 14, 3362–3394. [CrossRef][PubMed] 3. Hickey, A.; Din, S.D.; Rochester, L.; Godfrey, A. Detecting free-living steps and walking bouts: Validating an algorithm for macro gait analysis. Physiol. Meas. 2016, 38, N1–N15. [CrossRef] 4. Roetenberg, D.; Luinge, H.; Slycke, P. Xsens MVN: Full 6DOF Human Motion Tracking Using Miniature Inertial Sensors; Xsens Motion Technologies BV: Enschede, The , 2013. 5. BioSensics LEGSys. Available online: http://www.biosensics.com/legsys-overview/ (accessed on 2 April 2014). 6. Liu, T.; Inoue, Y.; Shibata, K.; Shiojima, K. A Wireless Measurement System (M3D) for Three-Dimensional Gait Analysis System. In Proceedings of the Internet of Things; Wang, Y., Zhang, X., Eds.; Springer: /Heidelberg, , 2012; pp. 166–171. Sensors 2019, 19, 1925 16 of 17

7. Bae, J.; Tomizuka, M. A tele-monitoring system for gait rehabilitation with an inertial measurement unit and a shoe-type ground reaction force sensor. Mechatronics 2013, 23, 646–651. [CrossRef] 8. Schepers, H.M.; Koopman, H.; Veltink, P.H. Ambulatory assessment of ankle and foot dynamics. IEEE Trans. Biomed. Eng. 2007, 54, 895–902. [CrossRef] 9. Orendurff, M.S.; Schoen, J.A.; Bernatz, G.C.; Segal, A.D. How humans walk: Bout duration, steps per bout, and rest duration. J. Rehabil. Res. Dev. 2008, 45, 1077. [CrossRef] 10. Orendurff, M.S.; Raschke, S.U.; Winder, L.; Moe, D.; Boone, D.A.; Kobayashi, T. Functional level assessment of individuals with transtibial limb loss: Evaluation in the clinical setting versus objective community ambulatory activity. J. Rehabil. Assist. Technol. Eng. 2016, 3.[CrossRef] 11. Godfrey, B.; Berdan, J.; Kirk, M.N.; Chou, T.R. The Accuracy and Validity of Modus Trex Activity Monitor in Determining Functional Level in Veterans with Transtibial Amputations. J. Prosthet. Orthot. 2018, 30, 20–30. [CrossRef] 12. Del Din, S.; Galna, B.; Godfrey, A.; Bekkers, E.M.J.; Pelosin, E.; Nieuwhof, F.; Mirelman, A.; Hausdorff, J.M.; Rochester, L. Analysis of Free-Living Gait in Older Adults with and without Parkinson’s Disease and With and Without a History of Falls: Identifying Generic and Disease-Specific Characteristics. J. Gerontol. Ser. A 2019, 74, 500–506. [CrossRef] 13. Raschke, S.U.; Orendurff, M.S.; Mattie, J.L.; Kenyon, D.E.A.; Jones, O.Y.; Moe, D.; Winder, L.; Wong, A.S.; Moreno-Hernández, A.; Highsmith, M.J.; et al. Biomechanical characteristics, patient preference and activity level with different prosthetic feet: A randomized double blind trial with laboratory and community testing. J. Biomech. 2015, 48, 146–152. [CrossRef] 14. Giannouli, E.; Bock, O.; Mellone, S.; Zijlstra, W. Mobility in Old Age: Capacity Is Not Performance. Available online: https://www.hindawi.com/journals/bmri/2016/3261567/abs/ (accessed on 17 November 2017). 15. Mancini, M.; El-Gohary, M.; Pearson, S.; McNames, J.; Schlueter, H.; Nutt, J.G.; King, L.A.; Horak, F.B. Continuous monitoring of turning in Parkinson’s disease: Rehabilitation potential. NeuroRehabilitation 2015, 37, 3–10. [CrossRef] 16. Köse, A.; Cereatti, A.; Della Croce, U. Bilateral step length estimation using a single inertial measurement unit attached to the pelvis. J. NeuroEng. Rehabil. 2012, 9, 9. [CrossRef] 17. Mariani, B.; Rochat, S.; Büla, C.J.; Aminian, K. Heel and toe clearance estimation for gait analysis using wireless inertial sensors. IEEE Trans. Biomed. Eng. 2012, 59, 3162–3168. [CrossRef] 18. Mariani, B.; Hoskovec, C.; Rochat, S.; Büla, C.; Penders, J.; Aminian, K. 3D gait assessment in young and elderly subjects using foot-worn inertial sensors. J. Biomech. 2010, 43, 2999–3006. [CrossRef] 19. Rebula, J.R.; Ojeda, L.V.; Adamczyk, P.G.; Kuo, A.D. Measurement of foot placement and its variability with inertial sensors. Gait Posture 2013, 38, 974–980. [CrossRef] 20. Dadashi, F.; Mariani, B.; Rochat, S.; Büla, C.J.; Santos-Eggimann, B.; Aminian, K. Gait and Foot Clearance Parameters Obtained Using Shoe-Worn Inertial Sensors in a Large-Population Sample of Older Adults. Sensors 2013, 14, 443–457. [CrossRef] 21. Zhang, L.; Fu, C. Predicting foot placement for balance through a simple model with swing leg dynamics. J. Biomech. 2018, 77, 155–162. [CrossRef] 22. Song, M.; Kim, J. An Ambulatory Gait Monitoring System with Activity Classification and Gait Parameter Calculation Based on a Single Foot Inertial Sensor. IEEE Trans. Biomed. Eng. 2018, 65, 885–893. [CrossRef] 23. Ojeda, L.V.; Adamczyk, P.G.; Rebula, J.R.; Nyquist, L.V.; Strasburg, D.M.; Alexander, N.B. Reconstruction of body motion during self-reported losses of balance in community-dwelling older adults. Med. Eng. Phys. 2019, 64, 86–92. [CrossRef] 24. Rebula, J.R.; Ojeda, L.V.; Adamczyk, P.G.; Kuo, A.D. The stabilizing properties of foot yaw in human walking. J. Biomech. 2017, 53, 1–8. [CrossRef] 25. Martin Schepers, H.; van Asseldonk, E.H.F.; Baten, C.T.M.; Veltink, P.H. Ambulatory estimation of foot placement during walking using inertial sensors. J. Biomech. 2010, 43, 3138–3143. [CrossRef][PubMed] 26. Foxlin, E. Pedestrian tracking with shoe-mounted inertial sensors. IEEE Comput. Graph. Appl. 2005, 25, 38–46. [CrossRef] 27. Jimenez, A.R.; Seco, F.; Prieto, J.C.; Guevara, J. Indoor pedestrian navigation using an INS/EKF framework for yaw drift reduction and a foot-mounted IMU. In Proceedings of the 2010 7th Workshop on Positioning, Navigation and Communication, Dresden, Germany, 11–12 March 2010; pp. 135–143. Sensors 2019, 19, 1925 17 of 17

28. Roumeliotis, S.I.; Sukhatme, G.S.; Bekey, G.A. Smoother based 3D attitude estimation for mobile robot localization. In Proceedings of the 1999 IEEE International Conference on Robotics and Automation (Cat. No. 99CH36288C), Detroit, MI, USA, 10–15 May 1999; Volume 3, pp. 1979–1986. 29. [Dataset] National Elevation Dataset (NED). Available online: https://lta.cr.usgs.gov/ned (accessed on 11 June 2018). 30. [Dataset] The National Map: Elevation. Available online: https://nationalmap.gov/elevation.html (accessed on 11 June 2018). 31. [Dataset] OpenStreetMap. Available online: https://www.openstreetmap.org/ (accessed on 7 June 2018). 32. Douglas, D.H.; Peucker, T.K. Algorithms for the Reduction of the Number of Points Required to Represent a Digitized Line or Its Caricature. Cartogr. Int. J. Geogr. Inf. Geovisualization 1973, 10, 112–122. [CrossRef] 33. Visvalingam, M.; Whyatt, J.D. Line generalisation by repeated elimination of points. Cartogr. J. 1993, 30, 46–51. [CrossRef] 34. Lee, J.-G.; Han, J.; Whang, K.-Y. Trajectory Clustering: A Partition-and-Group Framework; ACM Press: , NY, USA, 2007; p. 593. 35. Mariani, B.; Jiménez, M.C.; Vingerhoets, F.J.G.; Aminian, K. On-shoe wearable sensors for gait and turning assessment of patients with Parkinson’s disease. IEEE Trans. Biomed. Eng. 2013, 60, 155–158. [CrossRef] 36. Zheng, Y. Location-Based Social Networks: Users. In Computing with Spatial Trajectories; Zheng, Y., Zhou, X., Eds.; Springer: New York, NY, USA, 2011; pp. 243–276. ISBN 978-1-4614-1628-9. 37. Gustafson, D.H.; Hawkins, R.P.; Boberg, E.W.; McTavish, F.; Owens, B.; Wise, M.; Berhe, H.; Pingree, S. CHESS: 10 years of research and development in consumer health informatics for broad populations, including the underserved. Int. J. Med. Inf. 2002, 65, 169–177. [CrossRef] 38. Robertson, P.; Angermann, M.; Krach, B. Simultaneous Localization and Mapping for Pedestrians Using Only Foot-Mounted Inertial Sensors; ACM Press: New York, NY, USA, 2009; p. 93. 39. Bruno, L.; Robertson, P. WiSLAM: Improving FootSLAM with WiFi. In Proceedings of the 2011 International Conference on Indoor Positioning and Indoor Navigation, Guimaraes, , 21–23 September 2011; pp. 1–10. 40. Chow, J.C.K. Drift-Free Indoor Navigation Using Simultaneous Localization and Mapping of the Ambient Heterogeneous Magnetic Field. ISPRS Int. Arch. Photogramm. Remote Sens. Spat. Inf. Sci. 2017, XLII-2/W7, 339–344. [CrossRef] 41. Zeng, G.; Cao, S.; Liu, C.; Song, W. Experimental and modeling study on relation of pedestrian step length and frequency under different headways. Phys. Stat. Mech. Its Appl. 2018, 500, 237–248. [CrossRef] 42. Solà, J. Quaternion kinematics for the error-state Kalman filter. arXiv 2017, arXiv:171102508.

© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).