mavros icon indicating copy to clipboard operation
mavros copied to clipboard

Fix resource management in UAS node

Open ugol-1 opened this issue 1 year ago • 1 comments

  • Fixed compiler warnings
  • Removed circular dependencies between UAS node and its plugins => clean node shutdown. The UAS and plugins destructors were never called before.
  • Timely creation and destruction of UAS executor thread => clean node shutdown. Before it was:
    [WARN] [1718579669.490040973] [mavros.uas]: UAS Executor terminated
    terminate called after throwing an instance of 'rclcpp::exceptions::RCLInvalidArgument'
       what():  guard condition implementation is invalid, at ./src/rcl/guard_condition.c:172
    
  • No more "delayed initialization" in UAS
  • Linking to yaml-cpp in a correct way.

ugol-1 avatar Jun 16 '24 23:06 ugol-1

UAS test fails. Jazzy's uncrustify also unhappy.

On the ros2 branch, the UAS test run result looks like following:

$ build/mavros/mavros-uas-test
[==========] Running 2 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 2 tests from TestUAS
[ RUN      ] TestUAS.is_plugin_allowed
[       OK ] TestUAS.is_plugin_allowed (37 ms)
[ RUN      ] TestUAS.add_plugin__route_message__filter
[INFO] [1719053548.105424681] [test_mavros_uas]: Plugin test1 created
[INFO] [1719053548.105817054] [test_mavros_uas]: Plugin test1 initialized
[INFO] [1719053548.105848344] [test_mavros_uas]: Plugin test2 created
[INFO] [1719053548.105885739] [test_mavros_uas]: Plugin test2 initialized
[       OK ] TestUAS.add_plugin__route_message__filter (15 ms)
[----------] 2 tests from TestUAS (52 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test suite ran. (52 ms total)
[  PASSED  ] 2 tests.
cannot publish data, at ./src/rmw_publish.cpp:62 during '__function__'
Fail in delete datareader, at ./src/rmw_service.cpp:100 during '__function__'
Segmentation fault (core dumped)

The test executable crashes before most of the tests have a chance to fail. Could you maybe make the tests in the ros2 branch work first #1962 ?

ugol-1 avatar Jun 22 '24 09:06 ugol-1