mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-09-04 11:58:00 +00:00
Avoid potential division by zero
This commit is contained in:
@@ -1223,7 +1223,7 @@ void dll_pll_veml_tracking::update_tracking_vars()
|
|||||||
}
|
}
|
||||||
tmp_cp1 /= static_cast<double>(d_trk_parameters.smoother_length);
|
tmp_cp1 /= static_cast<double>(d_trk_parameters.smoother_length);
|
||||||
tmp_cp2 /= static_cast<double>(d_trk_parameters.smoother_length);
|
tmp_cp2 /= static_cast<double>(d_trk_parameters.smoother_length);
|
||||||
d_carrier_phase_rate_step_rad = (tmp_cp2 - tmp_cp1) / tmp_samples;
|
d_carrier_phase_rate_step_rad = (tmp_samples != 0) ? (tmp_cp2 - tmp_cp1) / tmp_samples : 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// std::cout << d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in * d_trk_parameters.fs_in / TWO_PI << '\n';
|
// std::cout << d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in * d_trk_parameters.fs_in / TWO_PI << '\n';
|
||||||
|
@@ -846,7 +846,7 @@ void dll_pll_veml_tracking_fpga::update_tracking_vars()
|
|||||||
}
|
}
|
||||||
tmp_cp1 /= static_cast<double>(d_trk_parameters.smoother_length);
|
tmp_cp1 /= static_cast<double>(d_trk_parameters.smoother_length);
|
||||||
tmp_cp2 /= static_cast<double>(d_trk_parameters.smoother_length);
|
tmp_cp2 /= static_cast<double>(d_trk_parameters.smoother_length);
|
||||||
d_carrier_phase_rate_step_rad = (tmp_cp2 - tmp_cp1) / tmp_samples;
|
d_carrier_phase_rate_step_rad = (tmp_samples != 0) ? (tmp_cp2 - tmp_cp1) / tmp_samples : 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// std::cout << d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in * d_trk_parameters.fs_in / TWO_PI << '\n';
|
// std::cout << d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in * d_trk_parameters.fs_in / TWO_PI << '\n';
|
||||||
|
@@ -1285,10 +1285,7 @@ void kf_tracking::update_tracking_vars()
|
|||||||
}
|
}
|
||||||
tmp_cp1 /= static_cast<double>(d_trk_parameters.smoother_length);
|
tmp_cp1 /= static_cast<double>(d_trk_parameters.smoother_length);
|
||||||
tmp_cp2 /= static_cast<double>(d_trk_parameters.smoother_length);
|
tmp_cp2 /= static_cast<double>(d_trk_parameters.smoother_length);
|
||||||
if (tmp_samples >= 1.0)
|
d_carrier_phase_rate_step_rad = (tmp_samples != 0) ? (tmp_cp2 - tmp_cp1) / tmp_samples : 0.0;
|
||||||
{
|
|
||||||
d_carrier_phase_rate_step_rad = (tmp_cp2 - tmp_cp1) / tmp_samples;
|
|
||||||
}
|
|
||||||
d_x_old_old(3) = d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in / TWO_PI;
|
d_x_old_old(3) = d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in / TWO_PI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1320,7 +1317,7 @@ void kf_tracking::update_tracking_vars()
|
|||||||
}
|
}
|
||||||
tmp_cp1 /= static_cast<double>(d_trk_parameters.smoother_length);
|
tmp_cp1 /= static_cast<double>(d_trk_parameters.smoother_length);
|
||||||
tmp_cp2 /= static_cast<double>(d_trk_parameters.smoother_length);
|
tmp_cp2 /= static_cast<double>(d_trk_parameters.smoother_length);
|
||||||
d_code_phase_rate_step_chips = (tmp_cp2 - tmp_cp1) / tmp_samples;
|
d_code_phase_rate_step_chips = (tmp_samples != 0) ? (tmp_cp2 - tmp_cp1) / tmp_samples : 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user