diff --git a/matlab/GPSaidedINS_car.m b/matlab/GPSaidedINS_car.m index 3a6f10d6c61d6c5fb096541af10787d17d987019..d84bef978535a29c328ff3bd7ab9214a0f804497 100644 --- a/matlab/GPSaidedINS_car.m +++ b/matlab/GPSaidedINS_car.m @@ -86,7 +86,7 @@ for k=2:N %%%%%%%%%%%%%%%%% %randomized number of visible satellites sv = random_satellites(sv); - %sv=5; + %sv=5; %uncomment for simulations without loss of visibility %control action P_store=[P_store,sum(sqrt(out_data.diag_P(1:3,k-1)))]; if sum(sqrt(out_data.diag_P(1:3,k-1)))<P_treshold @@ -95,7 +95,6 @@ for k=2:N turn=true; end %update sensor state -% pre_state=sensor.state; sensor=gps_randomized_car(t(k),sensor,turn,sv); %remove _randomized for worst case %determine if GPS position is available GPS_position=strcmp(sensor.state,'position_available'); @@ -104,12 +103,6 @@ for k=2:N energy=energy+power*Ts; end -% %print new state and current time if it changes -% if ~strcmp(pre_state, sensor.state) -% sensor.state -% t(k) -% end - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Calibrate the sensor measurements using current sensor bias estimate. @@ -168,10 +161,6 @@ for k=2:N out_data.turn(k)=turn; end -%% plot feedback over P matrix -%figure(11) -%plot(P_store),grid - %% output for simulation of energy-accuracy tradeoff out_data.energy=energy; xest = out_data.x_h(2,:); diff --git a/matlab/GPSaidedINS_cycling.m b/matlab/GPSaidedINS_cycling.m index e0e92028924ab9ad34035e9d1084cbbd60454b0c..aa17f2be29c9224a3c5f4d4e764bbce598e666b9 100644 --- a/matlab/GPSaidedINS_cycling.m +++ b/matlab/GPSaidedINS_cycling.m @@ -92,7 +92,7 @@ for k=start_sim:start_sim+length_sim %%%%%%%%%%%%%%%%% %randomized number of visible satellites sv = random_satellites(sv); - %sv=5; + %sv=5; %uncomment for simulations without loss of visibility %control action P_store=[P_store,sum(sqrt(out_data.diag_P(1:3,k-1)))]; if sum(sqrt(out_data.diag_P(1:3,k-1)))<P_treshold @@ -101,7 +101,6 @@ for k=start_sim:start_sim+length_sim turn=true; end %update sensor state -% pre_state=sensor.state; sensor=gps_randomized_cycling(t(k),sensor,turn,sv); %remove _randomized for worst case %determine if GPS position is available GPS_position=strcmp(sensor.state,'position_available'); @@ -110,12 +109,6 @@ for k=start_sim:start_sim+length_sim energy=energy+power*Ts; end -% %print new state and current time if it changes -% if ~strcmp(pre_state, sensor.state) -% sensor.state -% t(k) -% end - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Calibrate the sensor measurements using current sensor bias estimate. @@ -171,26 +164,19 @@ for k=start_sim:start_sim+length_sim out_data.diag_P(:,k)=diag(P); out_data.delta_u_h(:,k)=delta_u_h; out_data.sv(k)=sv; - turn_store=[turn_store, turn]; + out_data.turn(k)=turn; end -%% plot feedback over P matrix -%figure(11) -%plot(P_store),grid - %% output for simulation of energy-accuracy tradeoff out_data.energy=energy; - -xest = out_data.x_h(2,start_sim:start_sim+length_sim);%2,:); -yest = out_data.x_h(1,start_sim:start_sim+length_sim);%1,:); +xest = out_data.x_h(2,start_sim:start_sim+length_sim); +yest = out_data.x_h(1,start_sim:start_sim+length_sim); xgps = interp1(in_data.GNSS.t,in_data.GNSS.pos_ned(2,:),in_data.IMU.t(start_sim:start_sim+length_sim),'linear','extrap')'; ygps = interp1(in_data.GNSS.t,in_data.GNSS.pos_ned(1,:),in_data.IMU.t(start_sim:start_sim+length_sim),'linear','extrap')'; xerr = xest - xgps; yerr = yest - ygps; out_data.error = sqrt(mean(xerr.^2+yerr.^2)); out_data.P_store=P_store; -out_data.turn=turn_store; - end