IMU frame to OpenSim frame coordinate mapping

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Swathi Gangaraju
Posts: 4
Joined: Wed Nov 17, 2021 12:11 pm

IMU frame to OpenSim frame coordinate mapping

Post by Swathi Gangaraju » Tue Feb 15, 2022 2:40 pm

Hello,
I am confused on how the coordinate system are changing from IMU frame to OpenSim frame.
The below code is from the paper 'OpenSense: An open-source toolbox for Inertial-Measurement-Unit-based measurement of lower extremity kinematics over long durations'.

Especially why there is rotation around X(line 8) and again around Z(line 16). And what is the coordinates of IMU in IMU frame. A brief explanation on this snippet would be helpful. Thanks !

1 model = Model(modelFile_posed);
2 s = model.initSystem();
3 model.realizePosition(s);
4 osense = OpenSenseUtilities();

5 c = CoordinateDirection(CoordinateAxis(2),1);
6 oTableHC = TimeSeriesTableQuaternion(orientationsFileName);
7 R_HG = Rotation();
8 R_HG.setRotationFromAngleAboutX(-pi/2);
9 osense.rotateOrientationTable(oTableHC, R_HG);

10 v = OpenSenseUtilities.computeHeadingCorrection(model, s, oTableHC, baseIMUName, c);
11 computedAngularCorrection = v.get(1) * 180/pi;

12 osense = OpenSenseUtilities();
13 oTable = TimeSeriesTableQuaternion(orientationsFileName);
14 angularCorrection = computedAngularCorrection - pelvis_rotation;
15 R_HG = Rotation();
16 R_HG.setRotationFromAngleAboutZ(deg2rad( angularCorrection ));

17 osense.rotateOrientationTable(oTable, R_HG);
18 rotatedOrientations = strcat(ground_path,'walking/IMU/xsens/walking_orientations.sto');
19 STOFileAdapterQuaternion.write(oTable, rotatedOrientations);

Tags:

POST REPLY