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:
ChristophTobler
2017-11-08 11:40:26 +01:00
parent bba3f70a0e
commit e388e59f32
8 changed files with 26 additions and 27 deletions
+2 -2
View File
@@ -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 {