Localize robot using range sensor data and map
The monteCarloLocalization
System object™ creates a Monte Carlo localization (MCL) object. The MCL algorithm is used
to estimate the position and orientation of a vehicle in its environment using a known
map of the environment, lidar scan data, and odometry sensor data.
To localize the vehicle, the MCL algorithm uses a particle filter to estimate the vehicle’s position. The particles represent the distribution of likely states for the vehicle, where each particle represents a possible vehicle state. The particles converge around a single location as the vehicle moves in the environment and senses different parts of the environment using a range sensor. An odometry sensor measures the vehicle’s motion.
A monteCarloLocalization
object takes the pose and lidar scan data
as inputs. The input lidar scan sensor data is given in its own coordinate frame, and
the algorithm transforms the data according to the
SensorModel.SensorPose
property that you must specify. The input
pose is computed by integrating the odometry sensor data over time. If the change in
pose is greater than any of the specified update thresholds,
UpdateThresholds
, then the particles are updated and the
algorithm computes a new state estimate from the particle filter. The particles are
updated using this process:
The particles are propagated based on the change in the pose and the specified
motion model, MotionModel
.
The particles are assigned weights based on the likelihood of receiving the
range sensor reading for each particle. These likelihood weights are based on
the sensor model you specify in SensorModel
.
Based on the ResamplingInterval
property, the particles are
resampled from the posterior distribution, and the particles of low weight are
eliminated. For example, a resampling interval of 2 means that the particles are
resampled after every other update.
The outputs of the object are the estimated pose and covariance, and the value of
isUpdated
. This estimated state is the mean and covariance of the
highest weighted cluster of particles. The output pose is given in the map’s coordinate
frame that is specified in the SensorModel.Map
property. If the
change in pose is greater than any of the update thresholds, then the state estimate has
been updated and isUpdated
is true
. Otherwise,
isUpdated
is false
and the estimate remains
the same. For continuous tracking the best estimate of a robot's
state, repeat this process of propagating particles, evaluating their likelihood, and
resampling.
To estimate robot pose and covariance using lidar scan data:
Create the monteCarloLocalization
object and set its properties.
Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?.
returns an MCL object that estimates the pose of a vehicle using a map, a
range sensor, and odometry data. By default, an empty map is assigned, so a
valid map assignment is required before using the object.mcl
= monteCarloLocalization
creates an MCL object with additional options specified by one or more
mcl
= monteCarloLocalization(Name,Value
)Name,Value
pair arguments.
Name
is a property name and Value
is
the corresponding value. Name
must appear inside single
quotes (''
). You can specify several name-value pair
arguments in any order as
Name1,Value1,...,NameN,ValueN
.
[
estimates the pose and covariance of a vehicle using the MCL algorithm. The
estimates are based on the pose calculated from the specified vehicle
odometry, isUpdated
,pose
,covariance
]
= mcl(odomPose
,scan
)odomPose
, and the specified lidar scan sensor
data, scan
. mcl
is the monteCarloLocalization
object.
isUpdated
indicates whether the estimate is updated
based on the UpdateThreshold
property.
To enable this syntax, you must set the UseLidarScan
property to true
. For example:
mcl = monteCarloLocalization('UseLidarScan',true); ... [isUpdated,pose,covariance] = mcl(odomPose,scan);
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)
[1] Thrun, Sebatian, Wolfram Burgard, and Dieter Fox. Probabilistic Robotics. MIT Press, 2005.
[2] Dellaert, F., D. Fox, W. Burgard, and S. Thrun. "Monte Carlo Localization for Mobile Robots." Proceedings 1999 IEEE International Conference on Robotics and Automation.
lidarScan
| likelihoodFieldSensorModel
| odometryMotionModel