User Tools

Site Tools


visual3d:documentation:kinematics_and_kinetics:opensim

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
visual3d:documentation:kinematics_and_kinetics:opensim [2024/10/25 16:09] – Big clean-up. wikisysopvisual3d:documentation:kinematics_and_kinetics:opensim [2025/03/12 14:25] (current) wikisysop
Line 1: Line 1:
-===== OpenSim =====+====== OpenSim ======
  
 Visual3D allows the user to export OpenSim compatible motion files designed for use with OpenSim gait models. The Visual3D-to-OpenSim integration is based on the OpenSim tutorial [[https://opensimconfluence.atlassian.net/wiki/spaces/OpenSim/pages/53088700/Tutorial+1+-+Intro+to+Musculoskeletal+Modeling|"Intro to Musculoskeletal Modeling”]]. It is assumed that the user is familiar with this tutorial and the files used in this process. Visual3D allows the user to export OpenSim compatible motion files designed for use with OpenSim gait models. The Visual3D-to-OpenSim integration is based on the OpenSim tutorial [[https://opensimconfluence.atlassian.net/wiki/spaces/OpenSim/pages/53088700/Tutorial+1+-+Intro+to+Musculoskeletal+Modeling|"Intro to Musculoskeletal Modeling”]]. It is assumed that the user is familiar with this tutorial and the files used in this process.
Line 5: Line 5:
 Visual3D exports an OpenSim compatible motion file, named Visual3D_SIMM_input.mot, which bypasses OpenSim's Scaling and Inverse Kinematics (IK) and can be used directly by OpenSim's Residual Reduction Algorithm. Visual3D exports an OpenSim compatible motion file, named Visual3D_SIMM_input.mot, which bypasses OpenSim's Scaling and Inverse Kinematics (IK) and can be used directly by OpenSim's Residual Reduction Algorithm.
  
-==== Modeling Requirements ====+===== Modeling Requirements =====
  
 The following model requirements must all be met. Please read the requirements carefully: The following model requirements must all be met. Please read the requirements carefully:
Line 16: Line 16:
 See [[Visual3D:Documentation:Third-Party:OpenSim:Virtual_Lab_for_OpenSim|Virtual_Lab_For_OpenSim]] for an example of how to create of Visual3D v3d_lab. See [[Visual3D:Documentation:Third-Party:OpenSim:Virtual_Lab_for_OpenSim|Virtual_Lab_For_OpenSim]] for an example of how to create of Visual3D v3d_lab.
  
-=== Pose Estimation in Visual3D ===+==== Pose Estimation in Visual3D ====
  
 Visual3D offers two methods of pose estimation: 1) [[visual3d:documentation:kinematics_and_kinetics:six_degrees_of_freedom|6 degree of freedom]] (based on Spoor and Veldpaus, 1980) and 2) [[visual3d:documentation:kinematics_and_kinetics:inverse_kinematics|Inverse Kinematics]] (based on Lu and O'Connor, 1999). Any 6-degree of freedom joint in Visual3D is transformed into OpenSim's gait model constraints by applying the Inverse Kinematics method fit to the model using the constraints specified in the OpenSim gait23*.osim file: Visual3D offers two methods of pose estimation: 1) [[visual3d:documentation:kinematics_and_kinetics:six_degrees_of_freedom|6 degree of freedom]] (based on Spoor and Veldpaus, 1980) and 2) [[visual3d:documentation:kinematics_and_kinetics:inverse_kinematics|Inverse Kinematics]] (based on Lu and O'Connor, 1999). Any 6-degree of freedom joint in Visual3D is transformed into OpenSim's gait model constraints by applying the Inverse Kinematics method fit to the model using the constraints specified in the OpenSim gait23*.osim file:
Line 27: Line 27:
  
  
-=== Visual3D-to-OpenSim Inverse Kinematics ===+==== Visual3D-to-OpenSim Inverse Kinematics ====
  
 Visual3D’s ability to write OpenSim compatible .mot files is based on Visual3D’s own Inverse Kinetics algorithm. The theory behind the Visual3D to OpenSim Inverse Kinematics is a three stage process: Visual3D’s ability to write OpenSim compatible .mot files is based on Visual3D’s own Inverse Kinetics algorithm. The theory behind the Visual3D to OpenSim Inverse Kinematics is a three stage process:
Line 39: Line 39:
 Visual3d does manual scaling on all segments and does its own IK, thus many of the OpenSim files related to the Marker Set, Scaling and IK are no longer required. Visual3d does manual scaling on all segments and does its own IK, thus many of the OpenSim files related to the Marker Set, Scaling and IK are no longer required.
  
-=== Model Scaling ===+==== Model Scaling ====
  
 Visual3D automatically scales the OpenSim model by: Visual3D automatically scales the OpenSim model by:
Line 56: Line 56:
 | Torso, Calcaneus and Toes | Most users build their feet without markers at the very end of the foot and at the top of the head. Visual3D therefore uses the average thigh length to scale these segments. (Physical anthropometry studies have shown thigh length is a somewhat strongly correlated with height). | | Torso, Calcaneus and Toes | Most users build their feet without markers at the very end of the foot and at the top of the head. Visual3D therefore uses the average thigh length to scale these segments. (Physical anthropometry studies have shown thigh length is a somewhat strongly correlated with height). |
  
-==== Visual3D-to-OpenSim Exports ====+===== Visual3D-to-OpenSim Exports =====
  
 The Visual3D-to-OpenSim process is designed according to the OpenSim tutorial "Intro to Musculoskeletal Modeling". This requires special versions of several OpenSim xml input to be created, so Visual3D will create a number of new OpenSim xml files as part of any OpenSim export: The Visual3D-to-OpenSim process is designed according to the OpenSim tutorial "Intro to Musculoskeletal Modeling". This requires special versions of several OpenSim xml input to be created, so Visual3D will create a number of new OpenSim xml files as part of any OpenSim export:
Line 64: Line 64:
   - [[Visual3D:Documentation:OpenSim:Scale_ScaleSet|Visual3D_Scale_ScaleSet]]   - [[Visual3D:Documentation:OpenSim:Scale_ScaleSet|Visual3D_Scale_ScaleSet]]
  
-=== Correcting the Lumbar Tilt in the Exported Motion File ===+==== Correcting the Lumbar Tilt in the Exported Motion File ====
  
 Visual3D's export dialog allows the user to specify a correction angle for the lumbar flexion/extension angle exported to OpenSim. (The edit box is labeled "Lumbar Tilt" in the export dialog.) Generally the lumbar flexion/extension correction is needed only if the user has trouble getting the trunk Z axis lined up properly during subject calibration. (It is often hard to accurately locate the proximal end of the trunk, down by the pelvis, thus the trunk often leans too far forward or backward in Visual3d.) One way to compute an appropriate lumbar adjustment is to build your model in Visual3d and then load a copy of the subject calibration c3d file into Visual3d as movement trial. You can then ask Visual3d to compute the JOINT_ANGLE of the trunk relative to the ground during subject calibration. If you believe you subject was standing straight during calibration then multiply this angle by -1 and use that value as your "Lumbar Tilt". Visual3D's export dialog allows the user to specify a correction angle for the lumbar flexion/extension angle exported to OpenSim. (The edit box is labeled "Lumbar Tilt" in the export dialog.) Generally the lumbar flexion/extension correction is needed only if the user has trouble getting the trunk Z axis lined up properly during subject calibration. (It is often hard to accurately locate the proximal end of the trunk, down by the pelvis, thus the trunk often leans too far forward or backward in Visual3d.) One way to compute an appropriate lumbar adjustment is to build your model in Visual3d and then load a copy of the subject calibration c3d file into Visual3d as movement trial. You can then ask Visual3d to compute the JOINT_ANGLE of the trunk relative to the ground during subject calibration. If you believe you subject was standing straight during calibration then multiply this angle by -1 and use that value as your "Lumbar Tilt".
  
-=== Exported Joint Angles ===+==== Exported Joint Angles ====
  
 The angles that are exported to OpenSim are slightly different than the angles calculated in Visual3D because the Inverse Kinematics model used in the Visual3D-to-OpenSim export is a special version of Visual3D's IK model that exactly matches the gait2354 or gait2392 osim models. The angles that are exported to OpenSim are slightly different than the angles calculated in Visual3D because the Inverse Kinematics model used in the Visual3D-to-OpenSim export is a special version of Visual3D's IK model that exactly matches the gait2354 or gait2392 osim models.
Line 80: Line 80:
 If you look at the osim file you will see that the knee motion, the hip center location and the ankle/subtalar angles are defined and the Visual3D OpenSim IK export model matches these osim files. Thus using a traditional Visual3D IK you will not get exactly the same angles as you get from an OpenSim export. You can skew the ankle and subtalar axes in Visual3D to match OpenSim axes using the "Direction of Rots" button and you probably can even create a hip center in the correct location but there is no way to specify the knee translation as function of knee angle - this is hard-coded inside Visual3D for the OpenSim export. Thus no matter how hard you try you can never get an exact match between a standard Visual3D IK and an OpenSim export IK. If you look at the osim file you will see that the knee motion, the hip center location and the ankle/subtalar angles are defined and the Visual3D OpenSim IK export model matches these osim files. Thus using a traditional Visual3D IK you will not get exactly the same angles as you get from an OpenSim export. You can skew the ankle and subtalar axes in Visual3D to match OpenSim axes using the "Direction of Rots" button and you probably can even create a hip center in the correct location but there is no way to specify the knee translation as function of knee angle - this is hard-coded inside Visual3D for the OpenSim export. Thus no matter how hard you try you can never get an exact match between a standard Visual3D IK and an OpenSim export IK.
  
-=== Exported Force and Free Moment ===+==== Exported Force and Free Moment ====
  
 Visual3D exports the FORCE and FREEMOMENT signals that are found in the data tree. Visual3D exports the FORCE and FREEMOMENT signals that are found in the data tree.
  
-=== Exported Center of Pressure ===+==== Exported Center of Pressure ====
  
 After the Inverse Kinematics (IK) fit, the entire model could move relative to the center of pressure thus leaving the IK fit with a significant effect on the moments at the ankle, knee and hip. To counteract this Visual3D first computes and stores the local coordinates of the center of pressure in the foot coordinate system (pre-IK) whenever a foot is in contact with the plate. Then after the IK fit is complete Visual3D retrieves the pre-IK coordinates of the COP and transforms them from the post-IK foot coordinate system into lab space. Thus if the vertical component of the COP in the output .mot file you will not lie flat along the floor (or treadmill); however if look at the distance from the center of pressure to the ankle in OpenSim it should look OK. (Remember the model itself can move up and down in OpenSim, so the location of the COP under the foot is what matters not the COP coordinates in lab space.) After the Inverse Kinematics (IK) fit, the entire model could move relative to the center of pressure thus leaving the IK fit with a significant effect on the moments at the ankle, knee and hip. To counteract this Visual3D first computes and stores the local coordinates of the center of pressure in the foot coordinate system (pre-IK) whenever a foot is in contact with the plate. Then after the IK fit is complete Visual3D retrieves the pre-IK coordinates of the COP and transforms them from the post-IK foot coordinate system into lab space. Thus if the vertical component of the COP in the output .mot file you will not lie flat along the floor (or treadmill); however if look at the distance from the center of pressure to the ankle in OpenSim it should look OK. (Remember the model itself can move up and down in OpenSim, so the location of the COP under the foot is what matters not the COP coordinates in lab space.)
  
-=== Exporting Other Models ===+==== Exporting Other Models ====
  
 Visual3D's default export to OpenSim only supports the OpenSim "gait_2392.osim" and "gait_2354.osim" models. This means in Visual3D you must have all the segments required for these models. It is possible to define your own custom OpenSim model in Visual3D, and export the MOT files by going to "File -> Export OpenSim From Data Tree". However, this process requires an experienced Visual3D and OpenSim user who knows how to create a Visual3D IK that matches the degrees of freedom in their OpenSim model. The user must also be able to read their osim file to determine the names of the data that need to be copied into the Visual3d OPEN_SIM, OPEN_SIM_GRF and Metric::Open_Sim_Scale folders. An example of this can be found [[Visual3D:Documentation:Third-Party:OpenSim:Manual_OpenSim|here]]. Visual3D's default export to OpenSim only supports the OpenSim "gait_2392.osim" and "gait_2354.osim" models. This means in Visual3D you must have all the segments required for these models. It is possible to define your own custom OpenSim model in Visual3D, and export the MOT files by going to "File -> Export OpenSim From Data Tree". However, this process requires an experienced Visual3D and OpenSim user who knows how to create a Visual3D IK that matches the degrees of freedom in their OpenSim model. The user must also be able to read their osim file to determine the names of the data that need to be copied into the Visual3d OPEN_SIM, OPEN_SIM_GRF and Metric::Open_Sim_Scale folders. An example of this can be found [[Visual3D:Documentation:Third-Party:OpenSim:Manual_OpenSim|here]].
  
-=== Comparing Visual3D and SIMM exporting to OpenSim ===+==== Comparing Visual3D and SIMM exporting to OpenSim ====
  
 Visual3D and SIMM each accomplish a different task. You can think of the process of generating muscle driving simulations in OpenSim as occurring in three steps: Visual3D and SIMM each accomplish a different task. You can think of the process of generating muscle driving simulations in OpenSim as occurring in three steps:
Line 104: Line 104:
 Visual3D comes in at step 2. Visual3D is not required for step 2 especially if you are using the default Open marker set; however if you deviate from the expected marker set then importing the motion capture and force plate data into OpenSim can be a very cumbersome process. Visual3D will also allow you to do many, many more standard kinematic and kinetic analyses from your motion capture data then are available in OpenSim. In short Visual3D will quickly export walking and running data into OpenSim while simultaneously providing you with a large number of kinematic, kinetic and data analysis tools. Visual3D comes in at step 2. Visual3D is not required for step 2 especially if you are using the default Open marker set; however if you deviate from the expected marker set then importing the motion capture and force plate data into OpenSim can be a very cumbersome process. Visual3D will also allow you to do many, many more standard kinematic and kinetic analyses from your motion capture data then are available in OpenSim. In short Visual3D will quickly export walking and running data into OpenSim while simultaneously providing you with a large number of kinematic, kinetic and data analysis tools.
  
-=== OpenSim Joint Moments and Joint Load ===+==== OpenSim Joint Moments and Joint Load ====
  
 You can get the Inverse Dynamics directly out of OpenSim using the "Inverse Dynamics.." tool which is located under the Tools menu. Once you Open the Inverse Dynamics tool in OpenSim load the attached xml file and run tool. The output will go to the ResultsInverseDynamics subfolder. The one thing you do need to do before running the Inverse Dynamics tool is modify the initial and final time in the attached xml so that they are a little shorter the time found .mot file you have loaded. You can get the Inverse Dynamics directly out of OpenSim using the "Inverse Dynamics.." tool which is located under the Tools menu. Once you Open the Inverse Dynamics tool in OpenSim load the attached xml file and run tool. The output will go to the ResultsInverseDynamics subfolder. The one thing you do need to do before running the Inverse Dynamics tool is modify the initial and final time in the attached xml so that they are a little shorter the time found .mot file you have loaded.
Line 110: Line 110:
 **NOTE**: Before running OpenSim's Inverse Dynamics tool you need to load the osim model, scale the model and load the .mot file exported by Visual3D. **NOTE**: Before running OpenSim's Inverse Dynamics tool you need to load the osim model, scale the model and load the .mot file exported by Visual3D.
  
-==== Compatibility ====+===== Compatibility =====
  
   - Visual3D v4.0 - The basic Visual3D-to-OpenSim integration is available.   - Visual3D v4.0 - The basic Visual3D-to-OpenSim integration is available.
Line 121: Line 121:
   - OpenSim 4.0 - IOpening (File -> Load Motion) the Visual3d_SIMM_input.mot file in previous versions of OpenSim loaded the states and ground reaction data were applied. As of OpenSim 4.0, you need to load the Visual3d_SIMM_input.mot file, then [[https://opensimconfluence.atlassian.net/wiki/spaces/OpenSim/pages/53089193/Associating+Data+with+a+Motion|associate the Visual3d_SIMM_grf.mot file using these steps]].   - OpenSim 4.0 - IOpening (File -> Load Motion) the Visual3d_SIMM_input.mot file in previous versions of OpenSim loaded the states and ground reaction data were applied. As of OpenSim 4.0, you need to load the Visual3d_SIMM_input.mot file, then [[https://opensimconfluence.atlassian.net/wiki/spaces/OpenSim/pages/53089193/Associating+Data+with+a+Motion|associate the Visual3d_SIMM_grf.mot file using these steps]].
  
-=== Example ===+==== Example ====
  
 An example of this export process can be found [[Visual3D:Documentation:OpenSim:Visual3D_to_OpenSim_Demo|here]]. An example of this export process can be found [[Visual3D:Documentation:OpenSim:Visual3D_to_OpenSim_Demo|here]].
  
  
visual3d/documentation/kinematics_and_kinetics/opensim.1729872594.txt.gz · Last modified: 2024/10/25 16:09 by wikisysop