Question about the position for force data

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Feras Kiki
Posts: 10
Joined: Sun Jul 17, 2022 12:16 pm

Question about the position for force data

Post by Feras Kiki » Wed Sep 13, 2023 11:11 pm

Hi all,
I have a question regarding force data file preparation and specifically the position part px, py, pz. I noticed that it is following a different scale of magnitude and even in Gait2354_Simbody the values where less than 0 usually despite the fact that the motion data is usually in the order of 100s. Why is the file like that and how can I transform the position to this format ?
My motion data is working fine in its .trc file, but I don't know what to do with the force file.

example values in the files:
0.37898285 -0.0075 0.12774652

All your help is much appreciated
Attachments
force.png
force.png (7.41 KiB) Viewed 761 times

Tags:

User avatar
John Davis
Posts: 59
Joined: Mon Aug 26, 2019 7:42 am

Re: Question about the position for force data

Post by John Davis » Thu Sep 14, 2023 10:36 am

The _px, _py, _pz fields are the location of the center of pressure of the GRF - Unlike markers, which are by default in mm, force positions are expressed in meters, and are almost always expressed relative to the location of the global coordinate system (the axes you see in the GUI viewer). So when they are below zero they just mean they are negative on that axis. I think there's a flag somewhere in the .trc file header where you can express marker data as m instead if you want, but force data are always in meters (or Nm for torques). The _vx, _vy, _vz components are the vector components of the force, in Newtons.

When you represent a GRF in the standard OpenSim format, it's important to also include the free moment as a _my component (the _mx, _my, _mz are the torque components of the force). There is an alternative (and equivalent) way of doing it where you only use raw forces and moments applied directly at the global origin (and _px,_py,_pz are all zero, always), which has some computational advantages, but then you can't use the GUI visualizer to make sure your forces are actually lining up with your marker data (it's very easy to get them turned 90 degrees on accident).

So if you use the normal vector component + CoP + free moment representation, for each force, you'll have nine fields in the .mot file: _vx, _vy, _vz, _px, _py, _pz, _mx, _my, _mz. If you are using a force plate flush against the ground and you've followed the force plate's technical spec sheet to transform them to GRF + center of pressure + free moment, expressed relative to the global coordinate system, your _py, _mx, and _mz fields will *always* be zero. But I think you have to include them in the file anyways.

Getting force data into Osim compatible .mot files has always been the most challenging part of a simulation project that uses mocap data, in my experience. Not all motion capture software systems support direct exporting to .trc/.mot files, and the c3d reader in the OpenSim API doesn't always import force data correctly. On top of that, you generally want to do your preprocessing (filtering, step detection, assigning forces to left or right foot if doing gait) *before* transforming your force to the vector + CoP + free moment representation anyways, and different force plates have their own weird quirks. Plus there are many other weird gotchas you need to watch out for, like small negative vertical GRFs crashing your simulations from filter overshoot, and NaN values in the CoP from dividing by zero. So I can never avoid doing a lot of MATLAB/python hacking before getting the .mot file I want. I have some demo scripts, links, and notes on my GitHub here, maybe you'll find them helpful.

User avatar
Neha Sahu
Posts: 38
Joined: Sun Oct 10, 2021 7:54 pm

Re: Question about the position for force data

Post by Neha Sahu » Mon Feb 19, 2024 8:04 am

hi, i am using single force plate, with opencap marker data , can i use the github file for single force plate processing and finding the cop location for opensim model for squat lift.

POST REPLY