Using IMU Data reporter in MATLAB

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Grace M
Posts: 27
Joined: Thu Jul 28, 2016 11:11 am

Using IMU Data reporter in MATLAB

Post by Grace M » Thu Sep 30, 2021 7:01 pm

Hi there,

I am not sure if this should be on the main or OpenSim Moco forum but hoping someone can help!

I am using OpenSim 4.3 and trying to understand the new IMU data reporter. I have been using OpenSim Moco to run a simulation with IMUs placed on the model. I have then extracted the acceleration signals as a TimeSeriesVec3 table (and .sto file). I would also like to get orientations and gyroscope signals if possible to be used in future simulations. I am wondering how to code this in MATLAB. This is what I use to get the signals:

Code: Select all

predictSolution = MocoTrajectory(solnfile); 
prevStatesTable= predictSolution.exportToStatesTable(); % Extract previous solution's states
prevControlsTable = predictSolution.exportToControlsTable(); % Extract previous solution's controls
%%acceleration output
outputPaths = StdVectorString();
outputPaths.add('.*accelerometer_signal');

accelerometerSignals = opensimSimulation.analyzeVec3(studyModel, ...
    prevStatesTable, ...
    prevControlsTable, ...
    outputPaths);
imuFramePaths = StdVectorString();
imuFramePaths.add('/bodyset/torso/torso_imu_offset');
imuFramePaths.add('/bodyset/femur_r/femur_r_imu_offset');
imuFramePaths.add('/bodyset/tibia_r/tibia_r_imu_offset');
accelerometerSignals.setColumnLabels(imuFramePaths);
sto = STOFileAdapterVec3();
sto.write(accelerometerSignals,[outputPath filesep solname '_accel.sto'])
I am not so familiar with C++ and how to use the reporter. I have tried:
IMUReporter=IMUDataReporter()
IMUReporter.getGyroscopeSignalsTable(accelerometerSignals)
But get the error:
Check for incorrect argument data type or missing argument in call to function 'getGyroscopeSignalsTable'.


Thanks,
Grace

Tags:

POST REPLY