diff --git a/controller_manager/doc/userdoc.rst b/controller_manager/doc/userdoc.rst index 16d065f7c0..a05f6a3afc 100644 --- a/controller_manager/doc/userdoc.rst +++ b/controller_manager/doc/userdoc.rst @@ -49,17 +49,12 @@ hardware_components_initial_state .. code-block:: yaml hardware_components_initial_state: - not_loaded: - - "gripper1" unconfigured: - "arm1" - "arm2" inactive: - "base3" -hardware_components_initial_state.not_loaded (optional; list; default: empty) - Defines which hardware components (pluings) should not be loaded activated when controller manager is started. - hardware_components_initial_state.unconfigured (optional; list; default: empty) Defines which hardware components will be only loaded immediately when controller manager is started. diff --git a/controller_manager/src/controller_manager.cpp b/controller_manager/src/controller_manager.cpp index dcecc3d8dd..6b9d9fe3ec 100644 --- a/controller_manager/src/controller_manager.cpp +++ b/controller_manager/src/controller_manager.cpp @@ -209,46 +209,22 @@ void ControllerManager::init_resource_manager(const std::string & robot_descript { if (components_to_activate.find(component) == components_to_activate.end()) { - if (state.id() == State::PRIMARY_STATE_UNKNOWN) - { - RCLCPP_WARN( - get_logger(), - "Hardware component '%s' is unknown, but defined to not be initial loaded. " - "Please check the parameters of Controller Manager.", - component.c_str()); - } - else - { - RCLCPP_WARN( - get_logger(), "Hardware component '%s' is unknown, therefore not set in '%s' state.", - component.c_str(), state.label().c_str()); - } + RCLCPP_WARN( + get_logger(), "Hardware component '%s' is unknown, therefore not set in '%s' state.", + component.c_str(), state.label().c_str()); } else { - // if state is not set then component should not be loaded - if (state.id() == State::PRIMARY_STATE_UNKNOWN) - { - RCLCPP_INFO( - get_logger(), "Known component '%s' will not be loaded.", component.c_str()); - } - else - { - RCLCPP_INFO( - get_logger(), "Setting component '%s' to '%s' state.", component.c_str(), - state.label().c_str()); - resource_manager_->set_component_state(component, state); - } + RCLCPP_INFO( + get_logger(), "Setting component '%s' to '%s' state.", component.c_str(), + state.label().c_str()); + resource_manager_->set_component_state(component, state); components_to_activate.erase(component); } } } }; - // not loaded - set_components_to_state( - "hardware_components_initial_state.not_loaded", rclcpp_lifecycle::State()); - // unconfigured (loaded only) set_components_to_state( "hardware_components_initial_state.unconfigured", diff --git a/controller_manager/test/test_hardware_management_srvs.cpp b/controller_manager/test/test_hardware_management_srvs.cpp index c3ea0219c6..0fc7a2f27e 100644 --- a/controller_manager/test/test_hardware_management_srvs.cpp +++ b/controller_manager/test/test_hardware_management_srvs.cpp @@ -359,66 +359,6 @@ TEST_F(TestControllerManagerHWManagementSrvs, selective_activate_deactivate_comp })); } -class TestControllerManagerHWManagementSrvsNotLoaded : public TestControllerManagerHWManagementSrvs -{ -public: - void SetUp() override - { - executor_ = std::make_shared(); - cm_ = std::make_shared( - std::make_unique(), executor_, TEST_CM_NAME); - run_updater_ = false; - - cm_->set_parameter( - rclcpp::Parameter("robot_description", ros2_control_test_assets::minimal_robot_urdf)); - cm_->set_parameter(rclcpp::Parameter( - "hardware_components_initial_state.not_loaded", - std::vector({TEST_SYSTEM_HARDWARE_NAME}))); - cm_->set_parameter(rclcpp::Parameter( - "hardware_components_initial_state.inactive", - std::vector({TEST_SENSOR_HARDWARE_NAME, TEST_ACTUATOR_HARDWARE_NAME}))); - - std::string robot_description = ""; - cm_->get_parameter("robot_description", robot_description); - if (robot_description.empty()) - { - throw std::runtime_error( - "Unable to initialize resource manager, no robot description found."); - } - - cm_->init_resource_manager(robot_description); - - SetUpSrvsCMExecutor(); - } -}; - -TEST_F(TestControllerManagerHWManagementSrvsNotLoaded, test_component_not_loaded) -{ - // Default status after start: - // checks if "configure_components_on_start" and "activate_components_on_start" are correctly read - - // there is not system loaded therefore test should not break having only two members for checking - // results - list_hardware_components_and_check( - // actuator, sensor, system - std::vector( - {LFC_STATE::PRIMARY_STATE_INACTIVE, LFC_STATE::PRIMARY_STATE_INACTIVE, - LFC_STATE::PRIMARY_STATE_UNKNOWN}), - std::vector({INACTIVE, INACTIVE, UNKNOWN}), - std::vector>>({ - // is available - {{true, true}, {true, true, true}}, // actuator - {{}, {true}}, // sensor - {{false, false, false, false}, {false, false, false, false, false, false, false}}, // system - }), - std::vector>>({ - // is claimed - {{false, false}, {false, false, false}}, // actuator - {{}, {false}}, // sensor - {{false, false, false, false}, {false, false, false, false, false, false, false}}, // system - })); -} - class TestControllerManagerHWManagementSrvsWithoutParams : public TestControllerManagerHWManagementSrvs {