bf

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 10 Imported by: 3

README

Bootstrap Filter

This package implements Bootstrap Filter also known as Particle filter.

Example output

Bootstrap filter in action

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlphaGauss

func AlphaGauss(r, c int) float64

AlphaGauss computes optimal regulariation parameter for Gaussian kernel and returns it.

Types

type BF

type BF struct {
	// contains filtered or unexported fields
}

BF is a Bootstrap Filter a.k.a. SIR Particle Filter. For more information about Bootstrap Filter see: https://en.wikipedia.org/wiki/Particle_filter#The_bootstrap_filter

func New

func New(m filter.Model, ic filter.InitCond, q, r filter.Noise, p int, pdf distmv.LogProber) (*BF, error)

New creates new Particle Filter (PF) with the following parameters and returns it: - m: system model - init: initial condition of the filter - q: state noise a.k.a. process noise - r: output noise a.k.a. measurement noise - p: number of filter particles - pdf: Probability Density Function (PDF) of filter output error New returns error if non-positive number of particles is given or if the particles fail to be generated.

func (*BF) Particles

func (b *BF) Particles() mat.Matrix

Particles returns BF particles

func (*BF) Predict

func (b *BF) Predict(x, u mat.Vector) (filter.Estimate, error)

Predict estimates the next system state and its output given the state x and input u and returns it. Predict modifies internal state of the filter: it updates its particle with their predicted values. It returns error if it fails to propagate either the filter particles or x to the next state.

func (*BF) Resample

func (b *BF) Resample(alpha float64) error

Resample allows to resample filter particles with regularization parameter alpha. It generates new filter particles and replaces the existing ones with them. If invalid (non-positive) alpha is provided we use optimal alpha for gaussian kernel. It returns error if it fails to generate new filter particles.

func (*BF) Run

func (b *BF) Run(x, u, z mat.Vector) (filter.Estimate, error)

Run runs one step of Bootstrap Filter for given state x, input u and measurement z. It corrects system state estimate x using measurement z and returns a new state estimate. It returns error if it either fails to propagate particles or update the state x.

func (*BF) Update

func (b *BF) Update(x, u, z mat.Vector) (filter.Estimate, error)

Update corrects state x using the measurement z given control intput u and returns the corrected estimate. It returns error if it fails to calculate system output estimate or if the size of z is invalid.

func (*BF) Weights

func (b *BF) Weights() mat.Vector

Weights returns a vector containing BF particle weights

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL