From 181acad71c2e3c4ece79bcccd066191d63480b9a Mon Sep 17 00:00:00 2001 From: Filippo Luca Ferretti Date: Wed, 30 Oct 2024 17:21:16 +0100 Subject: [PATCH] Fix `ZeroDivision` error in `PlaneTerrain.height` --- src/jaxsim/terrain/terrain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jaxsim/terrain/terrain.py b/src/jaxsim/terrain/terrain.py index b139f7db2..9afd19461 100644 --- a/src/jaxsim/terrain/terrain.py +++ b/src/jaxsim/terrain/terrain.py @@ -147,7 +147,7 @@ def height(self, x: jtp.FloatLike, y: jtp.FloatLike) -> jtp.Float: D = -C * self._height # Invert the plane equation to get the height at the given (x, y) coordinates. - return jnp.array(-(A * x + B * y + D) / C).astype(float) + return jnp.array(-(A * x + B * y + D) / (C + 1e-9)).astype(float) def __hash__(self) -> int: