Skip to content

CGC-2026/scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Knee IMU Angle Plotter

Plots the 3 relative joint angles (pitch, roll, yaw) from two IMUs placed on the thigh and shin, recorded during squat movements. Outputs a 3-panel time-series chart showing the primary flexion/extension angle and the two minor angles.

Example output


Requirements

  • Python 3.9+
  • pip

Setup

1. Clone or download this project, then open a terminal in the project folder.

2. Create a virtual environment:

python3 -m venv venv

3. Activate the virtual environment:

# Mac / Linux
source venv/bin/activate

# Windows
venv\Scripts\activate

You should see (venv) appear at the start of your terminal prompt.

4. Install dependencies:

pip install -r requirements.txt

Usage

Basic — opens an interactive plot window:

python plot_knee_angles.py your_data.csv

Save the plot to a file instead:

python plot_knee_angles.py your_data.csv output.png

CSV Format

The script expects a CSV file with the following columns:

Column Description
timestamp Time in milliseconds
pitch Flexion/extension angle (degrees)
roll Varus/valgus angle (degrees)
yaw Internal/external rotation (degrees)
seq Sequence number (optional)
flex Flex flag (optional)

Configuration

At the top of plot_knee_angles.py you can adjust:

Variable Default Description
SMOOTHING_WINDOW 5 Rolling average window in samples. Set to 1 to show raw data only.
FIGURE_SIZE (14, 9) Width and height of the figure in inches
PRIMARY_COLOR blue Colour for pitch (flexion) panel
SECONDARY_COLOR green Colour for roll panel
TERTIARY_COLOR red Colour for yaw panel
ALPHA_RAW 0.25 Opacity of the raw data line

Deactivating the virtual environment

When you're done:

deactivate

About

Data visualization scripts from csv data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages