Skip to content

Commit

Permalink
Fix hardware management service tests
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Nov 17, 2024
1 parent 2af19ea commit faf9c75
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
14 changes: 7 additions & 7 deletions controller_manager/doc/parameters_context.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ hardware_components_initial_state: |
Detailed explanation of each parameter is given below.
The full structure of the map is given in the following example:
.. code-block:: yaml
.. code-block:: yaml
hardware_components_initial_state:
unconfigured:
- "arm1"
- "arm2"
inactive:
- "base3"
hardware_components_initial_state:
unconfigured:
- "arm1"
- "arm2"
inactive:
- "base3"
diagnostics.threshold.controllers.periodicity: |
The ``periodicity`` diagnostics will be published only for the asynchronous controllers, because any affect to the synchronous controllers will be reflected directly in the controller manager's periodicity.
Expand Down
5 changes: 5 additions & 0 deletions controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,11 @@ void ControllerManager::init_resource_manager(const std::string & robot_descript
}
};

if (cm_param_listener_->is_old(*params_))
{
*params_ = cm_param_listener_->get_params();
}

// unconfigured (loaded only)
set_components_to_state(
params_->hardware_components_initial_state.unconfigured,
Expand Down
2 changes: 0 additions & 2 deletions controller_manager/src/controller_manager_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ controller_manager:
type: string_array,
default_value: [],
description: "Defines which hardware components will be only loaded immediately when controller manager is started.",
read_only: true,
validation: {
unique<>: null,
}
Expand All @@ -21,7 +20,6 @@ controller_manager:
type: string_array,
default_value: [],
description: "Defines which hardware components will be configured immediately when controller manager is started.",
read_only: true,
validation: {
unique<>: null,
}
Expand Down
4 changes: 2 additions & 2 deletions controller_manager/test/test_hardware_management_srvs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,18 @@ class TestControllerManagerHWManagementSrvs : public TestControllerManagerSrvs
cm_ = std::make_shared<controller_manager::ControllerManager>(executor_, TEST_CM_NAME);
run_updater_ = false;

SetUpSrvsCMExecutor();
cm_->set_parameter(rclcpp::Parameter(
"hardware_components_initial_state.unconfigured",
std::vector<std::string>({TEST_SYSTEM_HARDWARE_NAME})));
cm_->set_parameter(rclcpp::Parameter(
"hardware_components_initial_state.inactive",
std::vector<std::string>({TEST_SENSOR_HARDWARE_NAME})));

std::this_thread::sleep_for(std::chrono::milliseconds(100));
auto msg = std_msgs::msg::String();
msg.data = ros2_control_test_assets::minimal_robot_urdf;
cm_->robot_description_callback(msg);

SetUpSrvsCMExecutor();
}

void check_component_fileds(
Expand Down

0 comments on commit faf9c75

Please sign in to comment.