navlie.datagen.DataGenerator¶
- class navlie.datagen.DataGenerator(process_model: ProcessModel, input_func: Callable[[float], ndarray], input_covariance: ndarray, input_freq: float, meas_model_list: List[MeasurementModel] | None = None, meas_freq_list: float | List[float] | None = None, meas_offset_list: float | List[float] | None = None)¶
Bases:
object
A class used for data generation given a process model, and as many measurement models as you want. Frequencies and offsets of each measurement can also be specified.
- Parameters:
process_model (ProcessModel) – Process model to be used for ground truth trajectory simulation
input_func (Callable[[float], np.ndarray]) – A function that returns the input value to be used. The function must accept a timestamp as a float from the data generator.
input_covariance (np.ndarray or Callable[[float], np.ndarray].) – Covariance used for noise generation to be applied to input values. Either provided as a static value or as a function returning the time-varying Q
input_freq (float) – Frequency if the input.
meas_model_list (List[MeasurementModel], optional) – MeasurementModel of measurements to be generated, by default []
meas_freq_list (float or List[float], optional) – If a measurement model list is provided, also provide a list of frequencies associated with each measurement. If a single frequency is provided as a float, it will be used for all measurements.
meas_offset_list (float or List[float], optional) – If a measurement model list is provided, you can also provide a list of initial offsets associated with each measurement. If no offsets provided, the initial offset is assumed to be 0. If a single offset is provided as a float, it will be used for all measurements.
- add_measurement_model(model: MeasurementModel, freq: float, offset: float = 0.0)¶
Adds a new measurement model to the existing list of measurement models.
- Parameters:
model (MeasurementModel) – The MeasurementModel of measurements to be generated.
freq (float) – The frequency associated with these measurements.
offset (float, optional) – The initial offset associated with these measurements, by default 0.0.
- generate(x0: State, start: float, stop: float, noise=False)¶
Generates data by integrating the process model using noiseless input values, and using the states computed to generate measuements.
- Parameters:
- Returns:
List[State] – Ground truth states
List[Input] – Inputs, possibly noisy if requested.
List[Measurement] – Measurements, possibly noisy if requested.