Commander: Fix HITL state initialization that prevented pre-flight checks to pass in HITL mode on v1.7.2

This is a minor change that fixes the ordering of the initialization.
This commit is contained in:
Lorenz Meier
2017-12-27 19:31:40 +01:00
parent 644db1b03f
commit 0ae1737e85

View File

@@ -1258,11 +1258,6 @@ Commander::run()
// XXX for now just set sensors as initialized
status_flags.condition_system_sensors_initialized = true;
/* vehicle status topic */
status = {};
status.hil_state = vehicle_status_s::HIL_STATE_OFF;
/* set parameters */
param_t _param_sys_type = param_find("MAV_TYPE");
param_t _param_system_id = param_find("MAV_SYS_ID");
@@ -4541,6 +4536,9 @@ Commander *Commander::instantiate(int argc, char *argv[])
{
Commander *instance = new Commander();
// XXX remove this once this is a class member
status = {};
if (instance) {
if (argc >= 2 && !strcmp(argv[1], "--hil")) {
instance->enable_hil();
@@ -4552,5 +4550,5 @@ Commander *Commander::instantiate(int argc, char *argv[])
void Commander::enable_hil()
{
status.hil_state = vehicle_status_s::HIL_STATE_OFF;
status.hil_state = vehicle_status_s::HIL_STATE_ON;
};