What is the essential difference between "trackingEKF" and "initctekf" functions? How to choose?

2 views (last 30 days)
I have these two functions when I use "Sensor Fusion and Tracking Toolbox" or "Automated Driving Toolbox", but sometimes I don't know which function is better to use. It is easy to confuse. For example, why is the result different in the following example?
detection = objectDetection(0,[-250;-40;0],'MeasurementNoise',2.0*eye(3), ...
'SensorIndex',1,'ObjectClassID',1,'ObjectAttributes',{'Car',2});
filter = initctekf(detection)
filter =
trackingEKF with properties:
State: [7×1 double]
StateCovariance: [7×7 double]
StateTransitionFcn: @constturn
StateTransitionJacobianFcn: @constturnjac
ProcessNoise: [4×4 double]
HasAdditiveProcessNoise: 0
MeasurementFcn: @ctmeas
MeasurementJacobianFcn: @ctmeasjac
MeasurementNoise: [3×3 double]
HasAdditiveMeasurementNoise: 1
Why is the "state" dimension 7 and what do they mean?
Another "equivalent" is: ?
EKF = trackingEKF(@constturn,@ctmeas,[-250;-40;0], ... % [sx,sy,sz] ?
'MeasurementNoise',2.0*eye(3),...
'StateTransitionJacobianFcn',@constveljac, ...
'MeasurementJacobianFcn',@cvmeasjac)
EKF =
trackingEKF with properties:
State: [3×1 double]
StateCovariance: [3×3 double]
StateTransitionFcn: @constturn
StateTransitionJacobianFcn: @constveljac
ProcessNoise: [3×3 double]
HasAdditiveProcessNoise: 1
MeasurementFcn: @ctmeas
MeasurementJacobianFcn: @cvmeasjac
MeasurementNoise: [3×3 double]
HasAdditiveMeasurementNoise: 1
Another question is why the dimensions of the parameters obtained by the two ways of writing are different? It is not easy to find the answer description from the help document

Accepted Answer

Elad Kivelevitch
Elad Kivelevitch on 22 Sep 2020
Hi,
There are many functions that are shared between the Sensor Fusion and Tracking Toolbox and the Automated Driving Toolbox. They include, as you noted correctly, the trackingEKF (with trackingKF and trackingUKF), the motion and measurement models and their Jacobians (of which, constturn is one exampe), and their respective initiailization functions (initctekf is one example). We also share the definitions of objectDetection and objectTrack.
The idea here was that you could move easily between the two toolboxes and integrate your work.
To be clear: there is no difference between the two toolboxes when it comes to these functions.
As for your question:
The initctekf function takes a detection that contains measurement, measurement noise, and measurement parameters and uses it to initialize a tracking filter. You used initctekf, which creates a trackingEKF filter with constant-turn motion model and definition of state that corresponds to that. In your example, the objectDetection has a measurement at [-250;-40;0] which corresponds to the position of the target. The filter has the state definition:
[x;vx;y;vy;omega;z;vz] - so the positions at x,y, and z are converted to the elements 1, 3, and 6 in the state vector. The veolocity components are all unmeasured and assumed to be zero and the angular rate (omega) is also not measured and is assumed to be zero.
In the second code you wrote, you tried to initialize the trackingEKF yourself and passed [-250;-40;0] as a state. So, that becomes the entire state. You ended up with a state that is inconsistent with the defnition of state transition function or measurement function and that would error out the moment you would start to predict or correct the filter.
As for documentation: I would recomment you do:
help initctekf
and it will show the definition of state as I explained above.
If you want to dig deeper into how the filter is being initialized, I recommend doing:
edit initctekf
The function contains a lot of comments to explain the steps to follow in initializing a filter and how to convert measurements into a full state definition.
Elad
  2 Comments
cui,xingxing
cui,xingxing on 23 Sep 2020
Thank you for your answer, I found the explanation of each state value in the state from here, but there is no explanation in the "trackingEKF", "initctekf" help documentation files.
In addition, similar functions are also found in other toolboxes, such as "configureKalmanFilter". The principles should be the same, except for different API interfaces. I think these redundant functions are easy to get lost.
Elad Kivelevitch
Elad Kivelevitch on 23 Sep 2020
They are not redundant.
All the trackingXYZ filters are filters. They can be used with any motion model including the ones that customers write. Therefore, the filters themselves have no definition of state, they get that definition from the user choice of state transition model.
All the initMMXYZ functions are filter initialization functions, to be used with the trackers that are shipped in Automated Driving Toolbox (multiObjectTracker) and Sensor Fusion and Tracking (trackerGNN, trackerJPDA, trackerTOMHT). All the functions configure a filter (from the above) with a specific motion model.
The configureKalmanFilter function that ships with Computer Vision Toolbox configures a very specific filter (vision.KalmanFilter), which is incompatible with the trackers in ADT and SFTT mentioned above.
Thus, each feature has its own place.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!