Reshape arrays for LQR notebooks for Mujoco sparse2dense

Without reshape the collabs results in an error due to incompatible function arguments

PiperOrigin-RevId: 696554177
Change-Id: Id4317ee6fccbe2ac912af7a8b07228ddebebbbcf
This commit is contained in:
Silvia Cruciani
2024-11-14 09:40:29 -08:00
committed by Copybara-Service
parent 0a0de6615d
commit 386662106b
+2 -2
View File
@@ -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",