Main Content


Retrieve landmark information

Since R2021b



    Info = landmarkInfo(slamObj)retrieves landmark information from the ekfSLAM object as a table that contains each landmark number along with its position and state index.

    Info = landmarkInfo(slamObj,landmarkIndex) retrieves landmark information for only those landmarks specified by landmarkIndex.


    collapse all

    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], ...
    ekfSlamObj = 
      ekfSLAM with properties:
                     State: [11⨯1 double]            
           StateCovariance: [11⨯11 double]           
            MaxNumLandmark: Inf                      
        StateTransitionFcn: [1⨯1 function_handle]    
              ProcessNoise: [2⨯2 double]             
               MeasurementFcn: [1⨯1 function_handle]    
        InverseMeasurementFcn: [1⨯1 function_handle]    
         DataAssociationFcn: [1⨯1 function_handle]    
        MaxAssociationRange: Inf                      

    Get the information for all the landmarks.

    info = landmarkInfo(ekfSlamObj)
    info=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 

    Input Arguments

    collapse all

    EKF SLAM object, specified as an ekfSLAM object.

    Indices of landmarks for which to retrieve information, specified as an N-element column vector of landmark numbers in the state vector or an N-by-2 matrix of exact positions of landmarks in the state vector. N is the number of landmarks.

    Data Types: single | double

    Output Arguments

    collapse all

    Landmark information, returned as a table.

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Version History

    Introduced in R2021b

    See Also