Sensing with Lidar (Thu Sep 12, lect 5) | previous | next | slides |

How do we work with the LIDAR?

How Projects Will Work

  • Final projects will be 35% of your grade
  • You may choose to work alone or on a team with 2 other students (3 total max)
  • You will be able to form your own teams
  • Robotics Term Projects

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
  • Wired to the built in computer
  • In the case of the TB3, wired to the Arduino
  • Code on the Arduino read the i/o and participate as a node in ROS
  • Publishing information

ROS info required

  • 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

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.

Lets look at some code about sensors

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 mini rovers have 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

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

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