diff --git a/libraries/SITL/SIM_Aircraft.cpp b/libraries/SITL/SIM_Aircraft.cpp index c007a2cc00..08ecbd385d 100644 --- a/libraries/SITL/SIM_Aircraft.cpp +++ b/libraries/SITL/SIM_Aircraft.cpp @@ -119,6 +119,14 @@ bool Aircraft::parse_home(const char *home_str, Location &loc, float &yaw_degree loc.lng = static_cast(strtof(lon_s, nullptr) * 1.0e7f); loc.alt = static_cast(strtof(alt_s, nullptr) * 1.0e2f); + if (loc.lat == 0 && loc.lng == 0) { + // default to CMAC instead of middle of the ocean. This makes + // SITL in MissionPlanner a bit more useful + loc.lat = -35.363261*1e7; + loc.lng = 149.165230*1e7; + loc.alt = 584*100; + } + yaw_degrees = strtof(yaw_s, nullptr); free(s); diff --git a/libraries/SITL/SIM_FlightAxis.cpp b/libraries/SITL/SIM_FlightAxis.cpp index 537d957b8f..b33b2dfdef 100644 --- a/libraries/SITL/SIM_FlightAxis.cpp +++ b/libraries/SITL/SIM_FlightAxis.cpp @@ -37,6 +37,41 @@ using namespace SITL; // the asprintf() calls are not worth checking for SITL #pragma GCC diagnostic ignored "-Wunused-result" +static const struct { + const char *name; + float value; +} sim_defaults[] = { + { "AHRS_EKF_TYPE", 10 }, + { "INS_GYR_CAL", 0 }, + { "SERVO1_MIN", 1000 }, + { "SERVO1_MAX", 2000 }, + { "SERVO2_MIN", 1000 }, + { "SERVO2_MAX", 2000 }, + { "SERVO3_MIN", 1000 }, + { "SERVO3_MAX", 2000 }, + { "SERVO4_MIN", 1000 }, + { "SERVO4_MAX", 2000 }, + { "SERVO5_MIN", 1000 }, + { "SERVO5_MAX", 2000 }, + { "SERVO6_MIN", 1000 }, + { "SERVO6_MAX", 2000 }, + { "SERVO6_MIN", 1000 }, + { "SERVO6_MAX", 2000 }, + { "INS_ACC2OFFS_X", 0.001 }, + { "INS_ACC2OFFS_Y", 0.001 }, + { "INS_ACC2OFFS_Z", 0.001 }, + { "INS_ACC2SCAL_X", 1.001 }, + { "INS_ACC2SCAL_Y", 1.001 }, + { "INS_ACC2SCAL_Z", 1.001 }, + { "INS_ACCOFFS_X", 0.001 }, + { "INS_ACCOFFS_Y", 0.001 }, + { "INS_ACCOFFS_Z", 0.001 }, + { "INS_ACCSCAL_X", 1.001 }, + { "INS_ACCSCAL_Y", 1.001 }, + { "INS_ACCSCAL_Z", 1.001 }, +}; + + FlightAxis::FlightAxis(const char *home_str, const char *frame_str) : Aircraft(home_str, frame_str) { @@ -48,9 +83,9 @@ FlightAxis::FlightAxis(const char *home_str, const char *frame_str) : if (colon) { controller_ip = colon+1; } - // FlightAxis sensor data is not good enough for EKF. Use fake EKF by default - AP_Param::set_default_by_name("AHRS_EKF_TYPE", 10); - AP_Param::set_default_by_name("INS_GYR_CAL", 0); + for (uint8_t i=0; i