From c9f6ab343ce1acd8e192c2d5425ed5b3218fbddb Mon Sep 17 00:00:00 2001 From: Ilia-Loginov Date: Wed, 27 Nov 2024 13:16:17 +0400 Subject: [PATCH] On branch update_hitl_ip_setup Updated IPs of FC for model_hitl.sdf files in Tools/simulator/gz/models Adjust delays for improved reliability for MAVSDK testing --- Tools/simulation/gz/hitl_run.sh | 2 +- Tools/simulation/gz/models/ssrc_holybro_x500/model_hitl.sdf | 3 ++- Tools/simulation/gz/models/ssrc_skywalker_x8/model_hitl.sdf | 3 ++- Tools/simulation/gz/models/ssrc_standard_vtol/model_hitl.sdf | 3 ++- Tools/simulation/gz/models/x500/model_hitl.sdf | 1 + test/mavsdk_tests/mavsdk_preparing.cpp | 4 ++++ test/mavsdk_tests/mavsdk_test_runner.py | 1 - test/mavsdk_tests/process_helper.py | 4 ++-- 8 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Tools/simulation/gz/hitl_run.sh b/Tools/simulation/gz/hitl_run.sh index 38349bf47f90..5d0f8b8ca702 100755 --- a/Tools/simulation/gz/hitl_run.sh +++ b/Tools/simulation/gz/hitl_run.sh @@ -1,7 +1,7 @@ #!/bin/bash #example for run -#./Tools/simulation/gz/hitl_run.sh x500/model_hitl.sdf +#./Tools/simulation/gz/hitl_run.sh ssrc_holybro_x500/model_hitl.sdf MODEL_PATH=$1 diff --git a/Tools/simulation/gz/models/ssrc_holybro_x500/model_hitl.sdf b/Tools/simulation/gz/models/ssrc_holybro_x500/model_hitl.sdf index 28e4783bd37d..7c07a71b1002 100644 --- a/Tools/simulation/gz/models/ssrc_holybro_x500/model_hitl.sdf +++ b/Tools/simulation/gz/models/ssrc_holybro_x500/model_hitl.sdf @@ -7,8 +7,9 @@ /link/base_link/sensor/imu_sensor/imu + /link/base_link/sensor/navsat_sensor/navsat /pose/info - 192.168.200.101 + 192.168.202.1 14542 14543 4560 diff --git a/Tools/simulation/gz/models/ssrc_skywalker_x8/model_hitl.sdf b/Tools/simulation/gz/models/ssrc_skywalker_x8/model_hitl.sdf index e22146137142..e6618e3d28fa 100644 --- a/Tools/simulation/gz/models/ssrc_skywalker_x8/model_hitl.sdf +++ b/Tools/simulation/gz/models/ssrc_skywalker_x8/model_hitl.sdf @@ -7,8 +7,9 @@ /link/base_link/sensor/imu_sensor/imu + /link/base_link/sensor/navsat_sensor/navsat /pose/info - 192.168.200.101 + 192.168.202.1 14542 14543 4560 diff --git a/Tools/simulation/gz/models/ssrc_standard_vtol/model_hitl.sdf b/Tools/simulation/gz/models/ssrc_standard_vtol/model_hitl.sdf index 119635258a79..d7e19510d972 100644 --- a/Tools/simulation/gz/models/ssrc_standard_vtol/model_hitl.sdf +++ b/Tools/simulation/gz/models/ssrc_standard_vtol/model_hitl.sdf @@ -7,8 +7,9 @@ /link/base_link/sensor/imu_sensor/imu + /link/base_link/sensor/navsat_sensor/navsat /pose/info - 192.168.200.101 + 192.168.202.1 14542 14543 4560 diff --git a/Tools/simulation/gz/models/x500/model_hitl.sdf b/Tools/simulation/gz/models/x500/model_hitl.sdf index b4f16f6f38ad..cb41d9938b07 100644 --- a/Tools/simulation/gz/models/x500/model_hitl.sdf +++ b/Tools/simulation/gz/models/x500/model_hitl.sdf @@ -7,6 +7,7 @@ /link/base_link/sensor/imu_sensor/imu + /link/base_link/sensor/navsat_sensor/navsat /pose/info 192.168.0.3 14542 diff --git a/test/mavsdk_tests/mavsdk_preparing.cpp b/test/mavsdk_tests/mavsdk_preparing.cpp index 447bc3588d12..f42d81ad2d66 100644 --- a/test/mavsdk_tests/mavsdk_preparing.cpp +++ b/test/mavsdk_tests/mavsdk_preparing.cpp @@ -119,6 +119,8 @@ int main(int argc, char **argv) if (command_set_param == command) { //TODO: For some reason when we set the new value it sometimes takes several attempts to change a parameter. + //The reason is the bug of mavsdk lib. + //When we set one parameter many times, sometimes the lib sends not the new but the previous value. int attempt = 1; const int max_attemp = 5; const auto param_name = "SYS_AUTOSTART"; @@ -137,6 +139,8 @@ int main(int argc, char **argv) auto res = param.get_param_int(param_name); if (res.first == Param::Result::Success && res.second == param_value) { + //For some reason, if we reboot device immediately after changing of parameter, it will not be saved. + std::this_thread::sleep_for(3s); break; } diff --git a/test/mavsdk_tests/mavsdk_test_runner.py b/test/mavsdk_tests/mavsdk_test_runner.py index 5b3ca4ac2d39..3d2078070b22 100755 --- a/test/mavsdk_tests/mavsdk_test_runner.py +++ b/test/mavsdk_tests/mavsdk_test_runner.py @@ -316,7 +316,6 @@ def reboot_px4(self): if (res): print("The device has successfully rebooted") - time.sleep(15) else: print("Reboot failed") exit(-1) diff --git a/test/mavsdk_tests/process_helper.py b/test/mavsdk_tests/process_helper.py index 22ae29fb5b86..7b92e5f653a8 100644 --- a/test/mavsdk_tests/process_helper.py +++ b/test/mavsdk_tests/process_helper.py @@ -54,9 +54,9 @@ def start(self) -> None: if self.name == "mavsdk_tests": if self.env["HIL_MODE"] == "hitl": - delay = 10 + delay = 30 print("Waiting ", delay, " seconds for connection to be established... ") - time.sleep(10) + time.sleep(delay) print("Running test...") atexit.register(self.stop)