mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 21:53:33 +08:00
EKF: use uint64_t cast for XeY to avoid float casting of variables
The default type for XeY is float
This commit is contained in:
@@ -47,7 +47,7 @@ bool Ekf::initHagl()
|
||||
// get most recent range measurement from buffer
|
||||
rangeSample latest_measurement = _range_buffer.get_newest();
|
||||
|
||||
if ((_time_last_imu - latest_measurement.time_us) < 2e5 && _R_rng_to_earth_2_2 > _params.range_cos_max_tilt) {
|
||||
if ((_time_last_imu - latest_measurement.time_us) < (uint64_t)2e5 && _R_rng_to_earth_2_2 > _params.range_cos_max_tilt) {
|
||||
// if we have a fresh measurement, use it to initialise the terrain estimator
|
||||
_terrain_vpos = _state.pos(2) + latest_measurement.rng * _R_rng_to_earth_2_2;
|
||||
// initialise state variance to variance of measurement
|
||||
@@ -159,7 +159,7 @@ void Ekf::fuseHagl()
|
||||
bool Ekf::get_terrain_valid()
|
||||
{
|
||||
if (_terrain_initialised && _range_data_continuous && !_rng_stuck &&
|
||||
(_time_last_imu - _time_last_hagl_fuse < 5E6)) {
|
||||
(_time_last_imu - _time_last_hagl_fuse < (uint64_t)5e6)) {
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user