From ce964eea67a82f68f53e5f29ed6810bea51e2b35 Mon Sep 17 00:00:00 2001 From: miguekf Date: Thu, 8 Dec 2022 13:58:54 +0100 Subject: [PATCH] ADD: new matlab routines for vtl --- src/utils/matlab/vtl/kf_prototype.m | 142 ++++++++++++++++++++++ src/utils/matlab/vtl/vtl_general_plot.m | 155 ++++++++++++++++++++++++ src/utils/matlab/vtl/vtl_prototype.m | 149 +++++++++++++++++++++++ 3 files changed, 446 insertions(+) create mode 100644 src/utils/matlab/vtl/kf_prototype.m create mode 100644 src/utils/matlab/vtl/vtl_general_plot.m create mode 100644 src/utils/matlab/vtl/vtl_prototype.m diff --git a/src/utils/matlab/vtl/kf_prototype.m b/src/utils/matlab/vtl/kf_prototype.m new file mode 100644 index 000000000..a113e4357 --- /dev/null +++ b/src/utils/matlab/vtl/kf_prototype.m @@ -0,0 +1,142 @@ +%% vtl KF +%% +sat_number=5; +%% ################## Kalman filter initialization ###################################### +% covariances (static) +kf_P_x = eye(8)*10.0; %TODO: use a real value. +kf_x = zeros(8, 1); +kf_R = zeros(2*sat_number, 2*sat_number); +kf_dt=0.1; +kf_F = eye(8, 8); +kf_F(1, 4) = kf_dt; +kf_F(2, 5) = kf_dt; +kf_F(3, 6) = kf_dt; +kf_F(7, 8) = kf_dt; + +kf_H = zeros(2*sat_number,8); +kf_y = zeros(2*sat_number, 1); +kf_yerr = zeros(2*sat_number, 1); +% kf_xerr = zeros(8, 1); +kf_S = zeros(2*sat_number, 2*sat_number); % kf_P_y innovation covariance matrix + +%% State error Covariance Matrix Q (PVT) +kf_Q = eye(8);%new_data.rx_pvt_var(i); %careful, values for V and T could not be adecuate. +%% + +% Measurement error Covariance Matrix R assembling +for chan=1:5 %neccesary quantities + for t=1:length(navSolution.RX_time) + % It is diagonal 2*NSatellite x 2*NSatellite (NSat psudorange error;NSat pseudo range rate error) + kf_R(chan, chan) = 40.0; %TODO: fill with real values. + kf_R(chan+sat_number, chan+sat_number) = 10.0; + end +end + +%% ################## Kalman Tracking ###################################### +% receiver solution from rtklib_solver +for t=1:length(navSolution.RX_time) + + if (t