visual3d:documentation:kinematics_and_kinetics:opensim
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
visual3d:documentation:kinematics_and_kinetics:opensim [2024/07/03 17:37] – created sgranger | visual3d:documentation:kinematics_and_kinetics:opensim [2025/03/12 14:25] (current) – wikisysop | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== OpenSim ====== | ====== OpenSim ====== | ||
- | Visual3D, since Version 4.0, allows the user to export OpenSim compatible motion files designed for use with OpenSim gait models. | + | 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:// |
- | The Visual3D | + | Visual3D |
- | Visual3D exports an OpenSim compatible motion file, Visual3D_SIMM_input.mot, | + | ===== Modeling Requirements ===== |
- | Starting with version 4.9.3 Visual3d is now compatible with OpenSim version 2.4.0. | + | The following model requirements must all be met. Please read the requirements carefully: |
- | From a user’s point of view the real change occurs when they run the OpenSim RRA and CMC Tools. Now when a user loads the Visual3d_Setup_RRA.xml and Visual3d_SetUp_CMC.xml into the RRA and CMC tools, OpenSim will now look for an External Load file called Visual3d_SIMM_grf.mot. This file will be generated automatically by OpenSim; however Visual3d_SIMM_grf.mot generated by OpenSim does not work with the Visual3d export process. Thus when running both the RRA and CMC the users has to select the “Actuators and External Loads” tab and in the “External Loads Section” and change the “External loads specification file” to Visual3d_SIMM_input_grf.xml. (The file, Visual3d_Simm_input_grf.xml, | + | |
- | + | ||
- | \\ | + | |
- | In addition to the changes related to the external force export, there are two other revisions with Visual3d 4.9.3 in the exporting to OpenSim. These changes apply to all OpenSim versions: | + | |
- | + | ||
- | 1) The torso and feet are now automatically scaled to be equal to the average of the left and right femoral lengths. (The new torso and feet manual scale factors are written to the Visual3d_Scale_ScaleSet.xml file.) This modification was made because most users build their feet and head without markers at the very end of the foot and at the top of the head and thus using the average thigh length seems a reasonable scaling approximation for these segments. (Physical anthropometry studies have shown thigh length is a somewhat strongly correlated with height) | + | |
- | + | ||
- | 2) In the OpenSim Dialog the user is now prompted for the OpenSim version number. | + | |
- | + | ||
- | Note: After running RRA in OpenSim version 2.4.0 sometimes the bones will disappear. (This is apparently happens because RRA will occasionally leave the “Working Directory”.) To fix the problem go to the OpenSim Edit-> | + | |
- | + | ||
- | === Download Files === | + | |
- | + | ||
- | |[[Visual3D: | + | |
- | + | ||
- | ==== Visual3D to OpenSim Inverse Kinematics ==== | + | |
- | + | ||
- | Visual3D’s ability to write OpenSim compatible .mot files is based on Visual3D’s own Inverse Kinetics algorithm. | + | |
- | + | ||
- | - Visual3D | + | |
- | - Visual3D uses Inverse Kinematics to fit the scaled OpenSim gait model to the Visual3D Static Calibration Model. (This is similar to the OpenSim Marker Placer Process). | + | |
- | - Visual3D then uses Inverse Kinematics to fit the gait data to the newly calibrated model. | + | |
- | + | ||
- | ==== Comparing Visual3D and SIMM exporting to OpenSim ==== | + | |
- | + | ||
- | The capability of Visual3d and SIMM are somewhat different. You can think of the process of generating muscle driving simulations in OpenSim as occurring in three steps: | + | |
- | + | ||
- | - Build a Musculoskeletal Model | + | |
- | - Import the Model along with Motion Capture and Force Plate Data to OpenSim | + | |
- | - Analyze/ | + | |
- | + | ||
- | Currently SIMM works at Step 1 while Visual3d works at Step 2. | + | |
- | + | ||
- | \\ | + | |
- | + | ||
- | + | ||
- | If you are using a standard OpenSim model to analyze walking or running then you really do not need SIMM since OpenSim comes with two default full body models. (One includes 54 lower extremity muscles and the other includes 92.) In theory you could also bypass SIMM by creating models directly with an xml file but this is really tough to do. Thus if you trying to look at non-standard or non-gait models then SIMM can very helpful. If you are looking at walking and running then SIMM may not be needed. | + | |
- | + | ||
- | As mentioned 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 for the expected marker set then importing the motion capture and force plate data can be a very cumbersome process in OpenSim. In addition Visual3d will also allow you to do many, many more standard kinematic and kinetic analyses on the 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. | + | |
- | + | ||
- | ==== Modeling Requirements ==== | + | |
- | + | ||
- | The Following model requirements must all be met. Please read the requirements carefully: | + | |
- | + | ||
- | - The Visual3d | + | |
- The Thorax/Ab (RTA) segment must be built in a very specific way. First, the proximal end of the RTA should be the created at the exact same location as the proximal end of the pelvis. Thus the proximal end of the RTA forms the joint with the pelvis while the distal end of the RTA should be built at approximately at the height of the shoulder shoulders. If constructed in this manner, the RTA segment will now have the Z axis (which goes distal to proximal) pointed downward and the Y axis pointed backward. This must be changed so the RTA segment coordinate system matches the local coordinate system of the other segments. To do this you go click the " | - The Thorax/Ab (RTA) segment must be built in a very specific way. First, the proximal end of the RTA should be the created at the exact same location as the proximal end of the pelvis. Thus the proximal end of the RTA forms the joint with the pelvis while the distal end of the RTA should be built at approximately at the height of the shoulder shoulders. If constructed in this manner, the RTA segment will now have the Z axis (which goes distal to proximal) pointed downward and the Y axis pointed backward. This must be changed so the RTA segment coordinate system matches the local coordinate system of the other segments. To do this you go click the " | ||
- All segments must follow the default Visual3D convention, X ML, +Y anterior and +Z vertical. This is necessary to enforce the OpenSim model constraints (explained [[# | - All segments must follow the default Visual3D convention, X ML, +Y anterior and +Z vertical. This is necessary to enforce the OpenSim model constraints (explained [[# | ||
- | - One current limitation of the Visual3d to OpenSim approach is that in order to handle the motion of the pelvis relative to the LAB all subjects are assumed to be walking in the +Y direction, with the global +Z axis in vertical direction and the +X axis pointing to the right. If the user’s LAB coordinate system is not setup this way they can get around this limitation by creating " | + | - One current limitation of the Visual3d to OpenSim approach is that in order to handle the motion of the pelvis relative to the LAB all subjects are assumed to be walking in the +Y direction, with the global +Z axis in vertical direction and the +X axis pointing to the right. If the user’s LAB coordinate system is not setup this way they can get around this limitation by creating " |
- | + | ||
- | See [[Visual3D: | + | |
- | + | ||
- | === Pose Estimation in Visual3D === | + | |
- | + | ||
- | It should be noted that a 6-degree of freedom joint in Visual3D gets transformed into OpenSim' | + | |
- | Visual3d offers two methods of POSE Estimation: 1) 6 degree | + | See [[Visual3D:Documentation: |
- | When exporting to OpenSim, Visual3d applies the Inverse Kinematics method fit to the model using the constraints specified | + | ==== Pose Estimation |
- | The constrains used are: | + | Visual3D offers two methods of pose estimation: 1) [[visual3d: |
- 3 degree of freedom ball joint at the right hip, left hip and waist. | - 3 degree of freedom ball joint at the right hip, left hip and waist. | ||
Line 78: | Line 26: | ||
- The mtp joint is fixed and set to zero at all frames. (This was done on a recommendation from Jill Higginnson at the University of Delaware.) | - The mtp joint is fixed and set to zero at all frames. (This was done on a recommendation from Jill Higginnson at the University of Delaware.) | ||
- | So when you export to OpenSim it is not using a 6 dof model; instead it uses an IK model with constraints matching the Opensim model constraints. | ||
- | It is all hardcoded inside Visual3d so the user never sees the constraints. | + | ==== Visual3D-to-OpenSim Inverse Kinematics ==== |
- | === Correcting the Lumbar Tilt in the Exported Motion File === | + | Visual3D’s ability |
- | + | ||
- | In the Visual3d export dialog, Visual3d allows the user to specify a correction angle for the lumbar flexion/ | + | |
- | + | ||
- | ==== Visual3D | + | |
- | + | ||
- | As mentioned previously, the Visual3d | + | |
- | + | ||
- | [[Visual3D: | + | |
- | [[Visual3D: | + | |
- | [[Visual3D: | + | |
- | [[Visual3D: | + | |
- | \\ | + | |
+ | - Visual3D computes the scale factors which will scale the OpenSim gait model to the Visual3d static calibration model. These scale factors get written to a special OpenSim scale set file named Visual3d_Scale_ScaleSet.xml. (See the Visual3d Scaling section of this document for more details.) | ||
+ | - Visual3D uses Inverse Kinematics to fit the scaled OpenSim gait model to the Visual3D Static Calibration Model. (This is similar to the OpenSim Marker Placer Process). | ||
+ | - Visual3D then uses Inverse Kinematics to fit the gait data to the newly calibrated model. | ||
- | ==== Files No longer Required ==== | + | To recap, any export from Visual3D to OpenSim will not use a 6DOF model regardless of how the model is defined in Visual3D. Instead exports use a IK model incorporating the Opensim model constraints. This process is hard-coded inside Visual3D and occurs automatically. |
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. | ||
- | ==== Visual3D | + | ==== Model Scaling ==== |
Visual3D automatically scales the OpenSim model by: | Visual3D automatically scales the OpenSim model by: | ||
+ | - Changing the OpenSim scaling method to manual scaling for all segments. The simplified version of the OpenSim scaling setup file, called Visual3d_Setup_Scale.xml, | ||
+ | - Updating the file Visual3d_Scale_ScaleSet.xml to include the Visual3D computed scale factors for the pelvis, left and right thigh and left and right tibia segments. | ||
- | - Changing the OpenSim | + | **NOTE**: In OpenSim |
- | | + | |
- | In **OpenSim 3.1**, the xml formats were modified and Visual3D could not write the correct manual scale factors to be used by OpenSim. For OpenSim 3.1, the user will need to manually enter the scale factors in OpenSim. [[http:// | + | **NOTE**: The manual scale factors written to the Visual3d_Scale_ScaleSet.xml file must be used to scale the pelvis, thigh and tibia segments in OpenSim. If these scale factors are not used then center of pressure, which is also written by Visual3d to the Visual3d_SIMM_input.mot, |
- | + | ||
- | **Important Note**: The manual scale factors written to the Visual3d_Scale_ScaleSet.xml file must be used to scale the pelvis, thigh and tibia segments in OpenSim. If these scale factors are not used then center of pressure, which is also written by Visual3d to the Visual3d_SIMM_input.mot, | + | |
The manual scale factors computed by Visaul3d are based on the subject calibration data and the OpenSim segment geometry (as specified in the gait2392_simbody.osim). Specifically, | The manual scale factors computed by Visaul3d are based on the subject calibration data and the OpenSim segment geometry (as specified in the gait2392_simbody.osim). Specifically, | ||
- | == Pelvis | + | | Pelvis |
+ | | Thigh | Visual3D computes the distance between the hip and knee joint center in the subject calibration and divides this value by 0.396. The value 0.396 is the distance between the hip and knee location in the file gait2392_simbody.osim. (Note: the knee location will vary with knee joint angle in OpenSim and the value 0.396 represents the knee location at zero degree of knee flexion.) | | ||
+ | | Shank | Visual3D computes the distance between the knee and ankle joint center in the subject calibration and divides this value by 0.43. The value 0.43 is the distance between the knee and ankle location in the file gait2392_simbody.osim. | | ||
+ | | 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). | | ||
- | To scale the pelvis Visual3d computes the distance (in meters) between the hip centers in the subject calibration and divides this value by 0.167. The value 0.167 is the distance between the medial and lateral hip location in the file gait2392_simbody.osim. (One important note is that by default | + | ===== Visual3D-to-OpenSim |
- | == Thigh == | + | The Visual3D-to-OpenSim process is designed according to the OpenSim tutorial "Intro to Musculoskeletal Modeling" |
+ | - [[Visual3D: | ||
+ | - [[Visual3D: | ||
+ | - [[Visual3D: | ||
+ | - [[Visual3D: | ||
- | To scale the thigh Visual3d computes the distance between the hip and knee joint center in the subject calibration and divides this value by 0.396. The value 0.396 is the distance between the hip and knee location | + | ==== Correcting |
- | (Note: | + | Visual3D' |
- | == Shank == | + | ==== Exported Joint Angles ==== |
- | To scale the thigh Visual3d computes the distance between the knee and ankle joint center in the subject calibration and divides this value by 0.43. The value 0.43 is the distance between the knee and ankle location in the file gait2392_simbody.osim. | + | The angles that are exported to OpenSim are slightly different than the angles calculated in Visual3D |
- | + | ||
- | === Torso, Calcaneus and Toes === | + | |
- | + | ||
- | Because most users build their feet without markers at the very end of the foot and at the top of the head and thus using the average thigh length is used to scale these segments. (Physical anthropometry studies have shown thigh length is a somewhat strongly correlated with height) | + | |
- | + | ||
- | \\ | + | |
- | + | ||
- | + | ||
- | === Ankle_Angles === | + | |
- | + | ||
- | OpenSim versus Visual3D ankle angles | + | |
- | === Angles exported to OpenSim === | + | |
- | + | ||
- | The angles that are exported to OpenSim are slightly different than the angles calculated in Visual3D. | + | |
- | + | ||
- | The Inverse Kinematics model used in the Visual3d | + | |
The four main differences in this special Visual3d implementation of the IK are: | The four main differences in this special Visual3d implementation of the IK are: | ||
- | |||
- The ankle plantar flexion angle in the OpenSim export corresponds to zero degree when the foot is flat on the floor and the tibia is vertical (most Visual3d models are built with the foot z axis running from the toes to the ankle center) | - The ankle plantar flexion angle in the OpenSim export corresponds to zero degree when the foot is flat on the floor and the tibia is vertical (most Visual3d models are built with the foot z axis running from the toes to the ankle center) | ||
- that the knee joint will translate in the thigh X-Y plane as a function of the knee joint angle in the same manner as the OpenSim model | - that the knee joint will translate in the thigh X-Y plane as a function of the knee joint angle in the same manner as the OpenSim model | ||
Line 151: | Line 78: | ||
- the axes of rotation at the ankle and subtalar joints are skewed. (The direction cosines of right plantar flexion axis = 0.9793, -0.1045, -0.1736. The direction cosines of right subtalar axis = -0.1209, 0.7872, 0.6047). | - the axes of rotation at the ankle and subtalar joints are skewed. (The direction cosines of right plantar flexion axis = 0.9793, -0.1045, -0.1736. The direction cosines of right subtalar axis = -0.1209, 0.7872, 0.6047). | ||
- | If you look at the osim file you will see that the knee motion, the hip center location and the ankle/ | + | If you look at the osim file you will see that the knee motion, the hip center location and the ankle/ |
- | === 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 | + | 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 |
- | === OpenSIm Joint Moments and Joint Load === | + | ==== Exporting Other Models ==== |
- | You can get the Inverse Dynamics directly out of OpenSim | + | Visual3D' |
+ | |||
+ | ==== Comparing Visual3D and SIMM exporting to OpenSim ==== | ||
- | The one thing you do need to do before running the Inverse Dynamics tool is modify the initial | + | Visual3D |
- | ==== Exporting Other Models | + | - Build a Musculoskeletal Model |
+ | - Import the Model along with Motion Capture and Force Plate Data to OpenSim | ||
+ | - Analyze/ | ||
+ | |||
+ | SIMM works at Step 1. If you are using a standard OpenSim model to analyze walking or running then you really do not need SIMM since OpenSim comes with two default full body models. (One includes 54 lower extremity muscles and the other includes 92.) In theory you could also bypass SIMM by creating models directly with an xml file, but practically speaking if you are looking at non-standard or non-gait models then SIMM can very helpful. If you are looking at walking and running then SIMM may not be needed. | ||
+ | |||
+ | 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 ==== | ||
+ | |||
+ | You can get the Inverse Dynamics directly out of OpenSim using the " | ||
- | Visual3D' | + | **NOTE**: Before running OpenSim' |
- | 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:: | + | ===== Compatibility ===== |
- | An example of this can be found [[Visual3D:Documentation: | + | - Visual3D v4.0 - The basic Visual3D-to-OpenSim integration is available. |
+ | - Visual3D v4.9.3 - Compatible with OpenSim version 2.4.0. | ||
+ | - OpenSim version 2.4.0 looks for the ground reaction force data in a separate .xml or .mot file. Visual3D v4.9.3 and later will generate | ||
+ | - Visual3D now automatically scales the torso and feet to be equal to the average of the left and right femoral lengths with the new torso and feet manual scale factors written to Visual3d_Scale_ScaleSet.xml. This modification was made because most users build their feet and head without markers at the very end of the foot and at the top of the head. Using the average thigh length seems a reasonable scaling approximation for these segments as physical anthropometry studies have shown thigh length is a somewhat strongly correlated with height. | ||
+ | - In the OpenSim Dialog the user is now prompted for the OpenSim version number. | ||
+ | - Note: After running RRA in OpenSim | ||
- | ==== OpenSim 4.0 ==== | + | - 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:// |
- | In previous versions of OpenSim, opening (File -> Load Motion) the Visual3d_SIMM_input.mot file 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:// | + | ==== Example ==== |
+ | An example of this export process can be found [[Visual3D: | ||
visual3d/documentation/kinematics_and_kinetics/opensim.1720028252.txt.gz · Last modified: 2024/07/03 17:37 by sgranger