cameas

Measurement function for constant-acceleration motion

Description

example

measurement = cameas(state) returns the measurement, for the constant-acceleration Kalman filter motion model in rectangular coordinates. The state argument specifies the current state of the filter.

example

measurement = cameas(state,frame) also specifies the measurement coordinate system, frame.

example

measurement = cameas(state,frame,sensorpos) also specifies the sensor position, sensorpos.

measurement = cameas(state,frame,sensorpos,sensorvel) also specifies the sensor velocity, sensorvel.

measurement = cameas(state,frame,sensorpos,sensorvel,laxes) also specifies the local sensor axes orientation, laxes.

example

measurement = cameas(state,measurementParameters) specifies the measurement parameters, measurementParameters.

Examples

collapse all

Define the state of an object in 2-D constant-acceleration motion. The state is the position, velocity, and acceleration in both dimensions. The measurements are in rectangular coordinates.

state = [1,10,3,2,20,0.5].';
measurement = cameas(state)
measurement = 3×1

     1
     2
     0

The measurement is returned in three-dimensions with the z-component set to zero.

Define the state of an object in 2-D constant-acceleration motion. The state is the position, velocity, and acceleration in both dimensions. The measurements are in spherical coordinates.

state = [1,10,3,2,20,5].';
measurement = cameas(state,'spherical')
measurement = 4×1

   63.4349
         0
    2.2361
   22.3607

The elevation of the measurement is zero and the range rate is positive. These results indicate that the object is moving away from the sensor.

Define the state of an object moving in 2-D constant-acceleration motion. The state consists of position, velocity, and acceleration in each dimension. The measurements are in spherical coordinates with respect to a frame located at (20;40;0) meters from the origin.

state = [1,10,3,2,20,5].';
measurement = cameas(state,'spherical',[20;40;0])
measurement = 4×1

 -116.5651
         0
   42.4853
  -22.3607

The elevation of the measurement is zero and the range rate is negative indicating that the object is moving toward the sensor.

Define the state of an object moving in 2-D constant-acceleration motion. The state consists of position, velocity, and acceleration in each dimension. The measurements are in spherical coordinates with respect to a frame located at (20;40;0) meters from the origin.

state2d = [1,10,3,2,20,5].';

The elevation of the measurement is zero and the range rate is negative indicating that the object is moving toward the sensor.

frame = 'spherical';
sensorpos = [20;40;0];
sensorvel = [0;5;0];
laxes = eye(3);
measurement = cameas(state2d,'spherical',sensorpos,sensorvel,laxes)
measurement = 4×1

 -116.5651
         0
   42.4853
  -17.8885

The elevation of the measurement is zero and the range rate is negative. These results indicate that the object is moving toward the sensor.

Put the measurement parameters in a structure and use the alternative syntax.

measparm = struct('Frame',frame,'OriginPosition',sensorpos,'OriginVelocity',sensorvel, ...
    'Orientation',laxes);
measurement = cameas(state2d,measparm)
measurement = 4×1

 -116.5651
         0
   42.4853
  -17.8885

Input Arguments

collapse all

Kalman filter state vector for constant-acceleration motion, specified as a real-valued 3N-element vector. N is the number of spatial degrees of freedom of motion. For each spatial degree of motion, the state vector takes the form shown in this table.

Spatial DimensionsState Vector Structure
1-D[x;vx;ax]
2-D[x;vx;ax;y;vy;ay]
3-D[x;vx;ax;y;vy;ay;z;vz;az]

For example, x represents the x-coordinate, vx represents the velocity in the x-direction, and ax represents the acceleration in the x-direction. If the motion model is in one-dimensional space, the y- and z-axes are assumed to be zero. If the motion model is in two-dimensional space, values along the z-axis are assumed to be zero. Position coordinates are in meters. Velocity coordinates are in meters/second. Acceleration coordinates are in meters/second2.

Example: [5;0.1;0.01;0;-0.2;-0.01;-3;0.05;0]

Data Types: double

Measurement output frame, specified as 'rectangular' or 'spherical'. When the frame is 'rectangular', a measurement consists of x, y, and z Cartesian coordinates. When specified as 'spherical', a measurement consists of azimuth, elevation, range, and range rate.

Data Types: char

Sensor position with respect to the navigation frame, specified as a real-valued 3-by-1 column vector. Units are in meters.

Data Types: double

Sensor velocity with respect to the navigation frame, specified as a real-valued 3-by-1 column vector. Units are in m/s.

Data Types: double

Local sensor coordinate axes, specified as a 3-by-3 orthogonal matrix. Each column specifies the direction of the local x-, y-, and z-axes, respectively, with respect to the navigation frame. That is, the matrix is the rotation matrix from the global frame to the sensor frame.

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.

'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]
HasAzimuthLogical scalar indicating if azimuth is included in the measurement.1
HasElevationLogical scalar indicating if elevation 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
HasRangeLogical scalar indicating if range is included in the measurement.1
HasVelocityLogical scalar indicating if the reported detections include velocity measurements. For measurements reported in the rectangular frame, if HasVelocity is false, the measurements are reported as [x y z]. If HasVelocity is true, measurements are reported as [x y z vx vy vz].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

Data Types: struct

Output Arguments

collapse all

Measurement vector, returned as an N-by-1 column vector. The form of the measurement depends upon which syntax you use.

  • When the syntax does not use the measurementParameters argument, the measurement vector is [x,y,z] when the frame input argument is set to 'rectangular' and [az;el;r;rr] when the frame is set to 'spherical'.

  • When the syntax uses the measurementParameters argument, the size of the measurement vector depends on the values of the frame, HasVelocity, and HasElevation fields in the measurementParameters structure.

    framemeasurement
    'spherical'

    Specifies the azimuth angle, az, elevation angle, el, range, r, and range rate, rr, of the object with respect to the local ego vehicle coordinate system. Positive values for range rate indicate that an object is moving away from the sensor.

    Spherical measurements

      HasElevation
      falsetrue
    HasVelocityfalse[az;r][az;el;r]
    true[az;r;rr][az;el;r;rr]

    Angle units are in degrees, range units are in meters, and range rate units are in m/s.

    'rectangular

    Specifies the Cartesian position and velocity coordinates of the tracked object with respect to the ego vehicle coordinate system.

    Rectangular measurements

    HasVelocityfalse[x;y;y]
    true[x;y;z;vx;vy;vz]

    Position units are in meters and velocity units are in m/s.

Data Types: double

More About

collapse all

Azimuth and Elevation Angle Definitions

Define the azimuth and elevation angles used in Automated Driving Toolbox™.

The azimuth angle of a vector is the angle between the x-axis and its orthogonal projection onto the xy plane. The angle is positive in going from the x axis toward the y axis. Azimuth angles lie between –180 and 180 degrees. The elevation angle is the angle between the vector and its orthogonal projection onto the xy-plane. The angle is positive when going toward the positive z-axis from the xy plane.

Extended Capabilities

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

Introduced in R2017a