Skip to content

Commit

Permalink
Fix ZeroDivision error in PlaneTerrain.height
Browse files Browse the repository at this point in the history
  • Loading branch information
flferretti committed Nov 4, 2024
1 parent c744293 commit a2ab2d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/jaxsim/terrain/terrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit a2ab2d0

Please sign in to comment.