Request for working radar snippet

Detailed Description

Can anyone provide a snippet with a working radar example in Isaac Sim 4.5? I have a standalone python script that adds a DynamicSphere and a radar. The radar produces output, but there are no detections in the output. Do assets require material specifications to interact with the radar? How should one orient the radar to produce returns?

Steps to Reproduce

  1. In a standalone script, add a DynamicSphere of radius 1.0 at (0,0,0)
  2. Add a radar at (1,1,0)
  3. Run and observe that no detections are produced by the radar

Isaac Sim Version

4.5.0
4.2.0
4.1.0
4.0.0
4.5.0
2023.1.1
2023.1.0-hotfix.1
Other (please specify):

Operating System

Ubuntu 22.04
Ubuntu 20.04
Windows 11
Windows 10
Other (please specify):

Is this what you are looking for RTX Radar Sensor — Isaac Sim Documentation?

I have tried using the documentation at the link you provided, but I still can’t get this example to work. Here is the example where there are no radar detections from the sphere:

# General Python imports
import numpy as np
import asyncio
import json

# Basic simulation imports
from isaacsim import SimulationApp
simulation_app = SimulationApp({"headless": False})
from isaacsim.core.api import World

# Omniverse library imports
import omni
import omni.usd
import omni.kit.commands
import omni.replicator.core as rep

# Object imports
from isaacsim.core.api.objects import DynamicSphere
from isaacsim.core.api.objects.ground_plane import GroundPlane
import isaacsim.core.utils.stage as stage_utils

# Import range sensors, which contains LIDAR
from isaacsim.sensors.physx import _range_sensor

# Camera control
from isaacsim.core.utils.viewports import set_camera_view

# USD imports
import isaacsim.core.utils.prims as prims_utils
from pxr import UsdGeom, Gf, UsdPhysics, Sdf, UsdLux, UsdShade

# enable non visual materials
import carb
carb.settings.get_settings().set_bool("/rtx/materialDb/nonVisualMaterialCSV/enabled", False)

# Start up the sim, get the stage, timeline, and lidar interfaces
stage = omni.usd.get_context().get_stage()
timeline = omni.timeline.get_timeline_interface()
lidarInterface = _range_sensor.acquire_lidar_sensor_interface()


# Target initial parameters
target_r = 1.0
target_x0 = np.array([0.0, 0.0, target_r])


# Radar initial parameters
radar_x0 = (1.0, 1.0, 0.3)
radar_orientation = Gf.Quatd(1, 0, 0, 0.0)

# Start up the sim, get the stage, timeline, and lidar interfaces
stage = omni.usd.get_context().get_stage()
timeline = omni.timeline.get_timeline_interface()


# Add the radar, writers, and annotators
radar_config = "Example"
#radar_config = "Example_highRes"

_, radar = omni.kit.commands.execute(
    "IsaacSensorCreateRtxRadar",
    path="/radar",
    parent="/World",
    config=radar_config,
    translation=radar_x0,
    orientation=radar_orientation,
)

# 2. Create and Attach a render product to the camera
render_product = rep.create.render_product(radar.GetPath(), [1, 1]).path

# 4. Create a Replicator Writer that "writes" points into the scene for debug viewing
writer = rep.writers.get("RtxRadarDebugDrawPointCloud")
writer.attach(render_product)

# Create the annotator.
annotator = rep.AnnotatorRegistry.get_annotator("RtxSensorCpuIsaacComputeRTXRadarPointCloud")

# Initialize the annotator
annotator.initialize()

# Attach the render product after the annotator is initialized.
annotator.attach(render_product)

# Add Ground Plane
GroundPlane(prim_path="/World/GroundPlane", z_position=-0.05)

# Add Light Source
distantLight = UsdLux.DistantLight.Define(stage, Sdf.Path("/DistantLight"))
distantLight.CreateIntensityAttr(300)

# Add sphere
target = DynamicSphere(
        prim_path="/World/target",
        name="target",
        position=target_x0,
        scale=np.array([0.5015, 0.5015, 0.5015]),
        color=np.array([0.0, 0, 1.0]),
        radius=target_r,
        linear_velocity=np.array([0.0, 0.0, 0.0])
    )


# start a world to step simulator
my_world = World(stage_units_in_meters=1.0)

set_camera_view(eye=[20.00, 20.00, 20.00], target=[0.0, 0.0, 0.0], camera_prim_path="/OmniverseKit_Persp")

# start the simulator
my_world.reset()

for j in range(600):
    my_world.step(render=True)  
    
    radar_data = annotator.get_data()
    radar_info = radar_data["info"]
    if radar_info["numDetections"] > 0:
        print("A DETECTION!")

# shutdown the simulator automatically
simulation_app.close()

Thanks for sharing your script. We recently released Isaac Sim 5.0. Have you tried with it?