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'])
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