NVIDIA Isaac Sim: LIDAR 사용
개요
시뮬레이션에서 LIDAR을 생성합니다.
이 내용은 Issac Sim의 tutorial에 기재되어 있으며 이에 따라 진행될 것입니다.
운영 환경
specification
CPU
i9-11900H
GPU
GeForce RTX 3080 Laptop
RAM
32GB
OS
Ubuntu 20.04.3 LTS
절차.
GUI의 작업과 Python API에서 장면에 LIDAR을 추가합니다.
1. LIADR(GUI) 추가
이 페이지에 기재된 순서에 따라 진행하다.
1.1 Omniverse에서 Issac Sim 시작

1.2 제작 장면
메뉴 표시줄의 Create&Physics Scene을 선택합니다.

1.3 LIDAR 증가
생성된 장면에 LIDAR을 추가합니다.
메뉴 표시줄의 Create > Isaac > Sensors > LIDAR > Rotating을 선택하십시오.

1.4 LIDAR 설정
추가된 LIDAR 속성을 조정합니다.
오른쪽 Stage에서 추가 LIDAR을 선택합니다.
선택한 상태에서 오른쪽 아래 코너의 Property에서 다음 값을 변경합니다.

이 상태에서 Viewport 왼쪽에 있는 PLAY 버튼을 누르면 LIDAR가 회전합니다.
또한 Raw USD Properties의 rotationRate를 0.0으로 설정하면 LINDAR의 레이저가 모두 출력됩니다.

1.5 객체 추가
LIDAR 센서는 장면에 존재하는 객체의 Collision이 Enable인 객체를 식별합니다.
장면에 객체를 추가하여 LIDAR에서 식별합니다.
먼저 장면에 큐브를 추가합니다.
메뉴 표시줄의 Create>Mesh&Cube를 선택합니다.

오른쪽 Stage에서 추가 Cube를 선택합니다.
선택한 상태에서 오른쪽 아래 코너의 Property에서 다음 값을 변경합니다.

선택하면 Collision 속성이 객체에 추가됩니다.

이 상태에서 Viewport 왼쪽에 있는 PLAY 버튼을 누르면 LIDAR의 레이저가 큐브에 비치는 상태가 된다.

1.6 객체에 LIDAR 첨부
Cylinder에 LIADR을 첨부합니다.
Viewport에서 마우스 오른쪽 버튼을 클릭하고Create>Mesh&Cylinder를 선택합니다.

오른쪽 Stage에서 추가된 Cylinder를 선택합니다.
선택한 상태에서 오른쪽 아래 코너의 Property에서 다음 값을 변경합니다.


그런 다음 Cylindar와 LIDAR의 상대 위치를 수정합니다.
오른쪽 Stage에서 LIDAR을 선택합니다.
선택한 상태에서 오른쪽 아래 코너의 Property에서 다음 값을 변경합니다.


1.7 로봇에 LIDAR 첨부
LIDAR을 로봇에 부착하는 절차는 전항과 같습니다.
이번에는 캐터의 엑시플을 사용해 LIDAR을 캐터에 부착했다.
메뉴 모음의 Isaac Examples > Import Robots > Carter URDF를 선택합니다.

메뉴 표시줄의 Create>Isaac>Sensors>LIDAR>Rotating 선택

오른쪽에 있는 Stage 태그에서 LIDAR 을 선택하고/carter/chassis 를 선택합니다.linkr 아래에서 드래그해서 이동합니다.

오른쪽 Stage에서 LIDAR을 선택합니다.
선택한 상태에서 오른쪽 아래 코너의 Property에서 다음 값을 변경합니다.


2. LIDAR(Python API) 추가
2.1 LIADR 추가
Python API에서 LIDAR을 사용합니다.
메뉴 모음에서 File>New 를 선택합니다.
그런 다음 메뉴 모음에서 Window>Script Editor를 선택합니다.

다음 내용은 Script Editor에 설명되어 있습니다.
Python3
import omni
import asyncio
from omni.isaac.range_sensor import _range_sensor
from pxr import UsdGeom, Gf, UsdPhysics
stage = omni.usd.get_context().get_stage()
lidarInterface = _range_sensor.acquire_lidar_sensor_interface()
timeline = omni.timeline.get_timeline_interface()
omni.kit.commands.execute('AddPhysicsSceneCommand',stage = stage, path='/World/PhysicsScene')
lidarPath = "/LidarName"
result, prim = omni.kit.commands.execute(
"RangeSensorCreateLidar",
path=lidarPath,
parent="/World",
min_range=0.4,
max_range=100.0,
draw_points=False,
draw_lines=True,
horizontal_fov=360.0,
vertical_fov=30.0,
horizontal_resolution=0.4,
vertical_resolution=4.0,
rotation_rate=0.0,
high_lod=False,
yaw_offset=0.0,
enable_semantics=False
)
CubePath = "/World/CubeName"
cubeGeom = UsdGeom.Cube.Define(stage, CubePath)
cubePrim = stage.GetPrimAtPath(CubePath)
cubeGeom.AddTranslateOp().Set(Gf.Vec3f(200.0, 0.0, 0.0))
cubeGeom.CreateSizeAttr(100)
collisionAPI = UsdPhysics.CollisionAPI.Apply(cubePrim)
async def get_lidar_param():
await omni.kit.app.get_app().next_update_async()
timeline.pause()
depth = lidarInterface.get_linear_depth_data("/World"+lidarPath)
zenith = lidarInterface.get_zenith_data("/World"+lidarPath)
azimuth = lidarInterface.get_azimuth_data("/World"+lidarPath)
print("depth", depth)
print("zenith", zenith)
print("azimuth", azimuth)
timeline.play()
asyncio.ensure_future(get_lidar_param())
설명 후 Ctrl + Enter 키를 누르면 Script가 실행되고 장면에 LIADR이 추가됩니다.
2.2 Point Cloud의 Segmentaiton
Depth 데이터에 sematinc label을 추가하여 segmentation 결과를 Point Cloud로 표시할 수 있습니다.
다음 내용은 Script Editor에 설명되어 있습니다.
Python3
import omni # Provides the core omniverse apis
import asyncio # Used to run sample asynchronously to not block rendering thread
from omni.isaac.range_sensor import _range_sensor # Imports the python bindings to interact with lidar sensor
from pxr import UsdGeom, Gf, UsdPhysics # pxr usd imports used to create cube
stage = omni.usd.get_context().get_stage() # Used to access Geometry
timeline = omni.timeline.get_timeline_interface() # Used to interact with simulation
lidarInterface = _range_sensor.acquire_lidar_sensor_interface() # Used to interact with the LIDAR
# These commands are the Python-equavalent of the first half of this tutorial
omni.kit.commands.execute('AddPhysicsSceneCommand',stage = stage, path='/World/PhysicsScene')
lidarPath = "/LidarName"
# Create lidar prim
result, prim = omni.kit.commands.execute(
"RangeSensorCreateLidar",
path=lidarPath,
parent="/World",
min_range=0.4,
max_range=100.0,
draw_points=True,
draw_lines=False,
horizontal_fov=360.0,
vertical_fov=60.0,
horizontal_resolution=0.4,
vertical_resolution=0.4,
rotation_rate=0.0,
high_lod=True,
yaw_offset=0.0,
enable_semantics=True
)
UsdGeom.XformCommonAPI(prim).SetTranslate((200.0, 0.0, 0.0))
# Create a cube, sphere, add collision and different semantic labels
primType = ["Cube", "Sphere"]
for i in range(2):
prim = stage.DefinePrim("/World/"+primType[i], primType[i])
UsdGeom.XformCommonAPI(prim).SetTranslate((-200.0, -200.0 + i * 400.0, 0.0))
UsdGeom.XformCommonAPI(prim).SetScale((100, 100, 100))
collisionAPI = UsdPhysics.CollisionAPI.Apply(prim)
# Add semantic label
sem = Semantics.SemanticsAPI.Apply(prim, "Semantics")
sem.CreateSemanticTypeAttr()
sem.CreateSemanticDataAttr()
sem.GetSemanticTypeAttr().Set("class")
sem.GetSemanticDataAttr().Set(primType[i])
# Get point cloud and semantic id for lidar hit points
async def get_lidar_param():
await asyncio.sleep(1.0)
timeline.pause()
pointcloud = lidarInterface.get_point_cloud_data("/World"+lidarPath)
semantics = lidarInterface.get_semantic_data("/World"+lidarPath)
print("Point Cloud", pointcloud)
print("Semantic ID", semantics)
timeline.play()
asyncio.ensure_future(get_lidar_param())
설명 후 Ctrl + Enter 키를 눌러 Script를 실행하고 Cube 표면에 Point Cloud를 표시합니다.
Reference
이 문제에 관하여(NVIDIA Isaac Sim: LIDAR 사용), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/sotahi/articles/1f99aea38d4cd9텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)