Expected range by ray casting
The prediction comes from the map. Place the sensor at its pose in the map and follow a straight line from it in the direction of beam until the line meets the first wall or occupied cell. The length of that line is the expected range , the reading a noise-free sensor would return if the map were complete. Following such a line through the map is called ray casting. In an occupancy grid it steps from cell to cell along the line and stops at the first occupied cell. A line that meets nothing within the sensor’s maximum range gives . The line starts at the sensor, not at the robot’s center. With the robot at and the sensor mounted at in the robot frame, the sensor sits at in the map, and beam , at bearing in the sensor frame, points at the angle . The notation for a scan is:- Scan: , one range per beam.
- Expected range: , where casts the ray of beam from the sensor pose above.
- Range limits of the sensor: and .
The four components
Each component is a distribution of the measured range of one beam, given its expected range (Thrun, Burgard and Fox, Section 6.3.1). Thrun, Burgard and Fox define them on . A real sensor cannot report a range below its minimum , so here the continuous components live on , and the value itself is kept for a beam that returned nothing. Hit. A return from the surface the map predicts, with Gaussian measurement noise: where makes the density integrate to one over that interval. Short. A return from an object between the sensor and the predicted surface, such as a person the map does not contain. Nearer objects block the beam first, so the density falls with range: Max. A beam that returned nothing reads . This component is a point mass, . Thrun, Burgard and Fox write it as the indicator and note that it has no density (Eq. 6.11). Random. A reading that none of the other components explains, spread evenly over the range: Each component is zero outside its interval. The model mixes them with weights that sum to one (Thrun, Burgard and Fox write them ; Eq. 6.13). Because one component is a point mass, the mixture has two parts. A reading below has the density which integrates to , and a reading of exactly has probability . The model assumes that each reading comes from a single ray. That suits a LIDAR’s narrow beam better than a sonar, whose echo can come from anywhere in a cone of about 15° (SensComp).The likelihood of a scan
The likelihood of beam is the mixture evaluated at its own reading and expected range, The model treats the beams as conditionally independent given the pose and the map, so the likelihood of a scan is the product over its beams (Table 6.1). A computer adds logarithms instead, since a product of hundreds of small numbers underflows: The beams are not really independent. Neighboring beams hit the same surface, and an error in the pose or the map moves many of their predictions together. The product counts that shared evidence many times over, which makes the likelihood overconfident. Implementations therefore use only some of the beams, or scale down the summed log likelihood.Model parameters from the datasheet
The datasheet supplies the range limits, the angular sampling and the scan rate. A calibration of the mounting supplies the sensor pose, and recorded scans supply the mixture weights and the noise parameters. The table maps each entry to its symbol, with the values of the TurtleBot3’s ROBOTIS LDS-01.
A ROS driver reports the range limits with each scan, as
range_min and range_max of the LaserScan message (sensor_msgs/LaserScan). REP 117 asks drivers to report a beam with no return as , an invalid reading as NaN and a reading too close to measure as . Before scoring a scan, map to , so that the max component scores it, and drop the NaN and readings. A beam with no return carries information: no surface within reflected the pulse along it.
The datasheet gives two error figures. Precision usually describes how much repeated readings of the same surface scatter. Accuracy also includes a systematic offset. is centered on the true range, so it models the scatter, and an offset is better removed by calibration. Neither figure is a standard deviation, since the datasheet quotes a bound and does not say how many standard deviations it covers. The code below reads the ±3.5% as two standard deviations, an illustrative choice that gives , or 3.5 cm at 2 m. That standard deviation grows with the expected range. Thrun’s has one for all ranges, so a LIDAR specified in percent calls for in its place. The fit at the end of this section estimates it from readings instead.
The code takes the datasheet values, derives , the bearings , the range limits and , and evaluates the mixture for expected ranges of 1 m and 3 m. The mixture weights are illustrative.
A simulated scan
The LIDAR section describes how readings go wrong. In the beam model, a return near the wall the map predicts is scored by the hit term, a return from a closer object such as a person or a chair by the short term, a beam with no return by the max term, and a reading in the valid range that none of these explains, from interference or multipath for example, by the random term. The code below simulates one scan of a 2D LIDAR with a 7 m range in a room that contains each case, and labels every reading with the case that produced it. It generates the readings from the geometry of the scene, not by sampling the mixture. A wall return gets 3 cm of noise, a return from the person gets none, 3% of the beams are replaced by random readings, and every beam through the glass window or onto the dark bin is forced to return nothing. Real glass can also reflect or pass the beam, and a dark surface only weakens the echo. The forced rule stands in for those cases.Estimating the parameters
The weights , the rate and the width of are estimated from readings whose expected ranges are known, . You get such data by recording scans at known poses in a room with a known map and ray casting each beam. Each is the same quantity as , with one index running over all the beams of all the training scans.In the terms of supervised learning, plays the role of the input and the reading the role of the target , since the model is a conditional distribution . Unlike a regression, nothing here learns to predict from : the hit term is already centered on . The fit learns only the shape of the error around that prediction, namely its width, the rate of early returns, and how often a beam returns nothing or a random range. In localization the roles change. The scan is observed, the filter computes for each candidate pose by ray casting, and scores how well that pose explains the scan.
learn_intrinsic_parameters (Thrun, Burgard and Fox, Section 6.3.2, Table 6.2).
The E-step computes, for every reading, the probability that each component produced it, its responsibility. A reading of exactly can only come from the max component, so its responsibility is 1. For a reading below ,
Table 6.2 as printed leaves the weights out of this normalization. With them, each step is an EM step and can only increase the likelihood.
The M-step treats the responsibilities as soft labels and sets each parameter to its weighted maximum-likelihood value. The weights are the average responsibilities, . Table 6.2 sets the width from the weighted squared residuals. Here grows with range, so the same update applies to the relative residuals:
This ignores the cut at and in , which is harmless when is a few centimeters. Table 6.2 sets , which is the maximum-likelihood rate of an exponential with no upper cut. Here the cut at matters, because a rate of 1/m spreads short readings over the whole interval. The code therefore maximizes the weighted log likelihood of the truncated exponential numerically.
The code below draws 20,000 readings from the model itself, with the parameters of the code above as the truth, at expected ranges between 0.5 m and 3.4 m. Because the true parameters are known, you can check that EM recovers them. EM starts far from them, with equal weights, and per meter.
References
- Thrun, S., Burgard, W., and Fox, D. (2005). Probabilistic Robotics. MIT Press. Section 6.3: the beam model (Eq. 6.11 to 6.13), the scan likelihood (Table 6.1) and the parameter learning (Table 6.2).
- ROBOTIS. LDS-01 specifications.
- Open Robotics. REP 117, Informational Distance Measurements.
Found an error on this page? Report an issue.

