Tracking¶
sies.tracking.kalman ¶
Extended Kalman Filter and target motion model.
The state vector is [vx, vy, x, y, phi]: velocity, position and
angular position of the target.
ExtendedKalmanFilter ¶
ExtendedKalmanFilter(state_matrix, process_cov, observation, observation_jacobian, observation_cov)
Extended Kalman Filter with a linear state equation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state_matrix
|
(ndarray, shape(d, d))
|
State transition matrix |
required |
process_cov
|
(ndarray, shape(d, d))
|
Process noise covariance |
required |
observation
|
callable
|
Observation function |
required |
observation_jacobian
|
callable
|
Jacobian |
required |
observation_cov
|
ndarray
|
Observation noise covariance |
required |
Source code in src/sies/tracking/kalman.py
127 128 129 130 131 132 133 134 135 136 137 138 139 | |
run ¶
run(measurements, initial_state, initial_cov=None)
Filter a stream of measurements.
The filter follows the standard predict-update cycle: at each
step the previous estimate is propagated through the state
equation before being corrected by the measurement. The
initial_state is therefore the estimate prior to the first
measurement (at time step -1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
measurements
|
(ndarray, shape(m, nb_steps))
|
One measurement vector per time step. |
required |
initial_state
|
(ndarray, shape(d))
|
State estimate one step before the first measurement. |
required |
initial_cov
|
(ndarray, shape(d, d))
|
Covariance of the initial state estimate; zero by default (the initial state is trusted exactly). |
None
|
Returns:
| Type | Description |
|---|---|
(ndarray, shape(d, nb_steps))
|
The estimated state at each time step. |
Source code in src/sies/tracking/kalman.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
target_dynamics ¶
target_dynamics(dt, std_acc, std_acc_angle)
Build the matrices of the linear target motion model.
The target follows a constant-velocity model driven by white acceleration noise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
float
|
Time step. |
required |
std_acc
|
float
|
Standard deviation of the linear acceleration noise. |
required |
std_acc_angle
|
float
|
Standard deviation of the angular acceleration noise. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
state_matrix |
(ndarray, shape(5, 5))
|
State transition matrix |
noise_cov |
(ndarray, shape(5, 5))
|
Process noise covariance |
noise_gain |
(ndarray, shape(5, 5))
|
Gain |
Source code in src/sies/tracking/kalman.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
simulate_target_path ¶
simulate_target_path(dt, nb_steps, initial_state, std_acc, std_acc_angle, rng=None)
Simulate a random target trajectory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
float
|
Time step. |
required |
nb_steps
|
int
|
Number of time steps. |
required |
initial_state
|
(ndarray, shape(5))
|
Initial state |
required |
std_acc
|
float
|
Standard deviation of the linear acceleration noise. |
required |
std_acc_angle
|
float
|
Standard deviation of the angular acceleration noise. |
required |
rng
|
Generator
|
Random generator, for reproducibility. |
None
|
Returns:
| Type | Description |
|---|---|
(ndarray, shape(5, nb_steps))
|
The simulated state at each time step. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/sies/tracking/kalman.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
sies.tracking.observation ¶
Observation model of the tracking problem.
The observation is the MSR matrix produced by a target of known CGPT
located at the (unknown) position and orientation encoded in the state
vector [vx, vy, x, y, phi].
CGPTObservation ¶
CGPTObservation(src_matrix, rcv_matrix, cgpt)
MSR observation of a moving target with known CGPT.
The forward model is MSR = As M(x, phi) Ar^T where M(x, phi)
is the CGPT of the target translated to x and rotated by
phi.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src_matrix
|
ndarray, shape (ns, 2k)
|
Source-side acquisition matrix |
required |
rcv_matrix
|
ndarray, shape (nr, 2k)
|
Receiver-side acquisition matrix |
required |
cgpt
|
ndarray, shape (2k, 2k)
|
CGPT matrix of the target at the origin with orientation zero. |
required |
Source code in src/sies/tracking/observation.py
34 35 36 37 38 39 40 41 42 43 44 | |
__call__ ¶
__call__(state)
Evaluate the observation function h.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
(ndarray, shape(5))
|
State vector |
required |
Returns:
| Type | Description |
|---|---|
(ndarray, shape(ns * nr))
|
The vectorized MSR matrix. |
Source code in src/sies/tracking/observation.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
jacobian ¶
jacobian(state)
Evaluate the Jacobian of the observation function.
The derivatives are taken with respect to the five state variables; only the position and orientation derivatives are nonzero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
(ndarray, shape(5))
|
State vector |
required |
Returns:
| Type | Description |
|---|---|
(ndarray, shape(ns * nr, 5))
|
The Jacobian matrix. |
Source code in src/sies/tracking/observation.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |