Skip to content

Commit

Permalink
Merge pull request #357 from ami-iit/hotfix_env_var_bottom_collidable…
Browse files Browse the repository at this point in the history
…_points

Fix environment variable usage for `JAXSIM_COLLISION_USE_BOTTOM_ONLY`
  • Loading branch information
flferretti authored Feb 10, 2025
2 parents e51cd1c + 2ee260f commit 4cfb2d2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/jaxsim/parsers/rod/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ def create_box_collision(
# Conditionally add the top corners based on the environment variable.
top_corners = (
np.array([[0, 0, z], [x, 0, z], [x, y, z], [0, y, z]])
if not os.environ.get("JAXSIM_COLLISION_USE_BOTTOM_ONLY", "0")
if os.environ.get("JAXSIM_COLLISION_USE_BOTTOM_ONLY", "0").lower()
in {
"false",
"0",
}
else []
)

Expand Down Expand Up @@ -184,7 +188,10 @@ def fibonacci_sphere(samples: int) -> npt.NDArray:
]

# Filter to keep only the bottom half if required.
if os.environ.get("JAXSIM_COLLISION_USE_BOTTOM_ONLY", "0"):
if os.environ.get("JAXSIM_COLLISION_USE_BOTTOM_ONLY", "0").lower() in {
"true",
"1",
}:
# Keep only the points with z <= 0.
points = [point for point in points if point[2] <= 0]

Expand Down

0 comments on commit 4cfb2d2

Please sign in to comment.