Class ExtendedKalmanFilter

Class Documentation

class ExtendedKalmanFilter

Public Functions

ExtendedKalmanFilter(const double &alpha, const bool &adaptive_R, const double &P_weight_param, const std::vector<double> &Q_weight_process, const std::vector<double> &Q_weight_parameters, const std::vector<double> &R_weight_measurement, const int &state_dim, const double &adaptive_weight, const double &wheel_base_sae, const double &radius_wheel, const double &cog_pct_front, const double &mass_sae, const double &g, const double &inertia_sae, const double &aereodynamic_coefficient, const double &rolling_resistance, const std::vector<double> &pacejka_parameters, const bool &parameter_EKF, const double &tao_filter_parameter, const bool &plot, const bool &debug)

Construct a new Ekf object.

std::pair<arma::mat, arma::vec8> update(const arma::vec7 &measurement, const double &steering_angle, const double &torque_left, const double &torque_right, const double &dt)

Update step of the Kalman FIlter. This is the method that is called after gathering data in the ROS2 node and constitutes the main part of the EKF. Measurements are compared to predictions, and based on the computed Kalman Gain, a refined state estimate is provided. Offers also the possibility to adapt the covariance matrices and estimate Pacejka parameters.

Parameters:
  • measurement – A vector of measurements coming from the VCU

  • steering_angle – Steering angle of the front wheels

  • torque_left – Torque applied to the left rear wheel

  • torque_right – Torque applied to the right rear wheel

Returns:

A pair containing the refined state covariance matrix and the refined state estimate

void plot_graphs()

Plot diagrams for visualization.

This method generates and displays diagrams for various parameters.

Public Members

arma::vec8 model_current_state_estimate

Current state estimate of the model.

arma::vec4 model_tyre_forces

Tyre forces at the front and rear axles.