-
Notifications
You must be signed in to change notification settings - Fork 0
/
ukf.h
executable file
·111 lines (79 loc) · 2.51 KB
/
ukf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#ifndef UKF_H
#define UKF_H
#include "libs/Eigen/Dense"
#include "utility.h"
class Ukf {
public:
bool is_initialized;
long previous_timestamp;
// state vector [pos1 pos2 vel_abs yaw_angle yaw_rate] in SI units and rad
Eigen::VectorXd x;
Eigen::VectorXd x_aug;
// state covariance matrix
Eigen::MatrixXd P;
Eigen::MatrixXd P_aug;
// sigma points matrices and weights
Eigen::MatrixXd Xsig_aug;
Eigen::MatrixXd Xsig_pred;
Eigen::VectorXd weights;
// Process noise standard deviation longitudinal acceleration in m/s^2
double std_a;
// Process noise standard deviation yaw acceleration in rad/s^2
double std_yawdd;
// Laser measurement noise standard deviation position1 in m
double std_laspx;
// Laser measurement noise standard deviation position2 in m
double std_laspy;
// Radar measurement noise standard deviation radius in m
double std_radr;
// Radar measurement noise standard deviation angle in rad
double std_radphi;
// Radar measurement noise standard deviation radius change in m/s
double std_radrd ;
// Measurement noise covariance matrices
Eigen::MatrixXd R_radar;
Eigen::MatrixXd R_lidar;
Eigen::MatrixXd H_lidar;
///* State dimension
int n_x;
///* Augmented state dimension
int n_aug;
int n_z_radar;
int n_z_lidar;
///* Sigma point spreading parameter
double lambda;
///* the current NIS for last processed measurement
double nis;
///* the total number of sigma points
int total_sig_points;
// Constructor
Ukf();
void GenerateSigmaPoints();
void PredictSigmaPoints(double dt);
void PredictMeanCovariance();
/**
* ProcessMeasurement
* @param reading The latest measurement data of either radar or laser
*/
void ProcessMeasurement(const utility::SensorReading& reading);
/**
* Prediction Predicts sigma points, the state, and the state covariance
* matrix
* @param dt Time between k and k+1 in s
*/
void Prediction(double dt);
/**
* Updates the state and the state covariance matrix using a laser measurement
* @param reading The measurement at k+1
*/
void UpdateLidar(const utility::SensorReading& reading);
/**
* Updates the state and the state covariance matrix using a radar measurement
* @param reading The measurement at k+1
*/
void UpdateRadar(const utility::SensorReading& reading);
void CompleteUpdate(const Eigen::MatrixXd& Zsig, const utility::SensorReading& reading);
private:
void InitializeState(const utility::SensorReading& reading);
};
#endif /* UKF_H */