Skip to content

[BugFix] Populate actuator_force in forward pass for ACTUATORFRC/TENDONACTFRC#78

Merged
vmoens merged 2 commits into
vmoens:mainfrom
bsprenger:fix/act-force
May 23, 2026
Merged

[BugFix] Populate actuator_force in forward pass for ACTUATORFRC/TENDONACTFRC#78
vmoens merged 2 commits into
vmoens:mainfrom
bsprenger:fix/act-force

Conversation

@bsprenger
Copy link
Copy Markdown
Contributor

@bsprenger bsprenger commented May 23, 2026

Description

actuator_force was declared in the Data type stubs and zero-initialized, but was never written during the forward pass. This caused ACTUATORFRC and TENDONACTFRC sensors to silently return all zeros regardless of the control signal.

The fix adds actuator_force=force.contiguous() to the d.update_() call in _actuation(), so the field is populated with the actual clamped actuator force after gain/bias computation and forcerange clamping.

This also replicates MJX (relevant lines here).

Test plan

  • pytest test/ -x -v passes
  • Compared output against MuJoCo C at float64 precision
  • ruff check . and ruff format --check . clean

bsprenger added 2 commits May 23, 2026 12:10
…ONACTFRC

`actuator_force` was declared in the Data type stubs and zero-initialized
in io.py, but was never written during the forward pass.  This caused
ACTUATORFRC and TENDONACTFRC sensors to silently return all zeros
regardless of the control signal.

The fix adds `actuator_force=force.contiguous()` to the `d.update_()`
call in `_actuation()`, so the field is populated with the actual
clamped actuator force after gain/bias computation and forcerange
clamping.
Copy link
Copy Markdown
Owner

@vmoens vmoens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@vmoens vmoens merged commit a977405 into vmoens:main May 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants