main content

tracking with range-凯发k8网页登录

this example illustrates the use of particle filters and gaussian-sum filters to track a single object using range-only measurements.

introduction

sensors that can only observe range information cannot provide a complete understanding of the object's state from a single detection. in addition, the uncertainty of a range-only measurement, when represented in a cartesian coordinate frame, is non-gaussian and creates a concave shape. for range-only sensors with a narrow field of view (fov), the angular uncertainty is small and can be approximated by an ellipsoid, that is, a gaussian distribution. however, for range-only sensors with a wide fov, the uncertainty, when represented in a cartesian frame, is described by a concave ring shape, which cannot be easily approximated by an ellipsoid. this is illustrated in the image shown below.

this phenomenon is also observed with long-range radars, which provide both azimuth and range information. when the fov of each azimuth resolution cell spans a large region in space, the distribution of state becomes non-gaussian. techniques like long-range corrections are often employed to make use of gaussian filters like extended kalman filters (trackingekf) and unscented kalman filters (trackingukf) in those scenarios. this is demonstrated in detail in the multiplatform radar detection fusion example.

in this example, you will learn how to use a particle filter and a gaussian-sum filter to represent the non-gaussian uncertainty in state caused by range measurements from large fov sensors.

define scenario

the scenario models a single object traveling at a constant velocity in the x-y plane. the object crosses through the coverage areas of three equally spaced sensors, with fov of 60 degrees in azimuth. the sensors fov overlap, which enhances observability when the object crosses through the overlapping regions. each sensor reports range measurement with a measurement accuracy of 5 centimeters.

s = rng;
rng(2018);
[scene,theaterdisplay] = helpercreaterangeonlysensorscenario;
showscenario(theaterdisplay)

showgrabs(theaterdisplay,[]);

track using a particle filter

in this section, a particle filter, trackingpf is used to track the object. the tracking is performed by a single-hypothesis tracker using trackergnn. the tracker is responsible for maintaining the track while reducing the number of false alarms.

the function initrangeonlycvpf initializes a constant velocity particle filter. the function is similar to the initcvpf function, but limits the angles from [-180 180] in azimuth and [-90 90] in elevation for initcvpf to the known sensor fov in this problem.

% tracker
tracker = trackergnn('filterinitializationfcn',@initrangeonlycvpf,'maxnumtracks',5);
% update display to plot particle data
theaterdisplay.filtertype = 'trackingpf';
% advance scenario and track object
while advance(scene)
    % current time
    time = scene.simulationtime;
    % generate detections
    [detections, configs] = generaterangedetections(scene);
    % pass detections to tracker
    if ~isempty(detections)
        [conftracks,~,alltracks] = tracker(detections,time);
    elseif islocked(tracker)
        conftracks = predicttrackstotime(tracker,'confirmed',time);
    end
    % update display
    theaterdisplay(detections,configs,conftracks,tracker);
end

notice that the particles carry a non-gaussian uncertainty in state along the arc of range-only measurement till the target gets detected by the next sensor. as the target moves through the boundaries of the sensor coverage areas, the likelihood of particles at the boundary increases as compared to other particles. this increase in likelihood triggers a resampling step in the particle filter and the particles collapse to the true target location.

showgrabs(theaterdisplay,[1 2]);

using the particle filter, the tracker maintains the track for the duration of the scenario.

showgrabs(theaterdisplay,3);

track using a gaussian-sum filter

in this section, a gaussian-sum filter, trackinggsf, is used to track the object. for range-only measurements, you can initialize a trackinggsf using initapekf. the initapekf function initializes an angle-parameterized extended kalman filter. the function initrangeonlygsf defined in this example modifies the initapekf function to track slow moving objects.

% restart scene
restart(scene);
release(theaterdisplay);
% tracker
tracker = trackergnn('filterinitializationfcn',@initrangeonlygsf);
% update display to plot gaussian-sum components
theaterdisplay.filtertype = 'trackinggsf';
while advance(scene)
    % current time
    time = scene.simulationtime;
    % generate detections
    [detections, configs] = generaterangedetections(scene);
    % pass detections to tracker
    if ~isempty(detections)
        [conftracks,~,alltracks] = tracker(detections,time);
    elseif islocked(tracker)
        conftracks = predicttrackstotime(tracker,'confirmed',time);
    end
    % update display
    theaterdisplay(detections,configs,conftracks,tracker);
end

you can use the trackingfilters property of the trackinggsf to see the state of each extended kalman filter. represented by "individual filters" in the next figure, notice how the filters are aligned along the arc generated by range-only measurement until the target reaches the overlapping region. immediately after crossing the boundary, the likelihood of the filter at the boundary increases and the track converges to that individual filter. the weight, modelprobabilities, of other individual filters drop as compared to the one closest to the boundary, and their contribution to the estimation of state reduces.

showgrabs(theaterdisplay,[4 5]);

using the gaussian-sum filter, the tracker maintains the track during for the duration of the scenario.

showgrabs(theaterdisplay,6);
rng(s)

summary

in this example, you learned how to use a particle filter and a gaussian-sum filter to track an object using range-only measurements. both particle filters and gaussian-sum filters offer capabilities to track objects that follow a non-gaussian state distribution. while the gaussian-sum filter approximates the distribution by a weighted sum of gaussian-components, a particle filter represents this distribution by a set of samples. the particle filter offers a more natural approach to represent any arbitrary distribution as long as samples can be generated from it. however, to represent the distribution perfectly, a large number of particles may be required, which increases computational requirements of using the filter. as state is described by samples, a particle filter architecture allows using any process noise distribution as well as measurement noise. in contrast, the gaussian-sum filter uses a gaussian process and measurement noise for each component. one of the major shortcoming of particles is the problem of "sample impoverishment". after resampling, the particles may collapse to regions of high likelihood, not allowing the filter to recover from an "incorrect" association. as no resampling is performed in gaussian-sum filter and each state is gaussian, the gaussian-sum filters offers some capability to recover from such an association. however, this recovery is often dependent on the weights and covariances of each gaussian-component.

supporting functions

generaterangedetections this function generates range-only detection

function [detections,config] = generaterangedetections(scene)
detections = [];
config = [];
time = scene.simulationtime;
for i = 1:numel(scene.platforms)
    [thisdet, thisconfig] = detectonlyrange(scene.platforms{i},time);
    config = [config;thisconfig]; %#ok
    detections = [detections;thisdet]; %#ok
end
end

detectonlyrange this function remove az and el from a spherical detection

function [rangedetections,config] = detectonlyrange(observer,time)
    [fulldetections,numdetections,config] = detect(observer,time);
    for i = 1:numel(config)
        % populate the config correctly for plotting
        config(i).fieldofview = observer.sensors{i}.fieldofview;
        config(i).measurementparameters(1).originposition = observer.sensors{i}.mountinglocation(:);
        config(i).measurementparameters(1).orientation = rotmat(quaternion(observer.sensors{i}.mountingangles(:)','eulerd','zyx','frame'),'frame');
        config(i).measurementparameters(1).isparenttochild = true;
    end
    % remove all except range information
    rangedetections = fulldetections;
    for i = 1:numdetections
        rangedetections{i}.measurement = rangedetections{i}.measurement(end);
        rangedetections{i}.measurementnoise = rangedetections{i}.measurementnoise(end);
        rangedetections{i}.measurementparameters(1).hasazimuth = false;
        rangedetections{i}.measurementparameters(1).haselevation = false;
    end
end

initrangeonlygsf this function initializes an angle-parameterized gaussian-sum filter. it uses angle limits of [-30 30] to specify fov and sets the number of filters as 10. it also modifies the state covariance and process noise for slow moving object in 2-d.

function filter = initrangeonlygsf(detection)
filter = initapekf(detection,10,[-30 30]);
for i = 1:numel(filter.trackingfilters)
    filterk = filter.trackingfilters{i};
    filterk.processnoise = 0.01*eye(3);
    filterk.processnoise(3,3) = 0;
    % small covariance for slow moving targets
    filterk.statecovariance(2,2) = 0.1;
    filterk.statecovariance(4,4) = 0.1;
    % low standard deviation in z as v = 0;
    filterk.statecovariance(6,6) = 0.01;
end
end

initrangeonlycvpf this function initializes a constant velocity particle filter with particles limited to the fov of [-30 30].

function filter = initrangeonlycvpf(detection)
filter = initcvpf(detection);
% uniform az in fov
az = -pi/6   pi/3*rand(1,filter.numparticles);
% no elevation;
el = zeros(1,filter.numparticles);
% samples of range from gaussian range measurement
r = detection.measurement   sqrt(detection.measurementnoise)*randn(1,filter.numparticles);
% x,y,z in sensor frame
[x,y,z] = sph2cart(az,el,r);
% rotate from sensor to scenario frame.
sentoplat = detection.measurementparameters(1).orientation';
senposition = detection.measurementparameters(1).originposition;
plattoscenario = detection.measurementparameters(2).orientation';
platposition = detection.measurementparameters(2).originposition;
posplat = sentoplat*[x;y;z]   senposition;
posscen = plattoscenario*posplat   platposition;
% position particles
filter.particles(1,:) = posscen(1,:);
filter.particles(3,:) = posscen(2,:);
filter.particles(5,:) = posscen(3,:);
% velocity particles
% uniform distribution
filter.particles([2 4],:) = -1   2*rand(2,filter.numparticles);
% process noise is set to a low number for slow moving targets. larger than
% gsf to add more noise to particles preventing them from collapsing.
filter.processnoise = 0.1*eye(3);
% zero z-velocity
filter.particles(6,:) = 0;
filter.processnoise(3,3) = 0;
end
网站地图