Skip to content

Commit

Permalink
Reshape arrays for LQR notebooks for Mujoco sparse2dense
Browse files Browse the repository at this point in the history
Without reshape the collabs results in an error due to incompatible function arguments

PiperOrigin-RevId: 696554177
Change-Id: Id4317ee6fccbe2ac912af7a8b07228ddebebbbcf
  • Loading branch information
silviacruciani authored and copybara-github committed Nov 14, 2024
1 parent 0a0de66 commit 3866621
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/LQR.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,10 @@
"actuator_moment = np.zeros((model.nu, model.nv))\n",
"mujoco.mju_sparse2dense(\n",
" actuator_moment,\n",
" data.actuator_moment,\n",
" data.actuator_moment.reshape(-1),\n",
" data.moment_rownnz,\n",
" data.moment_rowadr,\n",
" data.moment_colind,\n",
" data.moment_colind.reshape(-1),\n",
")\n",
"ctrl0 = np.atleast_2d(qfrc0) @ np.linalg.pinv(actuator_moment)\n",
"ctrl0 = ctrl0.flatten() # Save the ctrl setpoint.\n",
Expand Down

0 comments on commit 3866621

Please sign in to comment.