getTrackVelocities
Obtain updated track velocities and velocity covariance matrix
Syntax
Description
returns a matrix of track velocities based on tracks and the model name.velocities
= getTrackVelocities(tracks
,modelName
)
returns a matrix of track velocities based on tracks and the velocity
selector.velocities
= getTrackVelocities(tracks
,velocitySelector
)
[
also returns the track velocity covariance matrices.velocities
,velocityCovariances
]
= getTrackVelocities(tracks
,velocitySelector
)
Examples
Create an extended Kalman filter tracker for 3-D constant-acceleration motion.
tracker = trackerGNN("FilterInitializationFcn",@initcaekf);
Initialize the tracker with one detection.
detection = objectDetection(0,[10;-20;4],"ObjectClassID",3);
tracks = tracker(detection,0);
Add a second detection at a later time and at a different position.
detection = objectDetection(0.1,[10.3;-20.2;4],"ObjectClassID",3);
tracks = tracker(detection,0.2);
Obtain the velocity vector from the track state using the model name.
velocity1 = getTrackVelocities(tracks,"constacc")
velocity1 = 1×3
1.0093 -0.6728 0
Obtain the velocity vector from the track state using the position selector.
velocitySelector = [0 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]; velocity2 = getTrackVelocities(tracks,velocitySelector)
velocity2 = 1×3
1.0093 -0.6728 0
Create an extended Kalman filter tracker for 3-D constant-acceleration motion.
tracker = trackerGNN("FilterInitializationFcn",@initcaekf);
Initialize the tracker with one detection.
detection = objectDetection(0,[10;-20;4],"ObjectClassID",3);
tracks = tracker(detection,0);
Add a second detection at a later time and at a different position.
detection = objectDetection(0.1,[10.3;-20.2;4.3],"ObjectClassID",3);
tracks = tracker(detection,0.2);
Obtain the velocity vector and covariance from the track state using the model name.
[velocity1,velocityCovariance1] = getTrackVelocities(tracks,"constacc")
velocity1 = 1×3
1.0093 -0.6728 1.0093
velocityCovariance1 = 3×3
70.0685 0 0
0 70.0685 0
0 0 70.0685
Obtain the velocity vector and covariance from the track state using the velocity selector.
velocitySelector = [0 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]; [velocity2,velocityCovariance2] = getTrackVelocities(tracks,velocitySelector)
velocity2 = 1×3
1.0093 -0.6728 1.0093
velocityCovariance2 = 3×3
70.0685 0 0
0 70.0685 0
0 0 70.0685
Input Arguments
Object tracks, specified as an array of objectTrack
objects or an
array of structures containing sufficient information to obtain the track
velocity 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,
velocities
and
velocityCovariances
are returned based on
the second argument (velocitySelector
or
modelName
) as follows.
Second input argument | velocities | velocityCovariances |
---|---|---|
velocitySelector |
|
|
modelName |
|
|
Motion model name, specified as one of these options:
"constvel"
— The function obtains the velocity states based on the state definition in theconstvel
function."constacc"
— The function obtains the velocity states based on the state definition in theconstacc
function."constturn"
— The function obtains the velocity states based on the state definition in theconstturn
function.In R2024b:
"ctrv"
— The function obtains the velocity states based on the state definition in thectrv
function."singer"
— The function obtains the velocity states based on the state definition in thesinger
function. The use ofsinger
model requires the Sensor Fusion and Tracking Toolbox™.
Velocity 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 velocities from the state vector. Multiply the state vector by velocity selector matrix returns velocities. The same selector is applied to all object tracks.
Output Arguments
Velocities of tracked objects at last update time, returned as a 1-by-D vector or a real-valued M-by-D matrix. D represents the number of velocity elements. M represents the number of tracks.
Velocity covariance matrices of tracked objects, returned as a real-valued D-by-D-matrix or a real-valued D-by-D-by-M array. D represents the number of velocity elements. M represents the number of tracks. Each D-by-D submatrix is a velocity covariance matrix for a track.
More About
Show the velocity selection matrix for two-dimensional motion when the state consists of the position and velocity.
Show the velocity selection matrix for three-dimensional motion when the state consists of the position and velocity.
Show the velocity 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 velocities = zeros(0,3,"single"); velocitiesCovariances = zeros(3,3,0,"single"); else [velocities,velocityCovariances] = getTrackVelocities(tracks,"constvel"); end
Version History
Introduced in R2018bYou can now obtain velocities and associated covariances of tracks by specifying the motion model name as an input. For example,
[positions,covariances] = getTrackVelocities(tracks,"constvel")
constvel
function.See Also
Functions
Objects
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)