-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds dynamic and multi-mesh support for ray caster #1886
base: main
Are you sure you want to change the base?
Adds dynamic and multi-mesh support for ray caster #1886
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it gives an error if we're adding raycaster to observations and resetting an env. you have some mismatch in array shapes, i believe this on lines 292-297 fixes it:
mask = distance < final_distances[env_ids]
final_distances[env_ids][mask] = distance[mask]
final_hits[env_ids][mask] = hit[mask]
# update the ray hit data for the specified environments
self._data.ray_hits_w[env_ids] = final_hits[env_ids]
Thanks for the MR. This is an interesting addition. However, using a for loop over all the meshes will be rather slow. Especially if we go for multiple meshes per environment -- two mesh per environment with 4096 environments will mean 8192 separate warp kernel calls. This is rather expensive as launching a kernel takes time. Is it possible to make a new warp kernel that parallelizes this as well? |
Signed-off-by: timkobiolka <[email protected]>
Thanks for catching that! I have applied the fix 😃 |
Thanks for reviewing the MR and for the feedback! I initially structured it with a loop over the meshes to keep the logic more straightforward. However, I agree that parallelizing the kernel calls for all meshes would be much more efficient, especially at scale with many environments. I’ll look into adding a new Warp kernel this week to handle multiple meshes. |
I have now implemented a new Warp kernel (multi_mesh_raycast_kernel) to efficiently handle multiple meshes in parallel. The previous for-loop has been replaced with a single batched kernel that processes all rays against multiple meshes simultaneously. I have also added caching for mesh-to-environment mappings to reduce CPU overhead between frames. This should significantly improve the raycasting performance, especially for larger numbers of environments and meshes. Let me know if any further adjustments or improvements are needed. |
Description
This PR extends the ray caster to support multiple meshes in
mesh_prim_paths
, enabling it to interact with complex environments. Additionally, it now supports dynamic meshes, allowing real-time updates to mesh positions during simulation.This update is fully backward-compatible with existing single-mesh configuration.
A test file is included which shows that multiple and dynamic meshes are processed by the updated ray caster.
Fixes #1804 #1395 #1259 #553
Type of change
Checklist
pre-commit
checks with./isaaclab.sh --format
config/extension.toml
fileCONTRIBUTORS.md
or my name already exists there