initialise data members properly

- dot not use memset for struct with non POD types

Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
Roman 2017-01-09 13:50:41 +01:00 committed by Lorenz Meier
parent 1465adca2f
commit c5a55d97aa
1 changed files with 11 additions and 11 deletions

View File

@ -52,6 +52,13 @@ EstimatorInterface::EstimatorInterface():
_imu_buffer_length(30),
_min_obs_interval_us(0),
_dt_imu_avg(0.0f),
_mag_sample_delayed{},
_baro_sample_delayed{},
_gps_sample_delayed{},
_range_sample_delayed{},
_airspeed_sample_delayed{},
_flow_sample_delayed{},
_ev_sample_delayed{},
_imu_ticks(0),
_imu_updated(false),
_initialised(false),
@ -59,10 +66,14 @@ EstimatorInterface::EstimatorInterface():
_gps_speed_valid(false),
_gps_origin_eph(0.0f),
_gps_origin_epv(0.0f),
_pos_ref{},
_yaw_test_ratio(0.0f),
_mag_test_ratio{},
_vel_pos_test_ratio{},
_tas_test_ratio(0.0f),
_terr_test_ratio(0.0f),
_beta_test_ratio(0.0f),
_vibe_metrics{},
_time_last_imu(0),
_time_last_gps(0),
_time_last_mag(0),
@ -74,19 +85,8 @@ EstimatorInterface::EstimatorInterface():
_mag_declination_gps(0.0f),
_mag_declination_to_save_deg(0.0f)
{
_pos_ref = {};
memset(_mag_test_ratio, 0, sizeof(_mag_test_ratio));
memset(_vel_pos_test_ratio, 0, sizeof(_vel_pos_test_ratio));
_delta_ang_prev.setZero();
_delta_vel_prev.setZero();
memset(_vibe_metrics, 0, sizeof(_vibe_metrics));
memset(&_mag_sample_delayed, 0, sizeof(_mag_sample_delayed));
memset(&_baro_sample_delayed, 0, sizeof(_baro_sample_delayed));
memset(&_gps_sample_delayed, 0, sizeof(_gps_sample_delayed));
memset(&_range_sample_delayed, 0, sizeof(_range_sample_delayed));
memset(&_airspeed_sample_delayed, 0, sizeof(_airspeed_sample_delayed));
memset(&_flow_sample_delayed, 0, sizeof(_flow_sample_delayed));
memset(&_ev_sample_delayed, 0, sizeof(_ev_sample_delayed));
}
EstimatorInterface::~EstimatorInterface()