Now we're taking the following simulation example from tutorial:
from imusim.all import *The walk.bvh file can be taken from imusim-0.2/imusim/tests/system directory or can be downloaded from here. This BVH file is a capture of the lower body of a walking human subject.
samplingPeriod = 0.01
imu = imusim.platforms.imus.Orient3IMU()
env = Environment()
samples = 1000
rotationalVelocity = 20
calibrator = ScaleAndOffsetCalibrator(env, samples, samplingPeriod, rotationalVelocity)
calibration = calibrator.calibrate(imu)
model = loadBVHFile('walk.bvh', CM_TO_M_CONVERSION)
splinedModel = SplinedBodyModel(model)
sim = Simulation(environment=env)
imu.simulation = sim
imu.trajectory = splinedModel.getJoint('rfoot')
sim.time = splinedModel.startTime
BasicIMUBehaviour(imu, samplingPeriod, calibration, initialTime=sim.time)
sim.run(splinedModel.endTime)
We need only data from accelerometer sensor:
(X, Y, Z) = range(3)The data will be printed in the (X, Y, Z) format.
measurements = imu.accelerometer.rawMeasurements
for t in range(len(measurements.timestamps)):
print (measurements.values[X][t], \
measurements.values[Y][t], \
measurements.values[Z][t])
No comments:
Post a Comment