Page 1 of 1

C3D Export Force Plates next to each other

Posted: Mon Feb 18, 2019 1:01 am
by hossein
Hi all,

I have two force plates next to each other. When I use c3dExport.m in Matlab via OpenSim 4., my force data (locations) seem to have an offset from the feet markers. I used all the options (e.g. COP = 1 etc in osimC3D(c3dpath, 1)).

I also get the following warning after this line is being executed in osimC3D.m file: tables = C3DFileAdapter().read(path2c3d, ForceLocation);

"[BTK WARNING] Origin for the force platform #1 seems to be located from the center of the working surface instead of the inverse. Data are inverted to locate the center of the working surface from the platform's origin."

I wonder if anyone had the same problem and how you think I can resolve it. Thanks a lot!

Cheers,
Hossein

Re: C3D Export Force Plates next to each other

Posted: Wed Feb 20, 2019 6:50 pm
by hossein
I have realised that there is always 0.45 (or 45cm) shift between marker positions and GRF (CoP location). I am trying to figure out where in the code things (marker positions or CoP locations) alter. However, I think the original code has been written to consider force plates one after the other not next to each other. I guess this shift may come from this issue. Am I right?

So I probably can just shift all my markers or Force locations to match,however, I am not sure if this is a good way of doing it.
Cheers,
Hossein

Re: C3D Export Force Plates next to each other

Posted: Thu Feb 28, 2019 9:25 pm
by hossein
Thanks to James to help me figure out that the shift is just the way GUI present data so the actual data is imported correctly.

Now I am filtering marker and force data and I have some issues:

I also asked Nick here: https://github.com/opensim-org/opensim-core/issues/2262

So, I am trying to filter TRC and Mot files from C3D file in OpenSim 4. I import it using Matlab API and try to filter markerStruct and forceStruct in Matlab but I see the following occurs:
java.lang.RuntimeException: Missing key 'DataRate'.

I use osimC3D.m and when osimTableToStruct.m gives me Matlab structures for forces and markers then I filter the data and want to convert it OpenSim using osimTableFromStruct.m , however, the above error happens.

How can I filter my data (c3d or Marker and Forces) in Matlab?

Thanks a lot
Cheers,
Hossein

Re: C3D Export Force Plates next to each other

Posted: Fri Mar 01, 2019 11:32 am
by jimmy
Steps to filter data;

(i) Use osimC3D.m to read a c3d file and get the data as Matlab Structs.
(ii) Use your own methods to filter the data in the Matlab Structs. Keep the data stored as Structs.
(iii) Convert the Structs to OpenSim Tables using osimTableFromStruct.m
(iv) Add required meta data back to opensim Table, in particular 'DataRate'.
(v) Use the TRCFileAdapter() and STOFIleApater() to write the marker and force tables, respectively, to file.

Notes:
- for (iv) see this example code for adding metadata to an OpenSim Table
- for (v) open osimC3D in your matlab editor to see how to use some of these functions. TRCFileAdapter and STOFileAdapter are used internally.

Re: C3D Export Force Plates next to each other

Posted: Sun Mar 03, 2019 11:37 pm
by hossein
These steps are great James! Thank you very much. I think I could import C3D and filter the data as well.I assume the reason you guys don't write the meta data back to OpenSim Table (using osimTableFromStruct.m) is to help the user choose their own meta data.

However, I have other issues which might not be OpenSim related necessarily. After importing the data I see that COP moves a lot at certain points. This might be due to Filtration in Matlab. I am still working on it.

Another issue is that when I even use Nexus (VIcon) to filter the GRF, I see that vertical GRF becomes negative at some points esp. when I filter several gait cycles together. Let's assume peak GRF is positive.

One way to resolve it is to shorten the ROI (region of interest) to avoid this issue in both Nexus and/or Matlab when I do filtering. I guess Tim's toolbox kind of considered it by avoiding overshooting and smoothing GRF differently during different gait events.

I am just wondering if anyone has any idea regarding filtering GRFs during several gait cycles.

Thanks a lot James again!

Cheers,
Hossein

Re: C3D Export Force Plates next to each other

Posted: Mon Mar 04, 2019 12:54 pm
by jimmy
I assume the reason you guys don't write the metadata back to OpenSim Table (using osimTableFromStruct.m) is to help the user choose their own metadata.
Pretty much. That data could be anything and I didn't want to make a decision for someone on what MetaData to include in the OpenSim table. I do feel we could have a better system though-- for example, the adapters should be able to read the data you pass them and generate the required metadata themselves. In the meantime, you could add some extra lines to the osimTableFromStruct.m function that autogenerates those metadata entries for you each time.
I see that vertical GRF becomes negative at some points esp. when I filter several gait cycles together. Let's assume peak GRF is positive.
This is pretty typical, especially if you are using a Butterworth filter. The overshoot can be rather pronounced. Most of the time, people will use the unfiltered force data to figure out when the foot is in contact with the plate, then after filtering, zero everything outside of those time points.

Every few months I come back to look at this biomch-l thread that has some great discussion. I did some quick analysis and feel that filtering joint torques, not input data, seems to be a viable method that should be investigated further-- just to find the time :roll:

Re: C3D Export Force Plates next to each other

Posted: Mon Mar 04, 2019 10:21 pm
by hossein
Great points James! Thanks for sharing them all with me.

I will read the biomch-l thread and I do agree with you that there should be a better way of handling data (e.g. filtration when and how!). It is also interesting idea to filter joint torque. Is this possible in Static Optimisation? Is there any reference that filters the joint torque?

I remember when I was doing impact loading trials during landing, I had problems then too (maybe worse than walking). Maybe we should find some time to really dig into this and come up with a better (more objective) solution. I will keep thinking and see how we can do this better.

Thanks again mate!
Cheers,
Hossein

Re: C3D Export Force Plates next to each other

Posted: Thu Jun 06, 2019 7:35 pm
by hossein
Hi James,

I hope this finds you well.

I have noticed that your osimC3D code only gets "markers, and forces". I think in the following line of your code below, we only get markers and forces not all other channels from C3D.

tables = C3DFileAdapter().read(path2c3d, ForceLocation)

Is there a way we can read other channels e.g. EMG, etc.

Kind regards,
Hossein

Re: C3D Export Force Plates next to each other

Posted: Fri Jun 07, 2019 11:24 am
by jimmy
OpenSim methods, C3DFileAdapter(), only read's marker and force data at the moment.