Describe the bug
The return value of bool ResourceManager::load_and_initialize_components( const std::string & urdf, const unsigned int update_rate) in the resource manager constructor
ResourceManager::ResourceManager(
const std::string & urdf, rclcpp::node_interfaces::NodeClockInterface::SharedPtr clock_interface,
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger_interface, bool activate_all,
const unsigned int update_rate)
: resource_storage_(std::make_unique<ResourceStorage>(clock_interface, logger_interface))
{
load_and_initialize_components(urdf, update_rate);
...
is ignored.
In consequence, tests like ASSERT_NO_THROW(TestableResourceManager rm(node_, urdf)); in generic system load test are passed, even when e.g. a system plugin could not be loaded in bool load_and_initialize_system(const HardwareInfo & hardware_info).
Only a ROS 2 log message is generated.
To Reproduce
Steps to reproduce the behavior:
- Clone this repo and install rosdeps
- Replace
<plugin>mock_components/GenericSystem</plugin> in the definition of attribute hardware_system_2dof_ with a non existing component, e.g. <plugin>mock_components/Nein</plugin>
- Compile the repo with tests, e.g.
colcon build --packages-up-to hardware_interface --mixin build-testing-on
- Run the test, e.g.
colcon test --packages-select hardware_interface --event-handlers console_cohesion+
- The corresponding test will pass with
OK and a ROS 2 ERROR log is generated
Expected behavior
The constructor should throw and the test should fail if the component plugin could not be loaded.
Test result
7: [==========] Running 22 tests from 1 test suite.
7: [----------] Global test environment set-up.
7: [----------] 22 tests from TestGenericSystem
7: [ RUN ] TestGenericSystem.load_generic_system_2dof
7: [INFO] [1743348257.395870523] [TestGenericSystem.resource_manager]: Loading hardware 'MockHardwareSystem'
7: [ERROR] [1743348257.396073635] [TestGenericSystem.resource_manager]: Caught exception of type : N9pluginlib20LibraryLoadExceptionE while loading hardware: According to the loaded plugin descriptions the class mock_components/Nein with base class type hardware_interface::SystemInterface does not exist. Declared types are mock_components/GenericSystem test_hardware_components/TestSystemCommandModes test_hardware_components/TestTwoJointSystem
7: [ OK ] TestGenericSystem.load_generic_system_2dof (22 ms)
...
Environment:
- Docker test environment
docker run --rm -it --network host ros:rolling bash
- Version Rolling / Jazzy
Describe the bug
The return value of
bool ResourceManager::load_and_initialize_components( const std::string & urdf, const unsigned int update_rate)in the resource manager constructoris ignored.
In consequence, tests like
ASSERT_NO_THROW(TestableResourceManager rm(node_, urdf));in generic system load test are passed, even when e.g. a system plugin could not be loaded inbool load_and_initialize_system(const HardwareInfo & hardware_info).Only a ROS 2 log message is generated.
To Reproduce
Steps to reproduce the behavior:
<plugin>mock_components/GenericSystem</plugin>in the definition of attributehardware_system_2dof_with a non existing component, e.g.<plugin>mock_components/Nein</plugin>colcon build --packages-up-to hardware_interface --mixin build-testing-oncolcon test --packages-select hardware_interface --event-handlers console_cohesion+OKand a ROS 2ERRORlog is generatedExpected behavior
The constructor should throw and the test should fail if the component plugin could not be loaded.
Test result
Environment:
docker run --rm -it --network host ros:rolling bash