Skip to content

Commit

Permalink
Fix hfield in edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Oct 14, 2024
1 parent 93dd6f9 commit a1a6c71
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/jaxsim/mujoco/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def build_from_xml(
size = [float(el) for el in hfield_element["@size"].split(" ")]
size[0], size[1] = heightmap_radius_xy
size[2] = 1.0
size[3] = max(0, -min(hfield))
# The following could be zero but Mujoco complains if it's exactly zero.
size[3] = max(0.000_001, -min(hfield))

# Replace the 'size' attribute.
hfields_dict[heightmap_name]["@size"] = " ".join(str(el) for el in size)
Expand Down

0 comments on commit a1a6c71

Please sign in to comment.