Guard against NaNs in MJX solver when no cost is imposed. Fixes #1225.

PiperOrigin-RevId: 586020958
Change-Id: I82f398b1538d2c3801a35c80c862e49be3b110a2
This commit is contained in:
Erik Frey
2023-11-28 10:11:12 -08:00
committed by Copybara-Service
parent e1669b568b
commit 2f37147fc0
+1 -1
View File
@@ -128,7 +128,7 @@ class _LSPoint(PyTreeNode):
cost = alpha * alpha * quad_total[2] + alpha * quad_total[1] + quad_total[0]
deriv_0 = 2 * alpha * quad_total[2] + quad_total[1]
deriv_1 = 2 * quad_total[2]
deriv_1 = 2 * quad_total[2] + (quad_total[2] == 0) * mujoco.mjMINVAL
return _LSPoint(alpha=alpha, cost=cost, deriv_0=deriv_0, deriv_1=deriv_1)