Import of quaternion using TimeSeriesTableQuaternion in python

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

Import of quaternion using TimeSeriesTableQuaternion in python

Post by Swathi Gangaraju » Mon Jan 24, 2022 11:58 am

Hello,
I am using IMU other than Xsens and APDM. I have a csv file which contains quaternions of orientation. But I try to access the csv file using the below code. The code freezes for long time without any output. And I even tried many other methods which didn't work for me.

import opensim as osim
tables = osim.TimeSeriesTableQuaternion('out_static.csv')
print(tables)

It would be really helpful if anyone could lead me on how to proceed with reading the quaternion from csv file into opensim in python for creating .sto file.
Thank you

Tags:

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

Re: Import of quaternion using TimeSeriesTableQuaternion in python

Post by Ayman Habib » Wed Jan 26, 2022 2:14 pm

Hi Swathi,

The syntax looks correct (trying to construct a TimeSeriesTable from a .csv file), the issue likely has to do with the contents of the file, which you didn't include. It maybe misleading in the documentation to imply that we can handle reading arbitrary .csv file contents. Typically the files we use have a specific header, a row of labels that matches the number of data columns in the file etc. The fact that you're trying to read Quaternions (which we typically write/read as a comma separated quadruple x,y,z,w) is a bit more tricky for csv which is comma delimited. My suggestion would be to create the TimeSeriesTableQuaternion in memory using synthetic data, then use the write methods to create .csv or .sto file and inspect it for the expected layout. We should be able to read the same files we write. If not please open an issue and attach the relevant files and we'll investigate.

Please let us know how that goes,
-Ayman

POST REPLY