Forward kinematic

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
anna bicchi
Posts: 7
Joined: Mon Nov 25, 2019 1:34 pm

Forward kinematic

Post by anna bicchi » Tue May 18, 2021 1:38 am

Hi everyone,
I'm wondering if it possible from a .mot file to generate the markers trajectories of the model (a .trc file).
Anyone did this before?
Thank you in advance :) Anna

Tags:

User avatar
Thomas Uchida
Posts: 1794
Joined: Wed May 16, 2012 11:40 am

Re: Forward kinematic

Post by Thomas Uchida » Tue May 18, 2021 8:57 am

The Inverse Kinematics Tool should do this if you set the "report_marker_locations" flag to "true":

Code: Select all

<InverseKinematicsTool>
    <!--Directory used for writing results.-->
    <results_directory>./</results_directory>
    <!--Directory for input files-->
    <input_directory />
    <!--Name of the model file (.osim) to use for inverse kinematics.-->
    <model_file>Unassigned</model_file>
    <!--A positive scalar that weights the relative importance of satisfying constraints. A weighting of 'Infinity' (the default) results in the constraints being strictly enforced. Otherwise, the weighted-squared constraint errors are appended to the cost function.-->
    <constraint_weight>Inf</constraint_weight>
    <!--The accuracy of the solution in absolute terms. Default is 1e-5. It determines the number of significant digits to which the solution can be trusted.-->
    <accuracy>1.0000000000000001e-05</accuracy>
    <!--Markers and coordinates to be considered (tasks) and their weightings. The sum of weighted-squared task errors composes the cost function.-->
    <IKTaskSet>
    <objects />
    <groups />
    </IKTaskSet>
    <!--TRC file (.trc) containing the time history of observations of marker positions obtained during a motion capture experiment. Markers in this file that have a corresponding task and model marker are included.-->
    <marker_file>Unassigned</marker_file>
    <!--The name of the storage (.sto or .mot) file containing the time history of coordinate observations. Coordinate values from this file are included if there is a corresponding model coordinate and task. -->
    <coordinate_file>Unassigned</coordinate_file>
    <!--The desired time range over which inverse kinematics is solved. The closest start and final times from the provided observations are used to specify the actual time range to be processed.-->
    <time_range> -inf inf</time_range>
    <!--Flag (true or false) indicating whether or not to report marker errors from the inverse kinematics solution.-->
    <report_errors>true</report_errors>
    <!--Name of the resulting inverse kinematics motion (.mot) file.-->
    <output_motion_file>Unassigned</output_motion_file>
    <!--Flag indicating whether or not to report model marker locations. Note, model marker locations are expressed in Ground.-->
    <report_marker_locations>false</report_marker_locations>
</InverseKinematicsTool>

User avatar
anna bicchi
Posts: 7
Joined: Mon Nov 25, 2019 1:34 pm

Re: Forward kinematic

Post by anna bicchi » Mon May 24, 2021 2:45 am

Thank you very much for your kindness.
I have just one more question, if I haven't the .trc file with the markers trajectories, is it possible to do that with just a .mot file instead?
Last edited by anna bicchi on Mon May 24, 2021 6:43 am, edited 3 times in total.

User avatar
anna bicchi
Posts: 7
Joined: Mon Nov 25, 2019 1:34 pm

Re: Forward kinematic

Post by anna bicchi » Mon May 24, 2021 2:57 am

tkuchida wrote:
Tue May 18, 2021 8:57 am
The Inverse Kinematics Tool should do this if you set the "report_marker_locations" flag to "true":

Code: Select all

<InverseKinematicsTool>
    <!--Directory used for writing results.-->
    <results_directory>./</results_directory>
    <!--Directory for input files-->
    <input_directory />
    <!--Name of the model file (.osim) to use for inverse kinematics.-->
    <model_file>Unassigned</model_file>
    <!--A positive scalar that weights the relative importance of satisfying constraints. A weighting of 'Infinity' (the default) results in the constraints being strictly enforced. Otherwise, the weighted-squared constraint errors are appended to the cost function.-->
    <constraint_weight>Inf</constraint_weight>
    <!--The accuracy of the solution in absolute terms. Default is 1e-5. It determines the number of significant digits to which the solution can be trusted.-->
    <accuracy>1.0000000000000001e-05</accuracy>
    <!--Markers and coordinates to be considered (tasks) and their weightings. The sum of weighted-squared task errors composes the cost function.-->
    <IKTaskSet>
    <objects />
    <groups />
    </IKTaskSet>
    <!--TRC file (.trc) containing the time history of observations of marker positions obtained during a motion capture experiment. Markers in this file that have a corresponding task and model marker are included.-->
    <marker_file>Unassigned</marker_file>
    <!--The name of the storage (.sto or .mot) file containing the time history of coordinate observations. Coordinate values from this file are included if there is a corresponding model coordinate and task. -->
    <coordinate_file>Unassigned</coordinate_file>
    <!--The desired time range over which inverse kinematics is solved. The closest start and final times from the provided observations are used to specify the actual time range to be processed.-->
    <time_range> -inf inf</time_range>
    <!--Flag (true or false) indicating whether or not to report marker errors from the inverse kinematics solution.-->
    <report_errors>true</report_errors>
    <!--Name of the resulting inverse kinematics motion (.mot) file.-->
    <output_motion_file>Unassigned</output_motion_file>
    <!--Flag indicating whether or not to report model marker locations. Note, model marker locations are expressed in Ground.-->
    <report_marker_locations>false</report_marker_locations>
</InverseKinematicsTool>
Thank you very much for your kindness.
I have just one more question, if I haven't the .trc file with the markers trajectories, is it possible to do that with just a .mot file instead?

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

Re: Forward kinematic

Post by Ayman Habib » Mon May 24, 2021 11:02 am

Hello,

If you want to report marker trajectories you can use the PointKinematics Analysis and add a point for each model marker you want reported.

Alternatively you can use OutputReporter which can report the outputs of any OpenSim model component (Markers included). You can find an example of how to specify outputs here:
https://simtk-confluence.stanford.edu/d ... Simulation
The names and types of Outputs of a Marker are shown on the Outputs tab of the Properties window in the OpenSim Application {location, velocity, acceleration}.

Hope this helps,
-Ayman

POST REPLY