Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replay: added --force-ekf2 and --force-ekf3 #15820

Merged
merged 7 commits into from Nov 17, 2020
11 changes: 6 additions & 5 deletions libraries/AP_HAL_SITL/SITL_cmdline.cpp
Expand Up @@ -209,6 +209,7 @@ void SITL_State::_parse_command_line(int argc, char * const argv[])
static struct timeval first_tv;
gettimeofday(&first_tv, nullptr);
time_t start_time_UTC = first_tv.tv_sec;
const bool is_replay = APM_BUILD_TYPE(APM_BUILD_Replay);

enum long_options {
CMDLINE_GIMBAL = 1,
Expand Down Expand Up @@ -272,10 +273,10 @@ void SITL_State::_parse_command_line(int argc, char * const argv[])
{0, false, 0, 0}
};

#if APM_BUILD_TYPE(APM_BUILD_Replay)
model_str = "quad";
HALSITL::UARTDriver::_console = true;
#endif
if (is_replay) {
model_str = "quad";
HALSITL::UARTDriver::_console = true;
}

if (asprintf(&autotest_dir, SKETCHBOOK "/Tools/autotest") <= 0) {
AP_HAL::panic("out of memory");
Expand All @@ -287,7 +288,7 @@ void SITL_State::_parse_command_line(int argc, char * const argv[])

GetOptLong gopt(argc, argv, "hwus:r:CI:P:SO:M:F:c:",
options);
while ((opt = gopt.getoption()) != -1) {
while (!is_replay && (opt = gopt.getoption()) != -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just nitpicking, but can't we just move the if (is_replay) here and put the while loop into the the else cause ?
That would also have the advantage to allow us to define another parser for the SITL replay configuration

switch (opt) {
case 'w':
AP_Param::erase_all();
Expand Down