getTrackPositions
Syntax
Description
returns a matrix of track positions based on tracks and the position
selector.positions
= getTrackPositions(tracks
,positionSelector
)
[
also returns the track position covariance matrices.positions
,positionCovariances
]
= getTrackPositions(___)
Examples
Create an extended Kalman filter tracker for 3-D constant-acceleration motion.
tracker = radarTracker('FilterInitializationFcn',@initcaekf);
Update the tracker with a single detection and get the tracks output.
detection = objectDetection(0,[10;-20;4],'ObjectClassID',3);
tracks = tracker(detection,0)
tracks = objectTrack with properties: TrackID: 1 BranchID: 0 SourceIndex: 0 UpdateTime: 0 Age: 1 State: [9×1 double] StateCovariance: [9×9 double] StateParameters: [1×1 struct] ObjectClassID: 3 ObjectClassProbabilities: 1 TrackLogic: 'History' TrackLogicState: [1 0 0 0 0] IsConfirmed: 1 IsCoasted: 0 IsSelfReported: 1 ObjectAttributes: [1×1 struct]
Obtain the position vector from the track state using the model name.
position1 = getTrackPositions(tracks,"constacc")
position1 = 1×3
10 -20 4
Obtain the position vector from the track state using the position selector.
positionSelector = [1 0 0 0 0 0 0 0 0; 0 0 0 1 0 0 0 0 0; 0 0 0 0 0 0 1 0 0]; position2 = getTrackPositions(tracks,positionSelector)
position2 = 1×3
10 -20 4
Create an extended Kalman filter tracker for 3-D constant-velocity motion.
tracker = radarTracker("FilterInitializationFcn",@initcvekf);
Update the tracker with a single detection and get the tracks output.
detection = objectDetection(0,[10;3;-7],"ObjectClassID",3);
tracks = tracker(detection,0)
tracks = objectTrack with properties: TrackID: 1 BranchID: 0 SourceIndex: 0 UpdateTime: 0 Age: 1 State: [6×1 double] StateCovariance: [6×6 double] StateParameters: [1×1 struct] ObjectClassID: 3 ObjectClassProbabilities: 1 TrackLogic: 'History' TrackLogicState: [1 0 0 0 0] IsConfirmed: 1 IsCoasted: 0 IsSelfReported: 1 ObjectAttributes: [1×1 struct]
Obtain the position vector and position covariance for that track using the model name.
[position1,positionCovariance1] = getTrackPositions(tracks,"constvel")
position1 = 1×3
10 3 -7
positionCovariance1 = 3×3
1 0 0
0 1 0
0 0 1
Obtain the position vector and position covariance for that track using the position selector.
positionSelector = [1 0 0 0 0 0; 0 0 1 0 0 0; 0 0 0 0 1 0]; [position2,positionCovariance2] = getTrackPositions(tracks,positionSelector)
position2 = 1×3
10 3 -7
positionCovariance2 = 3×3
1 0 0
0 1 0
0 0 1
Input Arguments
Object tracks, specified as an array of objectTrack
objects or an
array of structures containing sufficient information to obtain the track
position information. At a minimum, these structures must contain a
State
column vector field and a positive-definite
StateCovariance
matrix field. For a sample
track structure, see toStruct
.
Note
If you specify tracks
as an empty objectTrack
object, an
empty cell, or an empty track structure,
positions
and
positionCovariances
are returned based on
the second argument (positionSelector
or
modelName
) as follows.
Second input argument | positions | positionCovariances |
---|---|---|
postionSelector |
|
|
modelName |
|
|
Motion model name, specified as one of these options:
"constvel"
— The function obtains the position states based on the state definition in theconstvel
function."constacc"
— The function obtains the position states based on the state definition in theconstacc
function."constturn"
— The function obtains the position states based on the state definition in theconstturn
function."singer"
— The function obtains the position states based on the state definition in thesinger
(Sensor Fusion and Tracking Toolbox) function. The use ofsinger
model requires the Sensor Fusion and Tracking Toolbox™.
Position selector, specified as a D-by-N real-valued matrix of ones and zeros. D is the number of dimensions of the tracker. N is the size of the state vector. Using this matrix, the function extracts track positions from the state vector. Multiply the state vector by position selector matrix returns positions. The same selector is applied to all object tracks.
Output Arguments
Positions of tracked objects at last update time, returned as a real-valued M-by-D matrix. D represents the number of position elements. M represents the number of tracks.
Position covariance matrices of tracked objects, returned as a real-valued D-by-D-M array. D represents the number of position elements. M represents the number of tracks. Each D-by-D submatrix is a position covariance matrix for a track.
More About
Show the position selection matrix for two-dimensional motion when the state consists of the position and velocity.
Show the position selection matrix for three-dimensional motion when the state consists of the position and velocity.
Show the position selection matrix for three-dimensional motion when the state consists of the position, velocity, and acceleration.
Extended Capabilities
In code generation, if you use the
modelName
input, thetracks
input must be specified as non-empty structures. Use the following if empty structures are unavoidable:if isempty(tracks) % Return the sizes and data types you desire positions = zeros(0,3,"single"); positonCovariances = zeros(3,3,0,"single"); else [positions,positionCovariances] = getTrackPositons(tracks,"constvel"); end
Version History
Introduced in R2021aYou can now obtain positions and associated covariances of tracks by specifying the motion model name as an input. For example,
[positions,covariances] = getTrackPositions(tracks,"constvel")
constvel
function.See Also
Functions
getTrackVelocities
|constvel
(Sensor Fusion and Tracking Toolbox) |constturn
(Sensor Fusion and Tracking Toolbox) |constacc
(Sensor Fusion and Tracking Toolbox) |ctrv
(Sensor Fusion and Tracking Toolbox) |singer
(Sensor Fusion and Tracking Toolbox)
Objects
radarTracker
|trackerPHD
(Sensor Fusion and Tracking Toolbox) |trackerJPDA
(Sensor Fusion and Tracking Toolbox) |objectTrack
(Sensor Fusion and Tracking Toolbox)
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)