How to Avoid Using Lidar Sensors

Hello.
I’m going to apply the Lidar sensor provided by Isaac sim to my robot to obtain the data value and add the avoidance function.
I know how to acquire data through this example, but I don’t know how to avoid it.
https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/tutorial_advanced_range_sensor_lidar.html#use-the-python-api

Hello @toni.sm
As I said above, I want to apply Isaac sim’s Lidar sensor to my robot to acquire data, and when I detect certain objects (Cube, Cone), I want to put in a function that moves by avoiding them.

I tried to get the data following this example, but nothing is printed. I put Lidar in robot.usd first, and I wrote Lidar’s path well in the script.
What’s the problem?
Screenshot from 2022-05-04 16-29-20

Hi @gudwnzm

Try removing the self._timeline.pause() line from code… You don’t need to pause the simulation to obtain the lidar data

In the following script you can find a simple test as a standalone python application:

/python.sh test_lidar.py

test_lidar.usd (2.3 KB)
test_lidar.py (1.2 KB)

import asyncio
import numpy as np
from omni.isaac.kit import SimulationApp

# This sample loads a usd stage and starts simulation
CONFIG = {"width": 1280, "height": 720, "sync_loads": True, "headless": False, "renderer": "RayTracedLighting"}
kit = SimulationApp(launch_config=CONFIG)

import omni
from omni.isaac.range_sensor import _range_sensor

omni.usd.get_context().open_stage("omniverse://localhost/test_lidar.usd")

# Wait two frames so that stage starts loading
kit.update()
kit.update()

print("Loading stage...")
from omni.isaac.core.utils.stage import is_stage_loading

while is_stage_loading():
    kit.update()
print("Loading Complete")

lidarInterface = _range_sensor.acquire_lidar_sensor_interface()

async def get_lidar_data():
    await omni.kit.app.get_app().next_update_async()
    depth = lidarInterface.get_depth_data("/World/Lidar")
    if depth.shape[0]:
        print("Depth: min: {}, max: {}".format(np.min(depth), np.max(depth)))
    else:
        print("Depth: None")
        
omni.timeline.get_timeline_interface().play()

while kit.is_running():
    kit.update()
    asyncio.ensure_future(get_lidar_data())

omni.timeline.get_timeline_interface().stop()
kit.close()

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.