[FEATURE] Add ray_alignment and link exclusion to the raycaster. - #3280
[FEATURE] Add ray_alignment and link exclusion to the raycaster.#3280lupinjia wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee678f72b4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| kernel_cast_rays_visual( | ||
| *args_common, | ||
| raw_data_T, |
There was a problem hiding this comment.
Apply link exclusions to visual ray casts
When an excluded rigid link belongs to an entity with material.use_visual_raycasting=True, its collision faces are filtered but this visual-BVH branch receives no exclusion mask. The visual pass can therefore merge a hit from the excluded link back into the result, so exclude_link_idx does not actually make the sensor blind to all of that link's geometry. Pass the per-sensor exclusion data into the rigid visual traversal and filter via the visual geometry's owning link as well.
Useful? React with 👍 / 👎.
| pitch = math.radians(args.swing) * math.sin(2.0 * math.pi * 1.0 * t) | ||
| quat = euler_to_quat((pitch, 0.0, 0.0)) | ||
| else: | ||
| # Phase 2: continuous yaw rotation about z. | ||
| yaw = math.radians(args.yaw_rate) * (t - args.phase1) | ||
| quat = euler_to_quat((0.0, 0.0, yaw)) |
There was a problem hiding this comment.
Pass degrees to the alignment demo quaternion helper
genesis.utils.geom.euler_to_quat interprets its input as degrees, but this example first converts args.swing and args.yaw_rate to radians. With the defaults, the advertised 60-degree swing is only about 1.05 degrees and the advertised 90-degree/s rotation is about 1.57 degrees/s, so the demo barely exhibits either alignment difference. Keep these values in degrees when calling the helper.
Useful? React with 👍 / 👎.
Description
This PR extends the raycaster with two capabilities that are common in legged-locomotion terrain perception:
Both features are applied per-sensor. ray_alignment is resolved at cast time by correcting the gathered link quaternion; exclude_link_idx is compiled into the ray-cast kernel as a per-sensor link mask, gated by a compile-time flag so non-filtering sensors pay no per-leaf cost.
Related Issue
None
Motivation and Context
Terrain perception for quadruped locomotion needs a downward height scan that (a) stays horizontal when the robot pitches/rolls on slopes (yaw/world) and (b) ignores the robot's own body so the scan reads the ground instead of the legs. Without these, a base-mounted grid raycast both tilts with the body and self-intersects the robot's geometry.
How Has This Been / Can This Be Tested?
Unit tests were added to tests/sensors/test_raycaster.py (run with the project's required CI command):
pytest -v --forked -m required ./tests/sensors/test_raycaster.pyTwo runnable examples demonstrate the features visually:
Screenshots (if appropriate):
Checklist:
Submitting Code Changessection of CONTRIBUTING document.