removeLandmark
Description
removeLandmark(
removes the landmarks at the specified indices slamObj
,landmarkIndex
)landmarkIndex
from the
state vector, along with associated covariances from the state covariance matrix.
Examples
Remove Landmark from ekfSLAM
Object
Specify the initial vehicle state.
initialState = [1; -2; 0.1];
Specify the initial landmark positions.
landmarkPosition = [15.8495; -12.9496; 25.2455; -15.4705; 37.5880; 3.1023; 16.5690; 2.7466];
Specify the initial vehicle state covariance.
initialStateCovar = diag([0.1*ones(1,3) 1.1*ones(1,8)]);
Create an ekfSLAM
object with initial state and initial state covariance.
ekfSlamObj = ekfSLAM('State',[initialState; landmarkPosition], ... 'StateCovariance',initialStateCovar); landmarkInfo(ekfSlamObj)
ans=4×3 table
landmark number landmark state index landmark position
_______________ ____________________ _________________
1 4 5 15.85 -12.95
2 6 7 25.245 -15.47
3 8 9 37.588 3.1023
4 10 11 16.569 2.7466
Create a deep copy of the ekfSLAM
object.
newEkfSlamObj = copy(ekfSlamObj);
Specify the landmark number to be removed.
removeLandmark(newEkfSlamObj,3); landmarkInfo(newEkfSlamObj)
ans=3×3 table
landmark number landmark state index landmark position
_______________ ____________________ _________________
1 4 5 15.85 -12.95
2 6 7 25.245 -15.47
3 8 9 16.569 2.7466
Input Arguments
slamObj
— EKF SLAM object
ekfSLAM
object
EKF SLAM object, specified as an ekfSLAM
object.
landmarkIndex
— Indices of landmarks to remove
N-element column vector | N-by-2 matrix
Indices of the landmarks to remove, specified as an N-element column vector of landmark numbers in the state vector or an N-by-2 matrix of the exact positions of landmarks in the state vector. N is the number of landmarks to remove.
Data Types: single
| double
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2021b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)