Hello, I am fusing radar and mono-camera data together in a Kalman Filter as part of a tracking algorithm and I am using the sensor input dataset from the MatLab demo “Forward Collision Warning Using Sensor Fusion” which is in a cartesian coordinate frame.
In an extended KF when I use 'trackingEKF' I can call up a bespoke measurement function which switches depending on whether the sensor ID is radar or camera since the filter options accept function handles (refer below showing the 'trackingEKF' calling the bespoke measurement function 'cvmeas2FFullState'), and it runs fine.
filter = trackingEKF('State', H1 * ste, ...
'StateCovariance', steCov, ...
'MeasurementNoise', detectionClusters.MeasurementNoise(1:4,1:4), ...
'StateTransitionFcn', @constvel2d, ...
'MeasurementFcn', @cvmeas2DFullState, ...
'StateTransitionJacobianFcn', @constvel2djac, ...
'MeasurementJacobianFcn', @cvmeas2DFullStateJac,...
'ProcessNoise', Q);
% Measurement function:
function meas = cvmeas2DFullState(state, sensorID, varargin)
switch sensorID
case 1
H = [1 0 0 0; 0 0 1 0; 0 1 0 0; 0 0 0 0];
meas = H*state(:);
case 2
H = [1 0 0 0; 0 0 1 0; 0 1 0 0; 0 0 0 1];
meas = H*state(:);
end
end
However, if I use a linear Kalman Filter 'trackingKF' with the filter option 'MotionModel', 'Custom', then the 'MeasurementModel' doesn't accept function handles and I am not able to call the same bespoke measurement function with the sensor-dependent switching - is there any way I can generate the switching measurement model as in the 'trackingEKF' ?
Also, if I use an extended Kalman Filter (trackerEKF) with linear dynamic model and linear sensor model, both in cartesian coordinate frame (as in MatLab demo “Forward Collision Warning Using Sensor Fusion”), where the raw radar and camera data is provided in cartesian frame, would this be expected to perform as a linear Kalman Filter ?