Sensing with Lidar (Tue Sep 10, lect 4) | previous | next | slides |

How do we work with the LIDAR?

Reading: Read PRR Chapter 7

Reminder: Readings are your responsibility. You will be expected to come to class prepared, having read the material, and ready to participate in the discussion

Welcome

  • Review: how it works in ROS (5 minutes)
  • All your code (almost) in ROS is a node
  • All information (almost) is transferred in the form of messages

Sensors

  • Are electronic devices
  • Connected to the Robot’s computer
  • Generatel data very fast
  • They require real-time processing
  • Publishing information

What kinds of sensors?

  • LIDAR: Rapidly rotates a laser, returns distance to nearest obstacle on each bearing
  • Camera: Measures color and brightness of light in a 2D grid
  • IMU: Measures accelration in 6 DOF. Sometimes also measures magnetic north
  • Motor encoders>: Measures position of wheels as they rotate
  • GPS: Uses satelites to measure position on the earth
  • And many more types of sensors

All Sensor Data is Noisy

  • The data you get from them is generally large arrays of floating point numbers
  • Even if nothing is changing, you will see it change a lot
  • Signal vs. Noise
  • There are many techniques for extracting the signatl

Sensor Data delivered as ROS topics

  • What is the “topic” that the device publishes to
  • How frequently does it publish (e.g. 10 times per second, once every second)
  • And what is the message type
  • Often 10 to 60 times per second. Real Time

Acting on the sensor data

  • A node subscribes to that topic
  • Writes a “handler” which is invoked each time the sensor node publishes

Simulation and IRL are different

  • Sensor’s specifications are different (subtly)
  • Ranges and what happens when out of range
  • Degree of “randomness”
  • Exact dimensions of robots, obstacles, etc.

Lidar Refresher

  • Rotating laser beam
  • “Time of Flight” Sensor
  • Key raw data is an array of numbers
  • Indexed by the bearing position of the lidar beam at that instance
  • Each cell is the distance in meters

Data from Sensors

  • Each sensor, each model and brand, has different specifications and characteristics
  • Like all other sensors, the data you get from a Lidar is noisy
  • Depending on the software you may have to ‘clean’ the data before you can make sense of it
  • Our robots all use a YDLIDAR X4

/scan topic

  • Lidar data is published as a /scan topic with /LaserScan messages
  • The most important field that you need to understand is the “ranges”.
  • You can access the reading of a specific angle by using “range[index]”, and access a sub-array by using “range[index0:index1]”

Raw sensor data

  • To study the Lidar data we can dump out the lidar data into a .csv file format

rostopic echo /scan -w 4 -p -n 50 > ~/scan_data

Lidar data

  • As mentioned there are different model Lidars as well as the simulated Lidar in Gazebo
  • Here are some of the facts that are required
  • Some of them are present in the /scan message, others are not
  • Lets look at the data: see cosi119_src/data for a short program and the data it generates
  • A simple way to look at this data in this: google sheet

Present in the /scan message

  1. How many “cells” are present in each frame
  2. What is the minimum and maximum bearing
  3. (From that you can compute how many radians each “cell” corresponds to)

Not present in the message

  1. Height of the Lidar from the floor
  2. Direction it is pointing
  3. Clockwise vs. counter clockwise
  4. (The last three are captured as the “coordinate system” of the Lidar or the tf)
  5. Unit of distance (almost always Meters)
  6. Closest and furthest valid distance
  7. “Invalid” value (0 or NaN or ?)

Python

  • Subscribe to /scan topic
  • Message type LaserScan.msg
  • In Python it will be delivered to you as an object of class LaserScan.
  • Consider writing a separate filter node which takes “raw” LiDAR data (subscribes to /scan) and publishes “cleaned up” LiDAR data (publishes for example to /scan/clean).
  • A related approach is to subscribe to /scan and publish something like /scan/semantic that instead of just cleaning up the data also computes some mins and maxes in different directions of interest.

Video Tutorials

  • Watch and study these for a review from a different perspective.

Thank you. Questions?  (random Image from picsum.photos)