-
Notifications
You must be signed in to change notification settings - Fork 3k
Fixes lidar pattern horizontal resolution bug #4452
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
base: main
Are you sure you want to change the base?
Conversation
Greptile OverviewGreptile SummaryFixed a critical bug in Key Changes:
The fix is mathematically correct and thoroughly tested. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant LidarPatternCfg
participant lidar_pattern
participant torch
participant RayCaster
User->>LidarPatternCfg: Create config with horizontal_res=90°, FOV=360°
User->>lidar_pattern: Call lidar_pattern(cfg, device)
lidar_pattern->>lidar_pattern: Create vertical_angles via linspace
lidar_pattern->>lidar_pattern: Check if 360° FOV (line 151-154)
Note over lidar_pattern: If 360°: up_to = -1<br/>Else: up_to = None
lidar_pattern->>lidar_pattern: Calculate num_horizontal_angles (FIX)
Note over lidar_pattern: OLD: ceil(360/90) = 4<br/>NEW: ceil(360/90) + 1 = 5
lidar_pattern->>torch: linspace(start, end, num_horizontal_angles)
Note over torch: Creates 5 points: [-180°, -90°, 0°, 90°, 180°]
lidar_pattern->>lidar_pattern: Apply [:up_to] slicing
Note over lidar_pattern: For 360° FOV: removes last point<br/>Result: [-180°, -90°, 0°, 90°]<br/>Spacing: 90° ✓
lidar_pattern->>lidar_pattern: Convert to radians and create meshgrid
lidar_pattern->>lidar_pattern: Spherical to Cartesian conversion
lidar_pattern->>RayCaster: Return (ray_starts, ray_directions)
Note over User,RayCaster: Result: Correct 90° angular spacing<br/>4 rays instead of 3 (120° spacing)
|
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.
No files reviewed, no comments
|
A very clean fix. Thank you @pascal-roth. This does indeed solve #4430. nit: Long-term, I still think it would be nice to have consistency in the configuration between horizontal and vertical (i.e. number of channels vs resolution). |
Description
This PR fixes a bug in the lidar pattern horizontal angle calculation and enhances the test suite for ray caster patterns.
Bug Fix: The lidar pattern was generating incorrect number of horizontal angles, causing the actual angular resolution to differ from the requested resolution. For example, requesting 90° resolution for a 360° FOV produced only 3 rays (120° spacing) instead of 4 rays (90° spacing)
Test Enhancements:
Fixes #4430
Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there