Skip to content

No non-deprecated way to get a fixed-grid 2D LaserScan from an RTX Lidar in Python (flat scan annotator only in deprecated isaacsim.sensors.rtx) #957

Backlog

Description

@ycpss91255

Description

The only way to get a fixed-grid 2D laser scan (ranges on a fixed angular grid, no-return slots marked) from an RTX Lidar in Python is the IsaacComputeRTXLidarFlatScan annotator, which lives in the deprecated extension isaacsim.sensors.rtx (deprecated since 6.0.0). The replacement extension isaacsim.sensors.experimental.rtx only exposes the raw GenericModelOutput (GMO): one entry per fired emitter, with azimuth/elevation/range, not a fixed grid. The ROS 2 LaserScan publisher does the binning in C++, so Python users of the non-deprecated API cannot reuse it.

Users who need ranges / angle_min / angle_increment in Python (for example to feed a non-ROS pipeline or to compare with a ROS scan) have to either depend on the deprecated extension or re-implement the binning and risk disagreeing with the ROS publisher at bin boundaries.

Environment

  • Isaac Sim 6.2.0.1 (nvcr.io/nvidia/isaac-sim:6.2.0.1), headless, Ubuntu 24.04 host, NVIDIA RTX GPU

Evidence in the source tree (paths inside the image)

  • Deprecated notice: /isaac-sim/extsDeprecated/isaacsim.sensors.rtx/config/extension.toml line 16, warning = "Extension deprecated since Isaac Sim 6.0.0 in favor of the Experimental extension: isaacsim.sensors.experimental.rtx".
  • The flat scan node exists only under /isaac-sim/extsDeprecated/isaacsim.sensors.rtx/ (OgnIsaacComputeRTXLidarFlatScan.*, docs docs/ogn/OgnIsaacComputeRTXLidarFlatScan.rst). The same paths are in this repository under source/deprecated/isaacsim.sensors.rtx/nodes/.
  • /isaac-sim/exts/isaacsim.sensors.experimental.rtx/ (docs and Python) contains no flat-scan / LaserScan equivalent; LidarSensor.get_data("generic-model-output") returns GMO only.
  • The ROS 2 publisher bins GMO in C++: /isaac-sim/exts/isaacsim.ros2.nodes/isaacsim/ros2/nodes/ogn/nodes/OgnROS2PublishLaserScan.cpp (buffer pre-filled at line 173, call to getLaserScanOutputIndex at line 199), with the bin rule in source/extensions/isaacsim.ros2.nodes/include/isaacsim/ros2/nodes/LaserScanUtils.hpp (getLaserScanOutputIndex). There is no Python binding for it.

Minimal reproduction

from isaacsim import SimulationApp
app = SimulationApp({"headless": True})
import omni.replicator.core as rep
import omni.kit.app
names = sorted(rep.AnnotatorRegistry.get_registered_annotators())
print("RESULT scan-like annotators:", [n for n in names if "scan" in n.lower()])
m = omni.kit.app.get_app().get_extension_manager()
for e in m.get_extensions():
    if "sensors.rtx" in e["id"] or "sensors.experimental.rtx" in e["id"]:
        print("RESULT ext", e["id"], "enabled=", e["enabled"])
app.close()

Output observed:

RESULT scan-like annotators: ['IsaacComputeRTXLidarFlatScan', 'IsaacCreateRTXLidarScanBuffer']
RESULT ext isaacsim.sensors.experimental.rtx-2.0.1 enabled= True
RESULT ext isaacsim.sensors.rtx-15.17.5 enabled= True

IsaacComputeRTXLidarFlatScan is registered only because the deprecated isaacsim.sensors.rtx is enabled; it is not provided by isaacsim.sensors.experimental.rtx.

Measurements (Example_Rotary_2D, wall at 4.9 m)

Binning GMO ourselves versus the deprecated annotator (linearDepthData, 3600 bins, 0.1 degree, no-return -1): the valid-bin masks agree on 99.97% of bins, the range difference has p95 between about 6 mm and 6 cm, and the maximum single-bin difference is 0.23 to 0.50 m (grazing-angle returns assigned to different bins). The result is usable, but the bin rule at boundaries cannot be reproduced exactly without the C++ rule. Also note that accumulate_outputs=False gives only a partial azimuth window per frame (661 valid bins in our run), so a full scan needs accumulate_outputs=True.

Expected

A supported, non-deprecated way to obtain a fixed-grid 2D scan in Python, with the same bin and no-return rules as the ROS 2 LaserScan publisher. For example, a flat-scan annotator in isaacsim.sensors.experimental.rtx, or a Python-accessible helper (binding or documented algorithm) for the rule in LaserScanUtils.hpp.

Actual

No such API outside the deprecated extension.

Related

#896 and #897 concern the LaserScan metadata and no-return value in the ROS publisher; this request is about making the same grid available from Python.

Activity

  1. zwdoescode commented on Dec 2, 2026

    @zwdoescode

    Confirmed in the 6.2.0.1 container and the public 6.2.0 source build: the experimental RTX sensor API does not currently expose a fixed-grid 2D scan equivalent to the requested ranges/angle metadata interface. The scan annotators in your registry output come from the deprecated extension; disabling it removes them while the experimental extension remains enabled.

    The ROS 2 publisher has C++ binning helpers, but its Python publisher binding does not return scan arrays for a non-ROS consumer. This is a feature/migration request for the Python API, separate from the metadata and no-return fixes in #896 and #897.

    A useful replacement should share the ROS binning semantics, including angular endpoints, no-return slots, duplicate-bin handling and complete-scan timing. The legacy annotator is a temporary option in 6.2, with the deprecation limitation you identified. We have not independently validated the numerical differences from your custom binning experiment; its comparison script would help define conformance tests.

    I will create an internal feature request. Thanks for bringing this up.

  2. ycpss91255 commented on Dec 2, 2026

    @ycpss91255
    Author

    Thanks for confirming and for filing the internal feature request.

    Here is the comparison we used. It is two small scripts, run with the official 6.2.0.1 image. lidar2d_probe.py collects the deprecated IsaacComputeRTXLidarFlatScan output and the raw GMO from the same 2D RTX lidar in a closed room. analyze.py bins the GMO ourselves, using 3600 bins at 0.1 degree with no-return set to -1, and compares the result with the annotator. That gives the numbers in the issue: valid-bin mask agreement, range-difference p95, and max per-bin difference.

    Run (one container per configuration):

    docker run --rm --gpus all -e ACCEPT_EULA=Y -e PRIVACY_CONSENT=Y -v "$PWD:/work" \
      --entrypoint /isaac-sim/python.sh nvcr.io/nvidia/isaac-sim:6.2.0.1 \
      /work/lidar2d_probe.py --ann IsaacComputeRTXLidarFlatScan --accumulate 1 --frames 3 --maxsec 900 --out /work/out1/flat_acc1
    # then: python3 analyze.py   (reads out*/ and prints the comparison)
    lidar2d_probe.py
    """Probe official RTX 2D lidar (Example_Rotary_2D) Python output vs a flat wall.
    
    Usage (inside isaac-sim container): python.sh lidar2d_probe.py --accumulate 1 --out /work/out1
    Wall face is the plane x = WALL_X in the sensor frame (sensor at origin yaw 0 + z=1).
    Expected range for a ray (az, el): WALL_X / (cos(el) * cos(az)).
    """
    import argparse, json, os
    p = argparse.ArgumentParser()
    p.add_argument("--accumulate", type=int, default=1)
    p.add_argument("--frames", type=int, default=6)
    p.add_argument("--out", default="/tmp/out")
    p.add_argument("--config", default="Example_Rotary_2D")
    p.add_argument("--ann", default="IsaacComputeRTXLidarFlatScan")
    p.add_argument("--maxsec", type=float, default=600)
    p.add_argument("--noacc", type=int, default=0)  # 1: sensor created without get_data annotator
    args, _ = p.parse_known_args()
    WALL_X = 5.0
    from isaacsim import SimulationApp
    app = SimulationApp({"headless": True, "enable_motion_bvh": True})
    import numpy as np, omni.usd, omni.replicator.core as rep
    import isaacsim.core.experimental.utils.app as app_utils
    from isaacsim.core.experimental.objects import Cube, DomeLight
    from isaacsim.sensors.experimental.rtx import Lidar, LidarSensor, parse_generic_model_output_data
    omni.usd.get_context().new_stage()
    DomeLight("/World/DomeLight").set_intensities(500)
    Cube("/World/wall", positions=np.array([WALL_X + 0.1, 0.0, 1.0]), scales=np.array([0.2, 60.0, 10.0]))
    from pxr import UsdGeom, Usd
    _bb = UsdGeom.BBoxCache(Usd.TimeCode.Default(), ["default"]).ComputeWorldBound(omni.usd.get_context().get_stage().GetPrimAtPath("/World/wall")).ComputeAlignedRange()
    WALL_FACE = float(_bb.GetMin()[0])  # face toward the sensor at x=0 (sensor at origin x)
    lidar = Lidar.create("/World/lidar", config=args.config, translations=np.array([0.0, 0.0, 1.0]),
                         accumulate_outputs=bool(args.accumulate))
    sensor = LidarSensor(lidar, annotators=([] if args.noacc else ["generic-model-output"]))
    prim = lidar.prims[0]
    attrs = {}
    for n in ["scanType", "scanRateBaseHz", "patternFiringRateHz", "nearRangeM", "farRangeM", "elementsCoordsType",
              "outputFrameOfReference", "accumulateOutputs", "numberOfChannels", "startAzimuthOffsetDeg",
              "rotationDirection", "azimuthErrorStd"]:
        a = prim.GetAttribute("omni:sensor:Core:" + n)
        attrs[n] = str(a.Get()) if a and a.IsValid() else None
    for n in ["azimuthDeg", "elevationDeg"]:
        a = prim.GetAttribute("omni:sensor:Core:emitterState:s001:" + n)
        attrs["emitter_" + n] = [float(v) for v in a.Get()] if a and a.IsValid() and a.Get() is not None else None
    reg = sorted(rep.AnnotatorRegistry.get_registered_annotators())
    filt = [r for r in reg if any(k in r.lower() for k in ("lidar", "rtx", "genericmodel", "flatscan", "scan", "radar"))]
    from omni.replicator.core import Writer
    ANN = args.ann.split(",")
    other = {}
    flats = []
    def summ(v):
        if isinstance(v, dict): return {k: summ(x) for k, x in v.items()}
        if hasattr(v, "shape"):
            try: a = v.numpy() if hasattr(v, "numpy") else np.asarray(v)
            except Exception: a = None
            d = {"type": type(v).__name__, "shape": list(v.shape), "dtype": str(getattr(v, "dtype", ""))}
            if a is not None and a.size: d["head"] = [float(x) for x in a.reshape(-1)[:4]]; d["min"] = float(a.min()); d["max"] = float(a.max())
            return d
        return {"type": type(v).__name__, "val": str(v)[:80]}
    class W2(Writer):
        def __init__(self):
            self.data_structure = "renderProduct"
            self.annotators = []
            for a in ANN:
                try: self.annotators.append(rep.annotators.get(a))
                except Exception as e: other["err_" + a] = repr(e)[:200]
        def write(self, data):
            other["_write_calls"] = other.get("_write_calls", 0) + 1
            other["_top_keys"] = sorted(data.keys())
            if "renderProducts" not in data: return
            for _, rp in data["renderProducts"].items():
                other["_rp_keys"] = sorted(rp.keys())
                for a in ANN:
                    if a in rp and a not in other: other[a] = summ(rp[a])
                    v = rp.get(a)
                    if a == "IsaacComputeRTXLidarFlatScan" and isinstance(v, dict) and len(flats) < 3:
                        flats.append({k: (np.asarray(x.numpy() if hasattr(x, "numpy") else x).copy()) for k, x in v.items()})
    rep.WriterRegistry.register(W2)
    sensor.attach_writer("W2")
    import omni.timeline; omni.timeline.get_timeline_interface().play()
    frames = []
    i = 0
    import time; t0 = time.time(); first = None
    while app.is_running() and (len(frames) < args.frames or ("IsaacComputeRTXLidarFlatScan" in ANN and len(flats) < 3)) and time.time() - t0 < args.maxsec:
        app.update(); i += 1
        if args.noacc: continue
        data, info = sensor.get_data("generic-model-output")
        if data is None: continue
        g = parse_generic_model_output_data(data)
        n = int(g.numElements)
        if n == 0: continue
        if first is None: first = {'update': i, 'sec': round(time.time() - t0, 1)}
        az = np.asarray(g.x).copy(); el = np.asarray(g.y).copy(); rg = np.asarray(g.z).copy()
        frames.append({"n": n, "coords": str(g.elementsCoordsType), "frame": str(getattr(g, "frameOfReference", "?")),
                       "az": az, "el": el, "rg": rg, "scalar": np.asarray(g.scalar).copy(),
                       "info_keys": sorted(info.keys()) if isinstance(info, dict) else str(type(info)),
                       "fields": [f for f in dir(g) if not f.startswith("_")]})
    omni.timeline.get_timeline_interface().stop()
    os.makedirs(args.out, exist_ok=True)
    os.makedirs(args.out, exist_ok=True)
    res = {"args": vars(args), "wall_x": WALL_X, "wall_face_x": WALL_FACE, "prim_attrs": attrs, "annotators_filtered": filt, "other_annotators": other, "all_core_attrs": {a.GetName(): str(a.Get())[:60] for a in prim.GetAttributes() if a.GetName().startswith("omni:sensor") and "emitterState" not in a.GetName()}, "ref_asset": str(prim.GetMetadata("references") if hasattr(prim,"GetMetadata") else ""), "n_registered": len(reg),
           "sim_updates": i, "elapsed_s": round(time.time() - t0, 1), "first_data": first, "n_frames": len(frames), "frames": []}
    for f in frames:
        az, el, rg = f["az"], f["el"], f["rg"]
        exp = WALL_FACE / (np.cos(np.radians(el)) * np.cos(np.radians(az)))
        ok = np.abs(az) < 80  # exclude grazing rays (hit_wall only if cos(az)>0)
        err = np.abs(rg - exp)[ok]
        # flat scan: bin by azimuth with resolution from scan/firing rate
        res_deg = 360.0 * float(attrs["scanRateBaseHz"]) / float(attrs["patternFiringRateHz"])
        nb = int(round(360.0 / res_deg)); scan = np.full(nb, -1.0, np.float32)
        idx = np.floor((az + 180.0) / res_deg).astype(int) % nb
        scan[idx] = rg
        front = (np.abs(az) < 0.5)
        res["frames"].append({"n": f["n"], "coords": f["coords"], "frame": f["frame"], "info_keys": f["info_keys"],
            "az_min": float(az.min()), "az_max": float(az.max()), "az_step_median": float(np.median(np.diff(np.sort(az)))),
            "el_unique": [float(v) for v in np.unique(np.round(el, 3))][:5],
            "range_min": float(rg.min()), "range_max": float(rg.max()),
            "front_range_mean": float(rg[front].mean()) if front.any() else None,
            "front_expected": float(exp[front].mean()) if front.any() else None,
            "abs_err_max_|az|<80": float(err.max()), "abs_err_mean_|az|<80": float(err.mean()),
            "n_in_|az|<80": int(ok.sum()), "flatscan_bins": nb, "flatscan_filled": int((scan >= 0).sum()),
            "scalar_min": float(f["scalar"].min()), "scalar_max": float(f["scalar"].max()),
            "fields": f["fields"][:60]})
    fs = []
    for f in flats:
        d = f["linearDepthData"]
        if len(d) == 0:
            fs.append({"len": 0, "keys": sorted(f.keys()), "shapes": {k: list(v.shape) for k, v in f.items()}, "vals": {k: v.tolist() for k, v in f.items() if v.size <= 4}}); continue
        r = float(f["horizontalResolution"]); a0 = float(f["azimuthRange"][0])
        azb = a0 + r * np.arange(len(d)); exp = WALL_FACE / np.cos(np.radians(azb))
        ok = (np.abs(azb) < 80) & (d >= 0)
        fs.append({"len": len(d), "res_deg": r, "az0": a0, "fov": float(f["horizontalFov"]), "valid_bins": int((d >= 0).sum()),
                   "n_ok_|az|<80": int(ok.sum()), "n_bins_|az|<80": int((np.abs(azb) < 80).sum()),
                   "idx_az0": int(np.argmin(np.abs(azb))), "range_at_az0": float(d[int(np.argmin(np.abs(azb)))]),
                   "abs_err_max": float(np.abs(d - exp)[ok].max()) if ok.any() else None, "abs_err_mean": float(np.abs(d - exp)[ok].mean()) if ok.any() else None,
                   "min_valid": float(d[d >= 0].min()) if (d >= 0).any() else None, "max_valid": float(d.max()),
                   "invalid_value": float(np.unique(d[d < 0])[0]) if (d < 0).any() else None,
                   "intensity_unique": [int(v) for v in np.unique(f["intensitiesData"])][:6], "keys": sorted(f.keys())})
    res["flat_stats"] = fs
    if flats: np.savez(os.path.join(args.out, f"flat_{args.accumulate}.npz"), **{k: v for k, v in flats[0].items()})
    json.dump(res, open(os.path.join(args.out, f"acc{args.accumulate}.json"), "w"), indent=1)
    if frames: np.savez(os.path.join(args.out, f"acc{args.accumulate}_f0.npz"), az=frames[0]["az"], el=frames[0]["el"], rg=frames[0]["rg"])
    print("RESULT_JSON", json.dumps(res)[:6000])
    app.close()
    analyze.py
    """Offline analysis of saved npz: flat scan vs wall plane, and GMO->flat self-binning vs annotator flat scan.
    Run: docker run --rm --entrypoint /isaac-sim/python.sh -v <dir>:/d nvcr.io/nvidia/isaac-sim:6.2.0.1 /d/analyze.py /d
    """
    import sys, json, os, numpy as np
    D = sys.argv[1]; FACE = 4.9  # wall face x (Cube size=2 default * scale 0.2 -> half 0.2 ; center 5.1) verified by bbox in probe logs
    out = {}
    for rep in ("out1", "out2"):
        for job in ("flat_acc1", "flat_acc0"):
            fp = os.path.join(D, rep, job, f"flat_{job[-1]}.npz")
            gp = os.path.join(D, rep, job, f"acc{job[-1]}_f0.npz")
            if not (os.path.exists(fp) and os.path.exists(gp)): continue
            f = np.load(fp); g = np.load(gp)
            d = f["linearDepthData"]; r = float(f["horizontalResolution"]); a0 = float(f["azimuthRange"][0])
            azb = a0 + r * np.arange(len(d)); exp = FACE / np.cos(np.radians(azb))
            ok = (np.abs(azb) < 80) & (d >= 0)
            e = np.abs(d - exp)[ok]
            res = {"flat_valid_bins": int((d >= 0).sum()), "flat_n_ok_az<80": int(ok.sum()), "flat_err_vs_plane_max": float(e.max()), "flat_err_mean": float(e.mean()),
                   "flat_err_p99": float(np.percentile(e, 99)), "range_at_az0": float(d[int(np.argmin(np.abs(azb)))])}
            # GMO self-binning
            az, rg = g["az"], g["rg"]
            idx = np.floor((az - a0) / r + 0.5).astype(int)  # nearest-bin
            mine = np.full(len(d), -1.0, np.float32); mine[np.clip(idx, 0, len(d) - 1)] = rg  # last-write wins
            both = (mine >= 0) & (d >= 0)
            res.update({"gmo_n": int(len(az)), "gmo_err_vs_plane_max(|az|<80)": float(np.abs(rg - FACE / (np.cos(np.radians(az)) * np.cos(np.radians(g["el"]))))[np.abs(az) < 80].max()),
                        "mine_valid_bins": int((mine >= 0).sum()), "both_valid": int(both.sum()),
                        "mine_vs_annot_absdiff_max": float(np.abs(mine - d)[both].max()) if both.any() else None,
                        "mine_vs_annot_absdiff_p95": float(np.percentile(np.abs(mine - d)[both], 95)) if both.any() else None,
                        "same_valid_mask_frac": float(((mine >= 0) == (d >= 0)).mean())})
            out[f"{rep}/{job}"] = res
    print(json.dumps(out, indent=1)); pass

    One note for the conformance tests. The largest differences (0.23 to 0.50 m) were grazing-angle returns that landed in neighbouring bins. So the bin-assignment rule at boundaries is the part we most need defined (inclusive or exclusive edges, rounding, and which return wins when one bin gets more than one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions