---
title: "Use pyCGM2 in Vicon Nexus"
canonical: "https://help.vicon.com/space/Nexus216/11606162/Use%20pyCGM2%20in%20Vicon%20Nexus"
format: markdown
---
In this section:

> Macro (toc)

## CGM2 labeling templates (VSTs)

CGM2 VSTs are automatically installed in:   
*C:\Users\Public\Documents\Vicon\Nexus2.x\ModelTemplates* 

Note that VSTs are available for both lower and full body.

![image](media://139213c1-e931-47dc-8b9c-20ff0b8dc352)

> ℹ️ **Note**   
> ℹ️ If you are using a version of CGM2 earlier than 2.5 and want to perform upper body modeling, run either a custom upper limb model or the full body Plug-in Gait model. If you use the full body PiG model, add a script prefix to the outputs, so that the PiG model does not overwrite your CGM2 lower body model. (If you're not sure which version of CGM2 you're using, see [Find the version number of CGM2](#FindVersion).)


      

    For all versions of CGM2, you must use the appropriate marker set for the model, for example, you must run a 2.5 model using a 2.5 marker set.


### Find information about CGM2

For more information about CGM2, see the following:  
[https://pycgm2.netlify.app/](https://pycgm2.netlify.app/)

Information about the CGM2 models:

- CGM 1.0 (Vicon Plug-in Gait Clone):   
[https://pycgm2.netlify.app/cgm/cgm1.0/](https://pycgm2.netlify.app/cgm/cgm1.0/)
- CGM 1.1:   
[https://pycgm2.netlify.app/cgm/cgm1.1/](https://pycgm2.netlify.app/cgm/cgm1.1/)
- CGM 2.1 (Hip Joint Center):   
[https://pycgm2.netlify.app/cgm/cgm2.1/](https://pycgm2.netlify.app/cgm/cgm2.1/)
- CGM 2.2 (Inverse Kinematic):   
[https://pycgm2.netlify.app/cgm/cgm2.2/](https://pycgm2.netlify.app/cgm/cgm2.2/)
- CGM 2.3 (Skin Clusters):   
[https://pycgm2.netlify.app/cgm/cgm2.3/](https://pycgm2.netlify.app/cgm/cgm2.3/)
- CGM 2.4 (Forefoot):   
[https://pycgm2.netlify.app/cgm/cgm2.4/](https://pycgm2.netlify.app/cgm/cgm2.4/)
- CGM 2.5 (Upper body model):  
[https://pycgm2.netlify.app/cgm/cgm2.5/](https://pycgm2.netlify.app/cgm/cgm2.5/)
- CGM 2.6 (Knee calibration)  
[https://pycgm2.netlify.app/cgm/cgm2.6/](https://pycgm2.netlify.app/cgm/cgm2.6/)

Note that each subsequent model includes the improvements made in all prior models, eg, skin cluster calculations, inverse kinematics, and hip joint center calculations will also be applied within the forefoot model.

> Macro (anchor)

Additional information about CGM2:

- CGM 4.2 (Event detection)  
[https://pycgm2.netlify.app/nexusqualisys/vicon-apps/events/](https://pycgm2.netlify.app/nexusqualisys/vicon-apps/events/)
- CGM 4.2 (Kalman gap-filling)  
[https://pycgm2.netlify.app/nexusqualisys/vicon-apps/gaps/](https://pycgm2.netlify.app/nexusqualisys/vicon-apps/gaps/)

Information about marker placement:   
[https://pycgm2.netlify.app/ressources/palpation/](https://pycgm2.netlify.app/ressources/palpation/)

> Macro (scroll-pagebreak)


    > Macro (anchor)




## Run the static CGM2 model

To apply the model, run the **CGM2 - Calibration** pipeline operation on static trials.

Add the **CGM2 - Calibration** pipeline operation to the current pipeline, select it and in the **Properties** pane, select the required parameters:

![image](media://14d89fc6-2842-43a1-81e7-37edbe4d3b5d)

- **Environment activation** If you need to run an executable file to configure the Python environment before running the script, specify the full path to the file.
- **Model Version** Select the CGM version that you want to use.
- **Marker Diameter** Default is 14 mm.
- **Suffix** Add your preferred naming convention, eg, `CGM2`. Note that CGM2 automatically adds an underscore, so if you specify the suffix `CGM2`, all the outputs will have the suffix `_CGM2`.
- **Left Foot Flat** and **Right Foot Flat** Default is selected.
- **Head Level** Select or clear the head horizontal option.
- **Reset MP** Reset computation of optional parameters, eg, **interAsisDistance** and shank offsets. If selected, the information entered in the **Properties** pane of the **Subjects Resources** tab is accounted for when applying the model.
- **Force LHJC** and **Force RHJC** Forces the local position of the left/right hip joint center in the pelvic coordinate system. Note that this applies only for the CGM2 model from CGM 2.1 and later.
- **Disable IK** To turn off inverse kinematics, select this check box.

When you run the operation, the model outputs appear in the **Subjects** tree.

Note that in the following example, the suffix `CGM2` has been specified so that the outputs for CGM2 and Plug-in Gait can be compared. If no suffix had been specified, the outputs would be overwritten.

![image](media://bdfc1e2b-07d6-43b4-879c-0da40e4111c0)


      



![image](media://505b63ff-48ac-4de8-a373-7f6a7f0ccb58)

> Macro (scroll-pagebreak)


    > Macro (anchor)




## Run the knee calibration (CGM 2.6)

The knee calibration routine (CGM 2.6) provides two options: **2DoF Calibration** or **SARA**. To apply the knee calibration, run the **CGM2 - Functional Calibration** pipeline operation <span style="color: #172B4D"> between the static/calibration (see above) and the dynamic/fitting trials (see below)</span>.

Add the  **CGM2 - Functional Calibration**  pipeline operation to the current pipeline, select it and in the **Properties** pane, select the required parameters:

![image](media://b5333c55-7098-4663-8e7f-e87d27c27a80)

- **Environment activation** If you need to run an executable file to configure the Python environment before running the script, specify the full path to the file.
- **<span style="color: #000000">Method</span>**<span style="color: #000000"> Select the required knee calibration method.</span>
  - **
                    **<span style="color: #000000">**2DoF Calibration**</span>**
                **
  - **<span style="color: #000000">SARA</span>**<span style="color: #000000"> Note that SARA can only be used with a subject that has been statistically calibrated in CGM 2.3 or later.</span>
- **<span style="color: #000000">Side</span>**<span style="color: #000000"> Select the option to which to apply the functional calibration.</span>
  - **<span style="color: #000000">Auto</span>**<span style="color: #000000"> Expects each leg to be calibrated from a separate trial. If not, you must specify the frame range for the movement of each leg within the trial.</span>
  - **<span style="color: #000000">Left</span>**<span style="color: #000000"> Runs on the left knee.</span>
  - **<span style="color: #000000">Right</span>**<span style="color: #000000"> Runs on the right knee.</span>
- **<span style="color: #000000">First Frame</span>**<span style="color: #000000"> Default is Selected Start.</span>
- **<span style="color: #000000">Last Frame</span>**<span style="color: #000000"> Default is Selected End.</span>

> Macro (scroll-pagebreak)


    > Macro (anchor)




## Run the dynamic CGM2 model

To apply the model, run the **CGM2 - Fitting** pipeline operation on dynamic trials.

Add the **CGM2 - Fitting** pipeline operation to the current pipeline, select it and in the **Properties** pane, select the required parameters:

![image](media://6e28f915-4657-45d3-836f-d3fbdce22a22)

- **Model Version**: Select the CGM version that you want to use.
- **Marker Diameter** Default is 14 mm.
- **Suffix** Add your preferred naming convention, eg, `CGM2`.
- **Projection**: Select the coordinate system for joint moment from the options:
  - **Default** - CGM 1.0 = distal and all other CGM2 models default to JCS (Joint Coordinate System)
  - **Proximal**
  - **Distal**
  - **Global**
  - **JCS** - Joint Coordinate System
- **Disable IK** If selected, inverse kinematics is deactivated. Applicable only to the CGM2 model from CGM 2.3and later.

The model outputs appear in the Subjects tree. In the same way as in the static/calibration example above, to enable a comparison of CGM2 with Plug-in Gait, a suffix (`CGM2`) was specified.

![image](media://dcbd59e7-7547-4b10-964c-50809e36ed9f)


    > Macro (anchor)




## Find the version number of CGM2

You can find out which version of CGM2 is currently installed in either of these ways:

- Display a list of the installed modules for Nexus Python by entering this command:  
`"C:\Program Files\Vicon\Nexus2.14\Python\python.exe" -m pip freeze | findstr pyCGM2`
- Look at the installed package directly, for example:
  `C:\Program Files\Vicon\Nexus2.14\Python\Lib\site-packages\pyCGM2-4.2.dist-info`   
  
`C:\Program Files\Vicon\Nexus2.14\pyCGM2-wheels\pyCGM2-4.2-py3-none-any.whl `