mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-03 12:14:10 -04:00
Replay: allow replay to run on SITL instead of linux HAL
This commit is contained in:
parent
0bc77a3baf
commit
85aa64780c
@ -1,12 +1,12 @@
|
||||
# this is meant to make existing build instructions work with waf
|
||||
|
||||
all:
|
||||
@cd ../../ && modules/waf/waf-light configure --board linux --debug --disable-scripting
|
||||
@cd ../../ && modules/waf/waf-light configure --board sitl --debug --disable-scripting
|
||||
@cd ../../ && modules/waf/waf-light --target tools/Replay
|
||||
@cp ../../build/linux/tools/Replay Replay.elf
|
||||
@cp ../../build/sitl/tools/Replay Replay.elf
|
||||
@echo Built Replay.elf
|
||||
|
||||
clean:
|
||||
@cd ../../ && modules/waf/waf-light configure --board linux clean
|
||||
@cd ../../ && modules/waf/waf-light configure --board sitl clean
|
||||
|
||||
linux-debug: all
|
||||
|
@ -83,10 +83,11 @@ const AP_Param::Info ReplayVehicle::var_info[] = {
|
||||
|
||||
void ReplayVehicle::load_parameters(void)
|
||||
{
|
||||
unlink("Replay.stg");
|
||||
if (!AP_Param::check_var_info()) {
|
||||
AP_HAL::panic("Bad parameter table");
|
||||
}
|
||||
StorageManager::erase();
|
||||
AP_Param::erase_all();
|
||||
// Load all auto-loaded EEPROM variables - also registers thread
|
||||
// which saves parameters, which Compass now does in its init() routine
|
||||
AP_Param::load_all();
|
||||
@ -184,28 +185,35 @@ void Replay::setup()
|
||||
|
||||
hal.util->commandline_arguments(argc, argv);
|
||||
|
||||
_parse_command_line(argc, argv);
|
||||
if (argc > 0) {
|
||||
_parse_command_line(argc, argv);
|
||||
}
|
||||
|
||||
_vehicle.setup();
|
||||
|
||||
set_user_parameters();
|
||||
}
|
||||
|
||||
void Replay::loop()
|
||||
{
|
||||
if (filename == nullptr) {
|
||||
::printf("You must supply a log filename\n");
|
||||
exit(1);
|
||||
}
|
||||
// LogReader reader = LogReader(log_structure);
|
||||
if (!reader.open_log(filename)) {
|
||||
::fprintf(stderr, "open(%s): %m\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
while (reader.update()) {
|
||||
}
|
||||
}
|
||||
|
||||
void Replay::loop()
|
||||
{
|
||||
if (!reader.update()) {
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
||||
// If we don't tear down the threads then they continue to access
|
||||
// global state during object destruction.
|
||||
((Linux::Scheduler*)hal.scheduler)->teardown();
|
||||
|
||||
exit(0);
|
||||
((Linux::Scheduler*)hal.scheduler)->teardown();
|
||||
#endif
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -4,9 +4,6 @@
|
||||
import boards
|
||||
|
||||
def build(bld):
|
||||
if not isinstance(bld.get_board(), boards.linux):
|
||||
return
|
||||
|
||||
vehicle = bld.path.name
|
||||
|
||||
bld.ap_stlib(
|
||||
|
Loading…
Reference in New Issue
Block a user