Struct openpilot::common::ext_kal_fltr::SimpleSensor
source · pub struct SimpleSensor {
pub obs_model: Array2<f64>,
pub covar: Array2<f64>,
}
Expand description
Represents a simple sensor with an observation model and covariance matrix.
Fields§
§obs_model: Array2<f64>
Observation model matrix for the simple sensor.
covar: Array2<f64>
Covariance matrix for the simple sensor.
Implementations§
source§impl SimpleSensor
impl SimpleSensor
sourcepub fn new(obs_model: Array2<f64>, covar: Array2<f64>, dims: usize) -> Self
pub fn new(obs_model: Array2<f64>, covar: Array2<f64>, dims: usize) -> Self
Creates a new SimpleSensor
instance.
§Arguments
obs_model
- Observation model matrix for the simple sensor.covar
- Covariance matrix for the simple sensor.dims
- Number of dimensions for the observation model.
§Returns
(SimpleSensor
): A new SimpleSensor
instance.
§Examples
use ndarray::{arr2, Array2};
use openpilot::common::ext_kal_fltr::SimpleSensor;
let obs_model = arr2(&[[1.0, 0.0], [0.0, 1.0]]);
let covar = arr2(&[[0.1, 0.0], [0.0, 0.1]]);
let dims = 2;
let simple_sensor = SimpleSensor::new(obs_model, covar, dims);
sourcepub fn read(
&self,
data: Array2<f64>,
covar: Option<Array2<f64>>
) -> SensorReading
pub fn read( &self, data: Array2<f64>, covar: Option<Array2<f64>> ) -> SensorReading
Reads data from the sensor and returns a SensorReading
instance.
§Arguments
data
- Observed data from the sensor.covar
- Optional covariance matrix. If not provided, the default covariance of the sensor is used.
§Returns
(SensorReading
): A new SensorReading
instance based on the sensor’s data and covariance.
§Examples
use ndarray::{arr2, Array2};
use openpilot::common::ext_kal_fltr::{SimpleSensor, SensorReading};
let obs_model = arr2(&[[1.0, 0.0], [0.0, 1.0]]);
let covar = arr2(&[[0.1, 0.0], [0.0, 0.1]]);
let dims = 2;
let simple_sensor = SimpleSensor::new(obs_model, covar, dims);
let data = arr2(&[[1.0, 2.0]]);
let sensor_reading = simple_sensor.read(data, None);
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for SimpleSensor
impl Send for SimpleSensor
impl Sync for SimpleSensor
impl Unpin for SimpleSensor
impl UnwindSafe for SimpleSensor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more