From 386662106b52ed8d1ffb2df46d220b6a39736855 Mon Sep 17 00:00:00 2001 From: Silvia Cruciani Date: Thu, 14 Nov 2024 09:40:29 -0800 Subject: [PATCH] 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 --- python/LQR.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/LQR.ipynb b/python/LQR.ipynb index adee43ed..89767ac9 100644 --- a/python/LQR.ipynb +++ b/python/LQR.ipynb @@ -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",