Orientation Tracking Setup

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
User avatar
Nicholas Vandenberg
Posts: 71
Joined: Wed Jan 20, 2021 12:47 pm

Re: Orientation Tracking Setup

Post by Nicholas Vandenberg » Mon Aug 28, 2023 12:39 pm

I thought I was doing that like this?
Pel_OTG_file.png
Pel_OTG_file.png (19.04 KiB) Viewed 1620 times
Tried with the basic 'packQuaternion' with these names, then tried it with the suffixes sample code you shared. I'm still getting the previous error I shared.

User avatar
Nicholas Bianco
Posts: 1041
Joined: Thu Oct 04, 2012 8:09 pm

Re: Orientation Tracking Setup

Post by Nicholas Bianco » Mon Aug 28, 2023 1:14 pm

I think the issue is that there's an empty row between "endheader" and the column labels row. Remove that and give it a try again.

User avatar
Nicholas Vandenberg
Posts: 71
Joined: Wed Jan 20, 2021 12:47 pm

Re: Orientation Tracking Setup

Post by Nicholas Vandenberg » Mon Aug 28, 2023 1:55 pm

Still not working, unfortunately. I opened up the TimeSeriesTable that I'm trying to 'pack'
Pel_OTG_file.png
Pel_OTG_file.png (19.85 KiB) Viewed 1599 times
Could it be having some issue with that first column that's being created without any label?

User avatar
Nicholas Bianco
Posts: 1041
Joined: Thu Oct 04, 2012 8:09 pm

Re: Orientation Tracking Setup

Post by Nicholas Bianco » Tue Aug 29, 2023 3:22 pm

I think that first column is just visualizing the row indexes, I don't think it's an actual column.

I'm still a little stumped. Can you load the data as-is into a TimeSeriesTable and then save it again to a new file to see if the formatting changes?

User avatar
Nicholas Vandenberg
Posts: 71
Joined: Wed Jan 20, 2021 12:47 pm

Re: Orientation Tracking Setup

Post by Nicholas Vandenberg » Tue Aug 29, 2023 4:15 pm

Figured that wasn't it but I'm pretty stumped as well. I saved the TimeSeriesTable as an .sto that I can't upload, but re-saved that as an excel workbook (attached). I can't see anything in it unless some of the header info is 'unexpected'?
Attachments
PelvisTable.xlsx
(68.16 KiB) Downloaded 90 times

User avatar
Grace M
Posts: 27
Joined: Thu Jul 28, 2016 11:11 am

Re: Orientation Tracking Setup

Post by Grace M » Tue Aug 29, 2023 5:25 pm

I am tracking IMUs with Moco and have attached a example file which might be helpful for comparison. (It is normally a .sto but changed to a .txt to attach. )
The header is:
DataRate=2000
DataType=Quaternion
version=3
OpenSimVersion=4.4
endheader
time /bodyset/torso/torso_imu_offset /bodyset/pelvis/pelvis_imu_offset .... etc
Attachments
orientations_Quaternions.txt
(471.64 KiB) Downloaded 115 times

User avatar
Nicholas Bianco
Posts: 1041
Joined: Thu Oct 04, 2012 8:09 pm

Re: Orientation Tracking Setup

Post by Nicholas Bianco » Wed Aug 30, 2023 10:37 am

Thanks Grace!

I'm wondering if OpenSim is not handling the older SIMM-style header correctly. Try updating the format Grace posted and see if that works.

User avatar
Nicholas Vandenberg
Posts: 71
Joined: Wed Jan 20, 2021 12:47 pm

Re: Orientation Tracking Setup

Post by Nicholas Vandenberg » Thu Aug 31, 2023 10:48 am

Thanks for sharing Grace! I tried updating my header, unfortunately I'm still getting an error where it doesn't like the 'DataType=Quaternion'

Error using IMU_TD_Walk (line 141)
Java exception occurred:
java.lang.RuntimeException: expected = double received = Quaternion
Thrown at DelimFileAdapter.h:355 in extendRead().

at
org.opensim.modeling.opensimCommonJNI.new_TimeSeriesTable__SWIG_5(Native
Method)

at
org.opensim.modeling.TimeSeriesTable.<init>(TimeSeriesTable.java:61)

Not sure if this now comes down to how I create the file or what's going on?

User avatar
Nicholas Vandenberg
Posts: 71
Joined: Wed Jan 20, 2021 12:47 pm

Re: Orientation Tracking Setup

Post by Nicholas Vandenberg » Thu Aug 31, 2023 11:58 am

I tried altering my conversion code so that it will print the new header as opposed to the previous header, as well as printing separate files for the joint angles (DataType=double) and pelvis orientations (DataType=quaternion). I am now unable to load these into my Moco problem, even the joint angles come back with:

Error using IMU_TD_Walk (line 91)
Java exception occurred:
java.lang.RuntimeException: expected = double received = double
Thrown at DelimFileAdapter.h:355 in extendRead().

at org.opensim.modeling.opensimMocoJNI.MocoTrack_initialize(Native Method)

at org.opensim.modeling.MocoTrack.initialize(MocoTrack.java:549)

I'm at a loss here

User avatar
Nicholas Bianco
Posts: 1041
Joined: Thu Oct 04, 2012 8:09 pm

Re: Orientation Tracking Setup

Post by Nicholas Bianco » Thu Aug 31, 2023 1:33 pm

Editing STO files by hand can be very error prone (as you are now discovering). It would be better to start over and use the API as much as possible.

Is it possible to load the existing data into a regular TimeSeriesTable? From there we should be able to save it to a new file which would be in the proper format. From there we can use the API for pack operations, or create a TimeSeriesTableQuaternion. If it comes to the latter approach, I can write a code snippet for that.

POST REPLY