示例#1
0
def stepDetection(dataSet):
	xs = []
	ys = []
	zs = []
	timestamps = []
	headings = []
	for data in dataSet:
		xs.append(data[1])
		ys.append(data[2])
		zs.append(data[3])
		timestamps.append(data[0])
		headings.append(data[4])

	x,y,z,timestamps,headings = np.array(xs), np.array(ys),np.array(zs), np.array(timestamps), np.array(headings)
		
	# Filter Params
	order = 3
	fs = 50.0       # sample rate, Hz
	cutoff = 3.667  # desired cutoff frequency of the filter, Hz
		
	lowPassX = lpf.butter_lowpass_filter(x,cutoff,fs,order)
	peaks,troughs,average, headingMovedX = ajpb.adaptive_jerk_pace_buffer(lowPassX, timestamps, headings)
	
	lowPassY = lpf.butter_lowpass_filter(y,cutoff,fs,order)
	peaks,troughs,average, headingMovedY = ajpb.adaptive_jerk_pace_buffer(lowPassY, timestamps, headings)
	
	lowPassZ = lpf.butter_lowpass_filter(z,cutoff,fs,order)
	peaks,troughs,average, headingMovedZ = ajpb.adaptive_jerk_pace_buffer(lowPassZ, timestamps, headings)
	
	print("X: ",headingMovedX)
	print("Y: ",headingMovedY)
	print("Z: ",headingMovedZ)
	
	return headingMovedY
示例#2
0
    def __init__(self, address):
        with np.load(address) as data:
            self.time_stamps = data["time_stamps"]

            # filter the data
            self.yawData = data["angular_velocity"][2]
            order = 1
            fs = 100  # sample rate, Hz
            cutoff = 10  # desired cutoff frequency of the filter, Hz
            self.yawData = butter_lowpass_filter(self.yawData, cutoff, fs,
                                                 order)

        self.currIndex = 0
示例#3
0
import adaptiveJerkPaceBuffer as ajpb
import lowPassFilter as lpf
import math
import numpy as np
import json

f = open("accel.json", "r")
values = json.load(f)
f.close()

x = []
timestamps = []
for val in values:
	timestamps.append(val[0])
	x.append(val[3])			#Change the axis where values are used

timestamps = np.array(timestamps)
x = np.array(x)

# Filter Params
order = 3
fs = 50.0       # sample rate, Hz
cutoff = 3.667  # desired cutoff frequency of the filter, Hz

lowPassR = lpf.butter_lowpass_filter(x,cutoff,fs,order)

peaks,troughs,average = ajpb.adaptive_jerk_pace_buffer(lowPassR, timestamps)

print("No of steps: %d" %len(troughs))