Main Content

cvmeasmsc

Measurement function for constant turn-velocity motion 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.

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

example

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].

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.

example

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

Frame to report measurements, specified as "rectangular" or "spherical". When you specify frame as "rectangular", a measurement consists of x, y, and z Cartesian coordinates. When you specify frame as 'spherical', a measurement consists of 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. This table lists the fields in the structure.

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 variables such as a character vector that can vary in size.

'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 want to perform only one coordinate transformation, such as a transformation from the body frame to the sensor frame, you must specify a measurement parameter structure. If you want to perform multiple coordinate transformations, you must 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:

  • Scalar –– When HasElevation is set to false, the vector contains only the azimuth measurement, with the unit in degrees.

  • Two-element vector –– When the frame is set to "spherical", the function returns the azimuth and elevation measurements from an MSC state, with the units in degrees.

  • Three-element vector –– When the frame is set to "rectangular", the function returns the position measurements from an MSC state, with the units in meters.

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, respectively, of each measurement in the measurement output.

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

  • If you specify frame as "Rectangular", each row of the matrix is [-Inf Inf], indicating that the filter did not wrap the measurement residual.

  • If you specify frame as "Spherical", the returned bounds contains at least one row of the azimuth bounds as [-180 180], indicating that the filter wrapped 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 that the filter wrapped 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