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()