Skip to content

Inverse Dynamics - Unable to calculate ctrl from qfrc #337

@SiddheshKanawade

Description

@SiddheshKanawade

I am learning how to compute ctrl from qpos for the myo-arm model using the inverse dynamics tutorial. I get qpos from predefined trajectory. Following is the myo-arm model configuration(just for reference):

Configuration:

  • model.nu = 63 # Number of actuators
  • model.nv = 38 # Number of DOFs
  • model.nq = 38 # Number of generalized coordinates
  • model.na = 63 # Number of activation states
  • steps = 300

I am stuck at obtaining ctrl after computing qfrc using inverse dynamics. I believe qfrc calculation is correct, since I was able to replicate the similar trajectory using the generated qfrc_inverse(by updating qfrc_applied with qfrc_inverse before calling mj_step). I think the issue might be related to how I’m approaching the computation of ctrl from qpos(I am using same approach as mentioned in tutorial) for the myo-arm model.

In a LQR tutorial with the humanoid model, they used the formula to get ctrl from qfrc

ctrl0 = np.atleast_2d(qfrc0) @ np.linalg.pinv(actuator_moment)

Thus, I was wondering if the approach to calculate ctrl from qfrc varies model to model(I am only considering musculoskeletal models). I have also gone through issue #263, which discusses calculating acceleration when nq ≠ nv, but I’m still stuck

Also, I have recently started working with biomechanics, so I am still learning the nuances of musculoskeletal models. Any help in figuring out this issue would be greatly appreciated. Thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions