Simulate range-bearing sensor readings
System object™ is a range-bearing sensor that is capable of outputting range and angle
measurements based on the given sensor pose and occupancy map. The range-bearing readings are
based on the obstacles in the occupancy map.
To simulate a range-bearing sensor using this object:
rangeSensorobject 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?
rbsensor = rangeSensor
rangeSensor System object,
rbsensor. The sensor is
capable of outputting range and angle measurements based on the sensor pose and an
sets properties for the sensor using one or more name-value pairs. Unspecified properties
have default values. Enclose each property name in quotes.
rbsensor = rangeSensor(
Unless otherwise indicated, properties are nontunable, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
release function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects.
Range — Minimum and maximum detectable range
[0 20] (default) | 1-by-2 positive real-valued vector
The minimum and maximum detectable range, specified as a 1-by-2 positive real-valued vector. Units are in meters.
HorizontalAngle — Minimum and maximum horizontal detection angle
[-pi pi] (default) | 1-by-2 real-valued vector
Minimum and maximum horizontal detection angle, specified as a 1-by-2 real-valued vector. Units are in radians.
HorizontalAngleResolution — Resolution of horizontal angle readings
0.0244 (default) | positive scalar
Resolution of horizontal angle readings, specified as a positive scalar. The resolution defines the angular interval between two consecutive sensor readings. Units are in radians.
RangeNoise — Standard deviation of range noise
0 (default) | positive scalar
The standard deviation of range noise, specified as a positive scalar. The range noise is modeled as a zero-mean white noise process with the specified standard deviation. Units are in meters.
HorizontalAngleNoise — Standard deviation of horizontal angle noise
0 (default) | positive scalar
The standard deviation of horizontal angle noise, specified as a positive scalar. The range noise is modeled as a zero-mean white noise process with the specified standard deviation. Units are in radians.
NumReadings — Number of output readings
258 (default) | positive integer
This property is read-only.
Number of output readings for each pose of the sensor, specified as a positive
integer. This property depends on the
pose — Pose of sensor in map
N-by-3 real-valued matrix
Poses of the sensor in the 2-D map, specified as an N-by-3 real-valued matrix, where N is the number of poses to simulate the sensor. Each row of the matrix corresponds to a pose of the sensor in the order of [x, y, θ]. x and y represent the position of the sensor in the map frame. The units of x and y are in meters. θ is the heading angle of the sensor with respect to the positive x-direction of the map frame. The units of θ are in radians.
map — Ground-truth map
occupancyMap object |
Ground-truth map, specified as an
occupancyMap (Navigation Toolbox) or a
binaryOccupancyMap (Navigation Toolbox) object. For the
occupancyMap input, the range-bearing sensor considers a cell as
occupied and returns a range reading if the occupancy probability of the cell is
greater than the value specified by the
OccupiedThreshold (Navigation Toolbox) property of the occupancy map.
ranges — Range readings
R-by-N real-valued matrix
Range readings, specified as an R-by-N
real-valued matrix. N is the number of poses for which the sensor
is simulated, and R is the number of sensor readings per pose of
the sensor. R is same as the value of the
angles — Angle readings
R-by-1 real-valued vector
Angle readings, specified as an R-by-1 real-valued vector.
R is the number of sensor readings per pose of the sensor.
R is same as the value of the
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
Obtain Range and Bearing Readings
Create a range-bearing sensor.
rbsensor = rangeSensor;
Specify the pose of the sensor and the ground-truth map.
truePose = [0 0 pi/4]; trueMap = binaryOccupancyMap(eye(10));
Generate the sensor readings.
[ranges, angles] = rbsensor(truePose, trueMap);
Visualize the results using
scan = lidarScan(ranges, angles); figure plot(scan)
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).
Introduced in R2020b
occupancyMap (Navigation Toolbox) |
binaryOccupancyMap (Navigation Toolbox) |