# 4. Lidar Sensors¶

## 4.1. Learning Objectives¶

In this example, we will add a lidar sensor to match the one on top of Turtlebot3, and add the rostopics to publish lidar sensor data and info.

• Add lidar sensor to the robot

• Connect lidar sensor output to a ROS lidar publisher node to publish the data.

• Visualize everything in RViz.

Prerequisite

## 4.2. Adding a Lidar ROS Bridge¶

### 4.2.1. Adding a Lidar Sensor¶

First we need to add a lidar sensor to the robot.

1. Go to Create -> Isaac -> Sensors -> Lidar -> Rotating.

2. To place the synthetic lidar sensor at the same place as the robot’s lidar unit, drag the lidar prim under /World/turtlebot3_burger/base_scan. Zero out any displacement in the Transform fields inside the Property tab. The lidar prim should now be overlapping with the scanning unit of the robot.

3. Inside the RawUSDProperties tab for the lidar prim, set the maxRange to 25. This way the lidar will ignore anything that’s beyond 25 meters. This will prevent the lidar reporting a hit everywhere in the room because of the walls.

4. We’ll check drawLines to visualize the lidar scans.

5. Press Play to see the lidar comes to life. Red lines of the scan means hit, green means no hit, the color spectrum from green to yellow to red is proportional to the distance of the object detected.

### 4.2.2. Lidar ROS OG Graph¶

Once the lidar sensor is in place, we can add the corresponding OG nodes to stream the detection data to a Rostopic. OG nodes for Lidar publisher should matches the images below.

### 4.2.3. Graph Explained¶

• On Playback Tick Node: Producing a tick when simulation is “Playing”. Nodes that receives ticks from this node will execute their compute functions every simulation step.

• Isaac Read Lidar Beam Node: Retrieve information about the Lidar and data. For inputs:LidarPrim, add target to point to the Lidar sensor we just added at /World/turtlebot3_burger/base_scan/Lidar.

• ROS1 Publish Laser Scan: Publishing laser scan data. Type /laser_scan into the Topic Name field.

• Isaac Read Simulation Time: Use Simulation time to timestamp the /laser_scan messages.

### 4.2.4. Verify ROS connections¶

1. Press Play to start ticking the graph and the physics simulation.

2. In a separate ROS-sourced terminal , check that the associated rostopics exist with rostopic list. /laser_scan should be listed in addition to /rosout and /rosout_agg.

3. To visualize the laser scan data, open RViz by typing in rviz on the command line and enter.

4. Inside rviz, add a Laser Scan type to visualize. Make sure the Topic that the laser scan is listening to matches the topic name inside the ROS1 Publish Laser Scan, and fixed frame matches the frameID inside the ROS1 Publish Laser Scan node.

## 4.3. Multiple Sensors in RViz¶

To display multiple sensors in RViz, there are a few things that are important to make sure all the messages are synced up and timestamped correctly.

Simulation Timestamp

Use Isaac Read Simulation Time as the node that feeds the timestamp into all of the publishing nodes’ timestamps.

ROS clock

To publish the simulation time, you can setup the following graph to publish a ROS clock topic.

frameID

1. To visualize all the sensors at once inside RViz, make sure the frameID of all the cameras and sensors all have the same ID name. The frameID can be found inside the Property tab -> RawUSDProperties menu -> frameId field.

2. To see the multi-sensor example below, open the USD asset Isaac/Samples/ROS/Scenario/simple_room_turtlebot.usd. Open its Action graphs and notice the frameID of all the cameras and lidar publisher were set to “turtle”.

3. To see the rviz image below, make sure the simulation is playing. In a ROS-sourced terminal, open with the configuration provided using the command: rviz -d ros_workspace/src/isaac_tutorials/rviz/camera_lidar.rviz.

## 4.4. Summary¶

This tutorial covered