Skip to content

Add EMG signal processing, muscle activation ODE, and tendon-node projection - #811

Merged
M-Colley merged 1 commit into
devfrom
feat/emg-signal
Nov 19, 2026
Merged

M-Colley merged 1 commit into
devfrom
feat/emg-signal

Conversation

@M-Colley

@M-Colley M-Colley commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Adds reusable surface/fine-wire EMG preprocessing (process_emg), mjDYN_MUSCLE forward and inverse activation dynamics (excitation_to_activation and �ctivation_to_excitation, supporting dynprm[2] ausmooth and delegating per-step integration to myo_sim.physics.hill_muscle when installed), electromechanical lag shifting (shift_signal), cycle phase normalization (phase_normalize), and mjEQ_TENDON slide-node projection (project_tendon_nodes).

OpenSim 4 state-path normalization and force-plate ExternalLoads GRF helpers have been split into #845 ( eat/opensim-grf-helpers).

Copy link
Copy Markdown
Collaborator

Review against CLAUDE.md. Merged into current dev, the related tests pass (244 passed) and pre-commit is clean.

  1. Second activation-dynamics implementation. excitation_to_activation integrates MuJoCo's mjDYN_MUSCLE ODE itself. Delegate Hill muscle curves and joint-torque spec stripper to myo_sim #824 adds the same ODE as muscle_activation_dot / step_muscle_activation, as does Add portable Hill-type muscle curves and joint-torque MjSpec compiler myo_sim#200. The two differ: this version ignores dynprm[2] (tausmooth) and always switches between the activation and deactivation time constants abruptly. It therefore matches MuJoCo only for muscles with tausmooth = 0, while Delegate Hill muscle curves and joint-torque spec stripper to myo_sim #824 reproduces MuJoCo's smooth blend. Please call the shared function (ideally myo_sim's) instead of keeping a third copy, so EMG-driven activations match the simulator's own.
  2. Size and scope. About 800 lines that bundle EMG filtering, activation inversion, phase normalisation, tendon-node projection and OpenSim GRF conversion. The OpenSim GRF helpers are a separate concern and could be their own PR, per CLAUDE.md's small-PR rule.

Generated by Claude Code

@M-Colley
M-Colley force-pushed the feat/emg-signal branch 2 times, most recently from 53cfb5c to 1365e62 Compare November 18, 2026 13:18
@M-Colley M-Colley changed the title Add EMG signal processing, muscle activation ODE, and OpenSim GRF helpers Add EMG signal processing, muscle activation ODE, and tendon-node projection Nov 18, 2026
@M-Colley

Copy link
Copy Markdown
Collaborator Author

Addressed both review points:

  1. Shared mjDYN_MUSCLE activation dynamics (tausmooth): Updated excitation_to_activation and activation_to_excitation in 1365e622 to read actuator_dynprm[:, 2] (tausmooth, or an explicit tausmooth keyword) and match MuJoCo's smooth mju_muscleDynamicsTimescale quintic blend (x^3 (6 x^2 - 15 x + 10)), delegating per-step integration directly to myo_sim.physics.hill_muscle.step_muscle_activation (MyoHub/myo_sim#200) when installed. Added test_tausmooth_matches_mujoco_muscle_dynamics_and_delegates_to_hill verifying data.act_dot and mj_step parity (atol <= 1e-14) at tausmooth = 0.2.
  2. Split OpenSim GRF helpers: Extracted normalize_opensim_motion and opensim_grf_to_qfrc into standalone PR Add OpenSim 4 state-path normalization and GRF qfrc helpers #845 (myosuite.biomechanics.opensim_grf), keeping Add EMG signal processing, muscle activation ODE, and tendon-node projection #811 focused on EMG signal processing, activation dynamics, and tendon-node projection. Also rebased the stacked PRs (Add musculoskeletal EMG validation modes and model fingerprinting #812 -> Add EMG validation A/B CLI, gait dataset adapters, and custom manifests #813 -> Add upper-limb and hand EMG adapters for Quesada 2024, emg2pose, NinaPro DB5, and GRABMyo #814 -> feat(biomechanics): model the hand gripping the dynamometer handle (BHaM Biodex) #835) onto current dev.

@M-Colley
M-Colley merged commit bd163dc into dev Nov 19, 2026
5 checks passed
@M-Colley
M-Colley deleted the feat/emg-signal branch November 19, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:biomechanics IK, ID, static optimization, CMC, uncertainty, camera & loads area:scaling-calibration Subject scaling, OpenSim validation, strength/mass/fatigue calibration enhancement New feature or request stack:root Base PR of an open stack onto dev — review and merge first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants