コード例 #1
0
#!/usr/bin/env python

# this code tries to count how many of the lateral force disturbances were too
# strong and saturated the sensor, making the signal unusable

import sys
sys.path.append('..')

import dataprocessor.dataprocessor as dp
import numpy as np

database = dp.load_database(filename='../InstrumentedBicycleData.h5')

runTable = database.root.data.datatable

withSaturationPull = []
withSaturationPushPull = []

for row in runTable.iterrows():
    isDisturbance = row['Maneuver'].endswith('Disturbance')
    isPull = int(row['RunID']) < 227 # only pull lateral force
    isPushPull = not isPull # push and pull lateral force
    isLow = (row['PullForceBridge'] < 0.05).any()
    isPullSat = isDisturbance and isPull and isLow
    isPushPullSat = isDisturbance and isPushPull and (isLow or (row['PullForceBridge'] > 5.8).any())
    if isPullSat:
        withSaturationPull.append(row['RunID'])
    if isPushPullSat:
        withSaturationPushPull.append(row['RunID'])

print withSaturationPull
コード例 #2
0
import dataprocessor.dataprocessor as dp
import matplotlib.pyplot as plt

database = dp.load_database()

run = dp.Run("00124", database, forceRecalc=True, filterSigs=True)

steerAngle = run.computedSignals["YawAngle"]
steerRate = run.computedSignals["YawRate"]

steerAngFromInt = steerRate.integrate(initialCondition=steerAngle[0])

time = steerAngle.time()

plt.figure()
plt.plot(time, steerAngle)
plt.plot(time, steerAngFromInt)
plt.legend(("Steer Angle", "Integrated Steer Rate"))

steerAngFromInt2 = steerRate.integrate(initialCondition=steerAngle[0], subtractMean=True)

plt.figure()
plt.plot(time, steerAngle)
plt.plot(time, steerAngFromInt2)
plt.legend(("Steer Angle", "Integrated Steer Rate (drift fixed)"))

plt.show()