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/06/19 12:48] – sgranger | visual3d:documentation:kinematics_and_kinetics:opensim [2025/03/12 14:25] (current) – wikisysop | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | visual3d, since version 4.0, allows the user to export opensim compatible motion files designed for use with opensim gait models. | + | ====== OpenSim ====== |
- | the visual3d | + | Visual3D allows |
- | visual3d | + | Visual3D |
- | starting with version 4.9.3 visual3d is now compatible with opensim version 2.4.0. the biggest change when exporting to opensim 2.4.0 is that opensim now looks for the ground reaction force data in a separate .xml or .mot file. visual3d will now generate this new ground reaction force file on export (called visual3_simm_grf.mot) but there are some consequences of the new opensim external force input methodology. | + | ===== Modeling Requirements ===== |
- | 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, | + | The following model requirements must all be met. Please read the requirements carefully: |
- | \\ | + | - The Visual3D model used for OpenSim output must include the right foot (RFT), right shank (RSK), right thigh (RTH), left foot (LFT), left shank (RSK), left thigh (RTH), pelvis (RPV) and a Thorax/Ab (RTA). |
- | in addition to the changes related to the external force export, there are two other revisions with visual3d 4.9.3 in the exporting | + | - The Thorax/Ab (RTA) segment must be built in a very specific way. First, |
+ | - 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 " | ||
- | 1) the torso and feet are now automatically scaled to be equal to the average | + | See [[Visual3D: |
- | 2) in the opensim dialog the user is now prompted for the opensim version number. | + | ==== Pose Estimation |
- | 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-> | + | 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: |
- | + | ||
- | ==== download files ==== | + | |
- | + | ||
- | |[[visual3d:documentation_:opensim:visual3d_to_opensim_demo|visual3d to opensim demo]] opensim related files that are used in these examples for download.\\ \\ [[https:// | + | |
- | + | ||
- | ===== 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 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. | + | |
- | + | ||
- | ===== comparing visual3d | + | |
- | + | ||
- | 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 | + | |
- | + | ||
- | 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 model used for opensim output must include the right foot (rft), right shank (rsk), right thigh (rth), left foot (lft), left shank (rsk), left thigh (rth), pelvis (rpv) and a thorax/ab (rta). | + | |
- | - 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 [[# | + | |
- | - 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's gait model constraints. | + | |
- | + | ||
- | visual3d offers two methods of pose estimation: 1) 6 degree of freedeom which you mention (based on spoor and veldpaus, 1980) and 2) inverse kinematics (based on lu and o' | + | |
- | + | ||
- | when exporting to opensim, visual3d applies | + | |
- | + | ||
- | the constrains used are: | + | |
- 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. | ||
- | - a hinge joint at the knee with the location of the hinge a function of the knee joint angle as specifies in the opensim | + | - a hinge joint at the knee with the location of the hinge a function of the knee joint angle as specifies in the OpenSim |
- | - the ankle joint is hinge with the direction of the axis matching that of the gatt23*.osim model. | + | - The ankle joint is hinge with the direction of the axis matching that of the gatt23*.osim model. |
- | - the subtalar joint is hinge with the direction of the axis matching that of the gatt23*.osim model. | + | - The subtalar joint is hinge with the direction of the axis matching that of the gatt23*.osim model. |
- | - the mtp joint is fixed and set to zero at all frames. (this was done on a recommendation from jill higginnson | + | - The mtp joint is fixed and set to zero at all frames. (This was done on a recommendation from Jill Higginnson |
- | + | ||
- | 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. | + | |
- | + | ||
- | ==== correcting the lumbar tilt in the exported motion file ==== | + | |
- | + | ||
- | in the visual3d export dialog, visual3d allows the user to specify a correction angle for the lumbar flexion/ | + | |
- | + | ||
- | ===== visual3d and the opensim xml files ===== | + | |
- | + | ||
- | as mentioned previously, the visual3d to opensim process is designed to work with the opensim in the manor outlined in the opensim tutorial " | + | |
- | + | ||
- | [[visual3d: | + | |
- | [[visual3d: | + | |
- | [[visual3d: | + | |
- | [[visual3d: | + | |
- | \\ | + | |
- | + | ||
- | + | ||
- | ===== files 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 scaling ===== | + | ==== Visual3D-to-OpenSim Inverse Kinematics |
- | visual3d automatically scales | + | Visual3D’s ability to write OpenSim compatible .mot files is based on Visual3D’s own Inverse Kinetics algorithm. The theory behind |
- | - changing | + | - Visual3D computes |
- | - updating | + | - Visual3D uses Inverse Kinematics |
+ | - Visual3D then uses Inverse Kinematics to fit the gait data to the newly calibrated model. | ||
- | in **opensim 3.1**, the xml formats were modified and visual3d could not write the correct manual scale factors | + | To recap, any export from Visual3D |
- | **important note**: the manual | + | Visual3d does manual |
- | 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, | + | ==== Model Scaling ==== |
- | === pelvis | + | 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. | ||
- | to scale the pelvis visual3d computes the distance (in meters) between the hip centers in the subject calibration | + | **NOTE**: In OpenSim 3.1, the xml formats were modified |
- | === thigh === | + | **NOTE**: The manual scale factors written to the Visual3d_Scale_ScaleSet.xml file must be used to scale the pelvis, |
- | 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 manual |
- | (note: the knee location will vary with knee joint angle in opensim | + | | Pelvis | Visual3D computes the distance |
+ | | 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 | ||
+ | | 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). | | ||
- | === shank === | + | ===== Visual3D-to-OpenSim Exports ===== |
- | 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 Visual3D-to-OpenSim process is designed according |
+ | - [[Visual3D: | ||
+ | - [[Visual3D: | ||
+ | - [[Visual3D: | ||
+ | - [[Visual3D: | ||
- | ==== torso, calcaneus and toes ==== | + | ==== Correcting the Lumbar Tilt in the Exported Motion File ==== |
- | 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 | + | Visual3D' |
- | \\ | + | ==== 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' | ||
- | ==== ankle_angles ==== | + | 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) | ||
+ | - 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 | ||
+ | - the Hip joint center is the located at the values set in the gait2354 or gait2392 osim models | ||
+ | - 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). | ||
- | opensim versus visual3d | + | If you look at the osim file you will see that the knee motion, the hip center location and the ankle/ |
- | ==== angles | + | |
- | the angles that are exported to opensim are slightly different than the angles calculated in visual3d. | + | ==== Exported Force and Free Moment ==== |
- | the inverse kinematics model used in the visual3d opensim export is a special version of the visual3d ik designed so the model exactly matches the gait2354 or gait2392 osim models. | + | Visual3D exports |
- | the four main differences in this special visual3d implementation | + | ==== Exported Center |
- | - the ankle plantar flexion angle in the opensim export corresponds | + | After the Inverse Kinematics (IK) fit, the entire model could move relative |
- | - that the knee joint will translate | + | |
- | | + | |
- | - 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. | + | |
- | if you look at the osim file you will see that the knee motion, the hip center location and the ankle/ | + | ==== Exporting Other Models ==== |
- | ==== exported force and free moment ==== | + | Visual3D' |
- | visual3d exports the force and freemoment signals that are found in the data tree. | + | ==== Comparing Visual3D |
- | ==== exported center | + | 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: |
- | 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 | + | |
+ | | ||
+ | | ||
- | ==== opensim joint moments | + | 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 |
- | you can get the inverse dynamics directly out of opensim | + | 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 one thing you do need to do before running the inverse dynamics tool is modify the initial | + | ==== OpenSim Joint Moments |
- | ===== exporting other models ===== | + | 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 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-> | ||
- | ===== opensim | + | - OpenSim |
- | 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.1718801281.txt.gz · Last modified: 2024/06/19 12:48 by sgranger