Expose qfrc_actuator and qfrc_external on EntityData#779
Merged
kevinzakka merged 1 commit intomainfrom Mar 12, 2026
Merged
Conversation
d947ccb to
23e852a
Compare
Add qfrc_actuator (actuator forces in joint space) and qfrc_external (J^T * xfrc_applied contribution recovered from the qfrc_smooth identity) as read-only properties on EntityData, sliced to entity joint DOFs. Remove generalized_force which was bugged (indexed free joint DOFs instead of articulated DOFs) and had an ambiguous name. Update joint_torques error message to point to the new accessors. Fix electrical_power_cost to use qfrc_actuator instead of actuator_force so mechanical power is correct for actuators with non-unit gear ratios. Fixes #776
23e852a to
9a1e5e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MuJoCo decomposes generalized forces into physically distinct components but
EntityDataonly exposedactuator_force(in actuation space, not joint space).This adds
qfrc_actuator(actuator forces projected into joint space through the transmission) andqfrc_external(recovers the J^T *xfrc_appliedcontribution that MuJoCo folds intoqfrc_smoothwithout storing separately). Also removesgeneralized_forcewhich was bugged (indexed free joint DOFs instead of articulated DOFs) and had an ambiguous name.Fixes
electrical_power_costto useqfrc_actuatorinstead ofactuator_forceso mechanical power is correct for actuators with non-unit gear ratios.Fixes #776