Main Content

cvmeasmsc

Measurement based on constant velocity (CV) model in MSC frame

Description

measurement = cvmeasmsc(state) provides the angular measurement (azimuth and elevation) of the state in the sensor frame described by the state.

Tracking filters require a definition of the MeasurementFcn property. The cvmeasmsc function can be used as the MeasurementFcn. To use this MeasurementFcn with trackerGNN and trackerTOMHT, you can use the trackingMSCEKF filter.

example

measurement = cvmeasmsc(state,frame) provides the measurement in the frame specified. The allowed values for frame are 'rectangular' and 'spherical'.

measurement = cvmeasmsc(state,frame,laxes) specifies the axes of the sensor's coordinate system. The laxes input is a 3-by-3 matrix with each column specifying the direction of local x, y and z axes in the observer's Cartesian frame. The default for laxes is [1 0 0;0 1 0;0 0 1].

example

measurement = cvmeasmsc(state,measurementParameters) specifies the measurement parameters as a scalar struct or an array of struct.

example

[measurement,bounds] = cvmeasmsc(___) returns the measurement bounds, used by a tracking filter (trackingEKF, trackingUKF, trackingCKF,trackingIMM, trackingMSCEKF, or trackingGSF) in residual calculations.

Examples

collapse all

Using the cvmeasmsc function, you can obtain measurements of the state in the spherical and the rectangular frames.

Spherical Frame

Obtain the azimuth and elevation measurements from an MSC state.

mscState = [0.5;0;0.3;0;1e-3;1e-2];
cvmeasmsc(mscState)
ans = 2×1

   28.6479
   17.1887

Rectangular Frame

Obtain the position measurement from an MSC state. Specify the frame as a second input.

cvmeasmsc(mscState,'rectangular')
ans = 3×1

  838.3866
  458.0127
  295.5202

Alternatively, you can specify the frame using measurementParameters.

cvmeasmsc(mscState,struct('Frame','rectangular'))
ans = 3×1

  838.3866
  458.0127
  295.5202

Specify a 3-D state and specify a measurement structure such that the function outputs azimuth and elevation measurements.

state = [pi/2 .3 pi/6 0.1 1 0]'; % [az omega el elRate 1/r vr/r]
mp = struct("Frame","Spherical", ...
    "HasAzimuth",true, ...
    "HasElevation",true);

Output the measurement and wrapping bounds using the cvmeasmsc function.

[measure,bounds] = cvmeasmsc(state,mp)
measure = 2×1

    90
    30

bounds = 2×2

  -180   180
   -90    90

Input Arguments

collapse all

State that is defined relative to an observer in modified spherical coordinates, specified as a vector or a 2-D matrix. For example, if there is a constant velocity target state, xT, and a constant velocity observer state, xO, then the state is defined as xT - xO transformed in modified spherical coordinates.

The two-dimensional version of modified spherical coordinates (MSC) is also referred to as the modified polar coordinates (MPC). In the case of:

  • 2-D space –– State is equal to [az azRate 1/r vr/r].

  • 3-D space –– State is equal to [az omega el elRate 1/r vr/r].

The variables used in the convention are:

  • az –– Azimuth angle (rad)

  • el –– Elevation angle (rad)

  • azRate –– Azimuth rate (rad/s)

  • elRate –– Elevation rate (rad/s)

  • omega –– azRate × cos(el) (rad/s)

  • 1/r –– 1/range (1/m)

  • vr/r –– range-rate/range or inverse time-to-go (1/s)

If the input state is specified as a matrix, states must be concatenated along columns, where each column represents a state following the convention specified above. The output is a matrix with the same number of columns as the input, where each column represents the measurement from the corresponding state.

If the motion model is in 2-D space, values corresponding to elevation are assumed to be zero if elevation is requested as an output.

Data Types: single | double

Measurement frame, specified as 'spherical' or 'rectangular'. If using the 'rectangular' frame, the three elements present in the measurement represent x, y, and z position of the target in the observer's Cartesian frame. If using the 'spherical' frame, the two elements present in the measurement represent azimuth and elevation measurement of the target. If not specified, the function provides the measurements in 'spherical' frame.

Direction of local x, y, and z axes in the scenario, specified as a 3-by-3 matrix. If not specified, laxes is equal to [1 0 0;0 1 0;0 0 1].

Data Types: double

Measurement parameters, specified as a structure or an array of structures. The fields of the structure are:

FieldDescriptionExample
Frame

Frame used to report measurements, specified as one of these values:

  • 'Rectangular' — Detections are reported in rectangular coordinates.

  • 'Spherical' — Detections are reported in spherical coordinates.

Tip

In Simulink, when you create an object detection Bus, specify Frame as an enumeration object of fusionCoordinateFrameType.Rectangular or fusionCoordinateFrameType.Spherical because Simulink does not support variable-size variables such as a character vector.

'spherical'
OriginPositionPosition offset of the origin of the frame relative to the parent frame, specified as an [x y z] real-valued vector.[0 0 0]
OriginVelocityVelocity offset of the origin of the frame relative to the parent frame, specified as a [vx vy vz] real-valued vector.[0 0 0]
OrientationFrame rotation matrix, specified as a 3-by-3 real-valued orthonormal matrix.[1 0 0; 0 1 0; 0 0 1]
HasAzimuth

Logical scalar indicating if azimuth is included in the measurement.

This field is not relevant when the Frame field is 'Rectangular'.

1
HasElevationLogical scalar indicating if elevation information is included in the measurement. For measurements reported in a rectangular frame, and if HasElevation is false, the reported measurements assume 0 degrees of elevation.1
HasRange

Logical scalar indicating if range is included in the measurement.

This field is not relevant when the Frame is 'Rectangular'.

1
HasVelocityLogical scalar indicating if the reported detections include velocity measurements. For a measurement reported in the rectangular frame, if HasVelocity is false, the measurements are reported as [x y z]. If HasVelocity is true, the measurement is reported as [x y z vx vy vz]. For a measurement reported in the spherical frame, if HasVelocity is true, the measurement contains range-rate information.1
IsParentToChildLogical scalar indicating if Orientation performs a frame rotation from the parent coordinate frame to the child coordinate frame. When IsParentToChild is false, then Orientation performs a frame rotation from the child coordinate frame to the parent coordinate frame.0

If you only want to perform one coordinate transformation, such as a transformation from the body frame to the sensor frame, you only need to specify a measurement parameter structure. If you want to perform multiple coordinate transformations, you need to specify an array of measurement parameter structures. To learn how to perform multiple transformations, see the Convert Detections to objectDetection Format example.

Data Types: struct

Output Arguments

collapse all

Target measurement in MSC frame, returned as a:

  • One-element vector –– When HasElevation is set to false, the vector contains azimuth as the only measurement.

  • Two-element vector –– When the frame is set to 'spherical', the function measures the azimuth and elevation measurements from an MSC state.

  • Three-element vector –– When the frame is set to 'rectangular', the function measures the position measurement from an MSC state.

Measurement residual wrapping bounds, returned as an M-by-2 real-valued matrix, where M is the dimension of the measurement. Each row of the matrix corresponds to the lower and upper bounds for the specific dimension in the measurement output.

The function returns different bound values based on the frame input.

  • If the frame input is specified as 'Rectangular', each row of the matrix is [-Inf Inf], indicating the filter does not wrap the measurement residual in the filter.

  • If the frame input is specified as 'Spherical', the returned bounds contains at least one row of the azimuth bounds as [-180 180], indicating the filter wraps the azimuth residual in the range of [-180 180] in degrees. Optionally, when HasElevation = true, the matrix includes a second row of [-90 90], indicating the filter wraps the elevation residual in the range of [-90 90] in degrees.

The filter wraps the measurement residuals based on this equation:

xwrap=mod(xab2,ba)+ab2

where x is the residual to wrap, a is the lower bound, b is the upper bound, mod is the modules after division function, and xwrap is the wrapped residual.

Data Types: single | double

Extended Capabilities

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

Version History

Introduced in R2018b