Getting Started with PhysioMoCap

This guide is designed for first-time users.

1. Create demo data

library(PhysioMoCap)

demo <- demoMoCapData(seed = 1)
class(demo$mocap)
#> [1] "PhysioExperiment"
#> attr(,"package")
#> [1] "PhysioCore"
head(demo$joints)
#>       ankle_x    ankle_y      knee_x    knee_y       hip_x     hip_y
#> 1 0.000000000 0.06000000 0.001986693 0.4696013 0.001947092 0.8592106
#> 2 0.001255810 0.05998027 0.002598162 0.4693132 0.002232419 0.8589479
#> 3 0.002506665 0.05992115 0.003199377 0.4689488 0.002508936 0.8586499
#> 4 0.003747626 0.05982287 0.003787965 0.4685096 0.002775551 0.8583178
#> 5 0.004973798 0.05968583 0.004361604 0.4679974 0.003031213 0.8579528
#> 6 0.006180340 0.05951057 0.004918030 0.4674141 0.003274912 0.8575564

2. Run one-command quick start

qs <- quickStartMoCap(seed = 1)
qs
#> PhysioMoCap Quick Start
#>   Source: demo 
#>   Frames: 300 
#>   Markers: 8 
#>   Sampling rate: 120.000 Hz
#>   Readiness:100% (A+)
#> 
#> Generated outputs:
#>   - velocity / acceleration: TRUE 
#>   - forceplate summary: TRUE 
#>   - inverse dynamics: TRUE 
#>   - EMG processed/aligned: TRUE / TRUE 
#> 
#> Next steps:
#>   1) Check readiness details: x$readiness
#>   2) View force summary: x$forceplate$summary
#>   3) Start from your own file: quickStartMoCap(path = 'trial.c3d')

3. Check data readiness

qs$readiness
#> MoCap Readiness Report
#>   Score:100% (A+)
#>   Frames: 300 
#>   Markers: 8 
#>   Checks: 8 / 8 passed
head(qs$readiness$checks)
#>         category                   check pass
#> 1      Structure Required assays present TRUE
#> 2       Coverage           Enough frames TRUE
#> 3       Coverage Enough markers/channels TRUE
#> 4       Metadata Sampling rate available TRUE
#> 5       Metadata Sampling rate plausible TRUE
#> 6 Signal quality      Missing-value rate TRUE
#>                                value
#> 1 position_x, position_y, position_z
#> 2                300 (target >= 100)
#> 3                    8 (target >= 5)
#> 4                         120.000 Hz
#> 5        120.000 Hz (target >= 50.0)
#> 6      worst 0.00% (target <= 5.00%)
#>                                                                 recommendation
#> 1 Use readers or preprocessing so required assays exist (e.g. position_x/y/z).
#> 2                             Use a longer recording or merge repeated trials.
#> 3       Ensure all tracked markers are exported and not dropped during import.
#> 4                  Set a positive samplingRate on the PhysioExperiment object.
#> 5     Set the true recording rate or resample data before derivative analyses.
#> 6        Use fillGaps(), fillGapsSpline(), or improve marker tracking quality.

4. Inspect key outputs

qs$forceplate$summary
#>   peak_vertical_force max_loading_rate total_impulse n_stances
#> 1            901.6494         5553.832      884.9802         3
head(qs$inverse_dynamics)
#>          time ankle_moment knee_moment hip_moment ankle_power knee_power
#> 1 0.000000000           NA          NA         NA          NA         NA
#> 2 0.008333333           NA          NA         NA          NA         NA
#> 3 0.016666667           NA          NA         NA          NA         NA
#> 4 0.025000000    0.3262449   -1.787406  -5.900192   0.4341396  -4.073634
#> 5 0.033333333    0.6638397   -1.935279  -6.447660   0.8521606  -3.981348
#> 6 0.041666667    1.1093977   -1.947495  -6.797463   1.3663183  -3.558657
#>   hip_power
#> 1        NA
#> 2        NA
#> 3        NA
#> 4 -3.223901
#> 5 -2.316108
#> 6 -1.159713

5. Start from your own file

trc_file <- system.file("testdata", "sample.trc", package = "PhysioMoCap")
if (nzchar(trc_file)) {
  pe <- readMoCapAuto(trc_file)
  assessMoCapReadiness(pe)
}
#> MoCap Readiness Report
#>   Score:75% (C)
#>   Frames: 5 
#>   Markers: 2 
#>   Checks: 6 / 8 passed
#> 
#> Action items:
#>   - Enough frames -> Use a longer recording or merge repeated trials. 
#>   - Enough markers/channels -> Ensure all tracked markers are exported and not dropped during import.

You can also run quickStartMoCap(path = "trial.c3d") directly.

6. Common input entry points

  • Marker trajectories: readMoCapAuto(), readC3D(), readMoCapCSV(), readTRC()
  • OpenSim kinematics/forces: readMOT(), readSTO()
  • OpenCap cloud data: readOpenCap()

7. Common troubleshooting

  • If sampling_rate is missing, set it explicitly.
  • If detectEvents() cannot find signals from a matrix, pass a named signals list.
  • If optional dependency packages are missing (e.g., c3dr, signal), install them from CRAN.