Skip to content

[Bug Report] Incorrect 2D-LiDAR hit points with RayCaster #3013

Closed

Description

@d-corsi

I tried to implement a very basic 2D LiDAR to detect obstacles around the robot—something that should be quite straightforward—but I haven’t been able to get it working correctly. After a few days of research and discussions with others, I’m starting to suspect that this might be a bug.

Describe the bug

The LiDAR does work, and I can see the hit points rendered. However, some of the points are clearly incorrect and appear far from where they should be. Here’s a screenshot:

Screenshot_from_2025-07-23_17-37-26

At first, I thought it might just be a rendering issue. But after collecting the data and plotting it manually with Matplotlib, the results matched exactly what I see on screen—confirming that the issue likely lies within the RayCaster itself:

lidar_debug_plot

Steps to reproduce

I implemented it as a RayCaster directly in the config file of my RL environment, like this:

@configclass
class MyEnvCfg(DirectRLEnvCfg):

    # [...] other code [...]

    #
    lidar_scanner_cfg = RayCasterCfg(
        prim_path="/World/envs/env_0/Map/GroundPlane",
        update_period=0.1,
        offset=RayCasterCfg.OffsetCfg( pos=(0.0, 0.0, 0.5), rot=(0.0, 0.0, 0.0, 0.0)),
        max_distance=10.0,
        pattern_cfg=patterns.LidarPatternCfg(
            channels=1, vertical_fov_range=[0, 0], horizontal_fov_range=[-180, 180], horizontal_res=1.0
        ),
        debug_vis=True,
        attach_yaw_only=False,
        mesh_prim_paths=["/World/envs/env_0/ObsCube"],
    )
    
    # [...] other code [...]

System Info

  • Commit: 24a78b6
  • Isaac Sim Version: 4.5.0 and 5.00
  • OS: Ubuntu 20.04
  • GPU: RTX 4060
  • CUDA: 12.8

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have checked that the issue is not in running Isaac Sim itself and is related to the repo

Acceptance Criteria

Add the criteria for which this task is considered done. If not known at issue creation time, you can add this once the issue is assigned.

  • Being able to correctly read the 2D lidar information

Activity

  1. changed the title [-][Bug Report] Incorrect LiDAR hit points with RayCaster[/-] [+][Bug Report] Incorrect 2D-LiDAR hit points with RayCaster[/+] on Jul 24, 2025
  2. Fuhua-Bot commented on Jul 25, 2025

    @Fuhua-Bot

    had a similar problem, I suspected the mesh was not shaped correctly, then converted it to an SDF mesh. But the raycaster still gave some weird points and it didn't match the physics colliders in the GUI, very annoying.

  3. RandomOakForest commented on Jul 26, 2025

    @RandomOakForest
    Collaborator

    Thank you for posting this with such detail, and for trying both versions of Isaac Sim. The team will review this.

  4. added
    bug
    on Jul 26, 2025
  5. d-corsi commented on Jul 27, 2025

    @d-corsi
    Author

    Just to add some details. It looks like the lidar sometimes doesn't hit the outer mesh but one of the inner triangles; it feels like some faces are missing, so basically the lidar is going through the object and hitting the mesh in the back. Here a screenshot:

    Image
  6. Fuhua-Bot commented on Jul 28, 2025

    @Fuhua-Bot

    补充一些细节。看起来激光雷达有时不会击中外部网格,而是击中内部三角形中的一个;感觉像是缺少了一些面,所以基本上激光雷达会穿过物体并击中后面的网格。以下是屏幕截图:

    图像

    Yes, my case is almost the same, so I converted some meshes into SDF mesh with 1024 parameter, it helps a bit, but not compeletly solve this issue.

  7. Fuhua-Bot commented on Jul 28, 2025

    @Fuhua-Bot

    In my case, some point hit the external surface of the mesh, meanwhile, a lot of points hit the inside surface of the mesh. I am doing a project related to SLAM, it is very confusing.

    outside surface:
    Image

    inside the mech:
    Image

    my sdf mesh:

    Image
  8. pascal-roth commented on Aug 5, 2025

    @pascal-roth
    Collaborator

    Hi @d-corsi,

    thanks for looking into this. How did you add the boxes to the scene? It would be great to have the entire environment config. When using typical trimesh objects (box, cylinder, ...) everything works fine.

    First thought is that the normals are wrongly oriented, which can mess up collisions, raycasting, ... (even just try to drive with your robot into the wall that the LiDAR penetrates).

  9. sghatak5 commented on Aug 5, 2025

    @sghatak5

    Hi @pascal-roth ,

    I had similar issues, I can share my configuration if that helps.

    1. Created 4 cubes meshes with collider preset as physics and grouped them.

    2. Using the meshmergetool, merged the 4 cube mesh into 1 mesh and exported as a USD. Spawned the usd inside a scene.

    3. Raycaster config:

      WAFFLE_RAYCASTERCFG = RayCasterCfg(
      update_period=1/5.5,
      offset=RayCasterCfg.OffsetCfg(pos=(0, 0, 0.121)),
      ray_alignment="base",
      pattern_cfg=patterns.LidarPatternCfg(
      channels=1, vertical_fov_range=[0, 0], horizontal_fov_range=[-90, 90], horizontal_res=0.2
      ),
      debug_vis=True,
      )

    Main file:

    usd_object = AssetBaseCfg(
    prim_path="/World/Object",
    spawn=sim_utils.UsdFileCfg(
        usd_path="/path/of/usdfile/test2.usd",
    ),
    init_state=AssetBaseCfg.InitialStateCfg(
        pos=(0.0, 0.0, 0.0),
        rot=(1.0, 0.0, 0.0, 0.0),
    ),
    )
    ray_caster_waffle = WAFFLE_RAYCASTERCFG.replace(
        prim_path="{ENV_REGEX_NS}/turtlebot3_waffle/base_footprint/base_link/base_scan",
        mesh_prim_paths=["/World/Object"], 
    )
    

    Output:

    Image

    With a 180 degree horizontal fov, it does not cast ray on all the surface.

    Additionally, when I plot the hit_points in matplotlib, i get this.

    Image
  10. maxkra15 commented on Sep 22, 2026

    @maxkra15
    Contributor

    Thanks @d-corsi, @Fuhua-Bot, and @sghatak5 — I reproduced a current RayCaster mesh-import bug that matches these interior hits. BaseRayCaster._initialize_warp_meshes() currently forwards USD faceVertexIndices directly to Warp without applying faceVertexCounts; for quad/ngon meshes this creates artificial triangles. In a six-quad cube test, a ray that should hit the outer face at 2 m instead hit an artificial interior triangle at 3 m. Keeping this open; the fix is to triangulate USD polygon faces before building the Warp mesh and add a regression test.

  11. Arthur031221 commented on Sep 29, 2026

    @Arthur031221

    @maxkra15 I have the fix you describe here on a branch: BaseRayCaster._initialize_warp_meshes() passes the USD faces through convert_faces_to_triangles() with faceVertexCounts, the helper MultiMeshRayCaster already uses, plus a unit test that builds a closed box from six quads on an in-memory stage and casts four rays at one face. On current develop two of the four rays go through that face and report a distance of 4.0 instead of 2.0; with the change all four report 2.0. Since the issue is assigned to you, would you like me to open it as a pull request, or do you already have this in progress?

  12. added a commit that references this issue on Oct 22, 2026
    e4df255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions