**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](https://www.wevolver.com/article/sensors-in-robotics)
### 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
How many “cells” are present in each frame
What is the minimum and maximum bearing
(From that you can compute how many radians each “cell” corresponds to)
Not present in the message
Height of the Lidar from the floor
Direction it is pointing
Clockwise vs. counter clockwise
(The last three are captured as the “coordinate system” of the Lidar or the
tf
)
Unit of distance (almost always Meters)
Closest and furthest valid distance
“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.
This
lecture from Udemy
introduces you to a lasert scanner or LIDAR
This
lecture from Udemy
gives you more detail on how to process the lidar data
This
Reading Laserscan Data
provides almost everything you need to understand to manipulate the LaserScan data
Thank you. Questions?
(random Image from picsum.photos)