Orientation Tracking Setup
- Nicholas Vandenberg
- Posts: 71
- Joined: Wed Jan 20, 2021 12:47 pm
Orientation Tracking Setup
Hi all,
I recently started working with some IMU data that I'm trying to use with Moco, the good news being that there's a ton of data available but it's a bit like drinking out of a fire hose. The Xsens system we're using gives a ton of information and I've been able to adapt some conversion code from the native MVNX files to kinematics .mot files. However, (and this seems silly to say) I can only pull joint angle data from the MVN model joints which leaves gaps in various OpenSim model DOFs that don't have data to track (i.e., pelvis_tilt/list/rotation); resulting in solutions that aren't super great.
I have a question regarding the MocoOrientationTrackingGoal. I've used a variant of this goal in the past to assign a states trajectory for reference for the torso orientation. The description of this goal says that it can also take a trajectory in quaternion format, representing the orientation reference data which is provided in an array for all of the MVN model segments in each captured frame. I'm wondering if it's as straightforward as building a TimeSeriesTable of the quaternion data and adding a Pelvis_Orientation tracking goal to my problem? Or am I missing something else?
Thanks!
Nick
I recently started working with some IMU data that I'm trying to use with Moco, the good news being that there's a ton of data available but it's a bit like drinking out of a fire hose. The Xsens system we're using gives a ton of information and I've been able to adapt some conversion code from the native MVNX files to kinematics .mot files. However, (and this seems silly to say) I can only pull joint angle data from the MVN model joints which leaves gaps in various OpenSim model DOFs that don't have data to track (i.e., pelvis_tilt/list/rotation); resulting in solutions that aren't super great.
I have a question regarding the MocoOrientationTrackingGoal. I've used a variant of this goal in the past to assign a states trajectory for reference for the torso orientation. The description of this goal says that it can also take a trajectory in quaternion format, representing the orientation reference data which is provided in an array for all of the MVN model segments in each captured frame. I'm wondering if it's as straightforward as building a TimeSeriesTable of the quaternion data and adding a Pelvis_Orientation tracking goal to my problem? Or am I missing something else?
Thanks!
Nick
- Nicholas Bianco
- Posts: 1041
- Joined: Thu Oct 04, 2012 8:09 pm
Re: Orientation Tracking Setup
Hi Nick,
Yes, that should work! It's been a while since I wrote that cost term, so hopefully everything works as expected.
One quick thing: you might run into issues with the Matlab bindings not supporting a TimeSeriesTable of Quaternion or Rotation objects. I believe we fixed that recently, but let me know if it still doesn't work.
Best,
Nick
Yes, that should work! It's been a while since I wrote that cost term, so hopefully everything works as expected.
One quick thing: you might run into issues with the Matlab bindings not supporting a TimeSeriesTable of Quaternion or Rotation objects. I believe we fixed that recently, but let me know if it still doesn't work.
Best,
Nick
- Nicholas Vandenberg
- Posts: 71
- Joined: Wed Jan 20, 2021 12:47 pm
Re: Orientation Tracking Setup
Hey Nick,
I've tried working it up, pretty sure I've pulled the right section to construct the table itself and wrote up the goal: Is this what you were referring to about the table not being supported? I tried it with the TableProcessor after trying just the TimeSeriesTableQuaternion and normal TimeSeriesTable. If it's helpful I also included the .mot file that I made with the orientation data. I'm not sure if the issue is the type of table I'm trying to make or the data I'm trying to put in it.
Best,
Nick
I've tried working it up, pretty sure I've pulled the right section to construct the table itself and wrote up the goal: Is this what you were referring to about the table not being supported? I tried it with the TableProcessor after trying just the TimeSeriesTableQuaternion and normal TimeSeriesTable. If it's helpful I also included the .mot file that I made with the orientation data. I'm not sure if the issue is the type of table I'm trying to make or the data I'm trying to put in it.
Best,
Nick
- Attachments
-
- TFAB_02_SSWlk04_Xsens_PelQuat.mot
- (43.44 KiB) Downloaded 76 times
- Nicholas Bianco
- Posts: 1041
- Joined: Thu Oct 04, 2012 8:09 pm
Re: Orientation Tracking Setup
Hey Nick,
You can't load that data directly into a TimeSeriesTableQuaternion, since it's currently just a table of "scalar" columns. But you can load the data into a TimeSeriesTable, and then "pack" it into a table of quaternions.
-Nick
You can't load that data directly into a TimeSeriesTableQuaternion, since it's currently just a table of "scalar" columns. But you can load the data into a TimeSeriesTable, and then "pack" it into a table of quaternions.
Code: Select all
pelvisTable = TimeSeriesTable('TFAB_02_SSWlk04_Xsens_PelQuat.mot');
% The "pack" method will take each 4 consecutive columns and pack them into a Quaternion object. It will choose a % column name based on a common prefix across all columns.
pelvisTableQuaternion = pelvisTable.pack();
% If you know the suffixes for each group of 4 columns, you can specify them during the pack operation.
suffixes = StdVectorString();
suffixes.add("_e0");
suffixes.add("_e1");
suffixes.add("_e2");
suffixes.add("_e3");
pelvisTableQuaternion = pelvisTable.pack(suffixes);
- Nicholas Vandenberg
- Posts: 71
- Joined: Wed Jan 20, 2021 12:47 pm
Re: Orientation Tracking Setup
That makes sense, thanks! I've got that worked in now but I'm getting an error about too many output arguments when I use the pack function?
- Nicholas Bianco
- Posts: 1041
- Joined: Thu Oct 04, 2012 8:09 pm
Re: Orientation Tracking Setup
Could you post a screenshot of the error message?
- Nicholas Vandenberg
- Posts: 71
- Joined: Wed Jan 20, 2021 12:47 pm
Re: Orientation Tracking Setup
Here's the error I'm seeing
- Nicholas Bianco
- Posts: 1041
- Joined: Thu Oct 04, 2012 8:09 pm
Re: Orientation Tracking Setup
Ah, sorry -- you need to use the method "packQuaternion".
Code: Select all
pelvisTableQuaternion = pelvisTable.packQuaternion();
- Nicholas Vandenberg
- Posts: 71
- Joined: Wed Jan 20, 2021 12:47 pm
Re: Orientation Tracking Setup
Gotcha, that makes sense. I'm seeing this now, is it because there's header info or something? Not sure what's still missing.
- Attachments
-
- Pel_OTG_err.png (10.8 KiB) Viewed 1598 times
- Nicholas Bianco
- Posts: 1041
- Joined: Thu Oct 04, 2012 8:09 pm
Re: Orientation Tracking Setup
You need to provide column labels that have a common pattern so that OpenSim can auto-detect how to pack and name the columns. For quaternions, you could have column labels that end with "_e#", where # = 0, 1, 2, 3. For example: "pelvis_e0", "pelvis_e1", "pelvis_e2", "pelvis_e3". Then you can provide these suffixes (as in the example code above), or let OpenSim try to auto-detect (which it should be able to do after renaming).