c4dynamics.sensors.navigation.gps.measure#
- gps.measure(x_true)[source]#
Measure inertial position.
The method extracts the first three elements of
x_trueand adds the GPS bias and a zero-mean Gaussian noise sample to each coordinate.- Parameters:
x_true (array_like) – True position vector
[x, y, z][m].- Returns:
numpy.ndarray – Measured inertial position
[x, y, z], [m].
Errors Model
A single independent noise sample is generated for each position coordinate. The returned measurement is therefore:
\[z = x_{true}[0:3] + bias + std \cdot N(0, I)\]The bias is constant for the GPS instance, while the noise is regenerated at every call.
Examples
>>> import c4dynamics as c4d >>> import numpy as np >>> np.random.seed(42) >>> gps_sensor = c4d.sensors.gps(noise_std=0, bias=[1, -2, 0.5]) >>> x = np.zeros(12) >>> x[0:3] = [10, 20, 30] >>> gps_sensor.measure(x) array([11. 18. 30.5])