H-Infinity Filter
HInfinityFilter¶
H-Infinity filter implementation for robust state estimation.
API Reference¶
HInfinityFilter
¶
Bases: object
H-Infinity filter. You are responsible for setting the various state variables to reasonable values; the defaults below will not give you a functional filter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dim_x
|
int
|
Number of state variables for the Kalman filter. For example, if you are tracking the position and velocity of an object in two dimensions, dim_x would be 4. This is used to set the default size of |
required |
dim_z
|
int
|
Number of of measurement inputs. For example, if the sensor
provides you with position in (x, y), |
required |
dim_u
|
int
|
Number of control inputs for the Gu part of the prediction step. |
required |
gamma
|
float
|
|
required |
Warning
|
I do not believe this code is correct. DO NOT USE THIS. In particular, note that predict does not update the covariance matrix. |
required |
Source code in bayesian_filters/hinfinity/hinfinity_filter.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 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 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
V
property
writable
¶
measurement noise matrix
batch_filter(Zs, update_first=False, saver=None)
¶
Batch processes a sequences of measurements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Zs
|
list - like
|
list of measurements at each time step |
required |
update_first
|
bool
|
controls whether the order of operations is update followed by predict, or predict followed by update. |
False, optional,
|
saver
|
Saver
|
bayesian_filters.common.Saver object. If provided, saver.save() will be called after every epoch |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
means |
ndarray((n, dim_x, 1))
|
array of the state for each time step. Each entry is an np.array.
In other words |
covariance |
ndarray((n, dim_x, dim_x))
|
array of the covariances for each time step. In other words
|
Source code in bayesian_filters/hinfinity/hinfinity_filter.py
get_prediction(u=0)
¶
Predicts the next state of the filter and returns it. Does not alter the state of the filter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
ndarray
|
optional control input |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
x |
ndarray
|
State vector of the prediction. |
Source code in bayesian_filters/hinfinity/hinfinity_filter.py
measurement_of_state(x)
¶
Helper function that converts a state into a measurement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
H-Infinity state vector |
required |
Returns:
| Name | Type | Description |
|---|---|---|
z |
ndarray
|
measurement corresponding to the given state |
Source code in bayesian_filters/hinfinity/hinfinity_filter.py
predict(u=0)
¶
Predict next position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
ndarray
|
Optional control vector. If non-zero, it is multiplied by |
0
|
Source code in bayesian_filters/hinfinity/hinfinity_filter.py
residual_of(z)
¶
returns the residual for the given measurement (z). Does not alter the state of the filter.
update(z)
¶
Add a new measurement z to the H-Infinity filter. If z is None,
nothing is changed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
ndarray
|
measurement for this update. |
required |