Skip to content

Commit 683c9f6

Browse files
Merge branch 'master' into remove_mimic_legacy
2 parents 1f4b932 + 02b20d2 commit 683c9f6

File tree

47 files changed

+1198
-2837
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1198
-2837
lines changed

.github/workflows/rosdoc2.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: rosdoc2
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- ros2_control/doc/**
8+
- ros2_control/rosdoc2.yaml
9+
- ros2_control/package.xml
10+
11+
12+
jobs:
13+
check:
14+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-rosdoc2.yml@master

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ repos:
2626
- id: check-symlinks
2727
- id: check-xml
2828
- id: check-yaml
29+
args: ["--allow-multiple-documents"]
2930
- id: debug-statements
3031
- id: end-of-file-fixer
3132
- id: mixed-line-ending
@@ -36,7 +37,7 @@ repos:
3637

3738
# Python hooks
3839
- repo: https://github.com/asottile/pyupgrade
39-
rev: v3.15.2
40+
rev: v3.16.0
4041
hooks:
4142
- id: pyupgrade
4243
args: [--py36-plus]
@@ -55,14 +56,14 @@ repos:
5556
args: ["--line-length=99"]
5657

5758
- repo: https://github.com/pycqa/flake8
58-
rev: 7.0.0
59+
rev: 7.1.0
5960
hooks:
6061
- id: flake8
6162
args: ["--extend-ignore=E501"]
6263

6364
# CPP hooks
6465
- repo: https://github.com/pre-commit/mirrors-clang-format
65-
rev: v18.1.5
66+
rev: v18.1.8
6667
hooks:
6768
- id: clang-format
6869
args: ['-fallback-style=none', '-i']
@@ -132,7 +133,7 @@ repos:
132133
exclude: CHANGELOG\.rst|\.(svg|pyc|drawio)$
133134

134135
- repo: https://github.com/python-jsonschema/check-jsonschema
135-
rev: 0.28.4
136+
rev: 0.28.6
136137
hooks:
137138
- id: check-github-workflows
138139
args: ["--verbose"]

controller_interface/CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Changelog for package controller_interface
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
4.12.0 (2024-07-01)
6+
-------------------
7+
58
4.11.0 (2024-05-14)
69
-------------------
710
* Fix dependencies for source build (`#1533 <https://github.com/ros-controls/ros2_control/issues/1533>`_)

controller_interface/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="2">
44
<name>controller_interface</name>
5-
<version>4.11.0</version>
5+
<version>4.12.0</version>
66
<description>Description of controller_interface</description>
77
<maintainer email="[email protected]">Bence Magyar</maintainer>
88
<maintainer email="[email protected]">Denis Štogl</maintainer>

controller_manager/CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
Changelog for package controller_manager
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
4.12.0 (2024-07-01)
6+
-------------------
7+
* [rqt_controller_manager] Add hardware components (`#1455 <https://github.com/ros-controls/ros2_control/issues/1455>`_)
8+
* [RM] Rename `load_urdf` method to `load_and_initialize_components` and add error handling there to avoid stack crashing when error happens. (`#1354 <https://github.com/ros-controls/ros2_control/issues/1354>`_)
9+
* Fix update `period` for the first update after activation (`#1551 <https://github.com/ros-controls/ros2_control/issues/1551>`_)
10+
* Bump version of pre-commit hooks (`#1556 <https://github.com/ros-controls/ros2_control/issues/1556>`_)
11+
* Contributors: Christoph Fröhlich, Dr. Denis, github-actions[bot]
12+
513
4.11.0 (2024-05-14)
614
-------------------
715
* Add find_package for ament_cmake_gen_version_h (`#1534 <https://github.com/ros-controls/ros2_control/issues/1534>`_)
Loading

controller_manager/doc/userdoc.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,21 @@ There are two scripts to interact with controller manager from launch files:
184184
-c CONTROLLER_MANAGER, --controller-manager CONTROLLER_MANAGER
185185
Name of the controller manager ROS node
186186
187+
rqt_controller_manager
188+
----------------------
189+
A GUI tool to interact with the controller manager services to be able to switch the lifecycle states of the controllers as well as the hardware components.
190+
191+
.. image:: images/rqt_controller_manager.png
192+
193+
It can be launched independently using the following command or as rqt plugin.
194+
195+
.. code-block:: console
196+
197+
ros2 run rqt_controller_manager rqt_controller_manager
198+
199+
* Double-click on a controller or hardware component to show the additional info.
200+
* Right-click on a controller or hardware component to show a context menu with options for lifecycle management.
201+
187202
Using the Controller Manager in a Process
188203
-----------------------------------------
189204

controller_manager/include/controller_manager/controller_manager.hpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,24 @@ class ControllerManager : public rclcpp::Node
193193
// the executor (see issue #260).
194194
// rclcpp::CallbackGroup::SharedPtr deterministic_callback_group_;
195195

196-
// Per controller update rate support
196+
/// Interface for external components to check if Resource Manager is initialized.
197+
/**
198+
* Checks if components in Resource Manager are loaded and initialized.
199+
* \returns true if they are initialized, false otherwise.
200+
*/
201+
CONTROLLER_MANAGER_PUBLIC
202+
bool is_resource_manager_initialized() const
203+
{
204+
return resource_manager_ && resource_manager_->are_components_initialized();
205+
}
206+
207+
/// Update rate of the main control loop in the controller manager.
208+
/**
209+
* Update rate of the main control loop in the controller manager.
210+
* The method is used for per-controller update rate support.
211+
*
212+
* \returns update rate of the controller manager.
213+
*/
197214
CONTROLLER_MANAGER_PUBLIC
198215
unsigned int get_update_rate() const;
199216

controller_manager/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="2">
44
<name>controller_manager</name>
5-
<version>4.11.0</version>
5+
<version>4.12.0</version>
66
<description>Description of controller_manager</description>
77
<maintainer email="[email protected]">Bence Magyar</maintainer>
88
<maintainer email="[email protected]">Denis Štogl</maintainer>

controller_manager/src/controller_manager.cpp

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ ControllerManager::ControllerManager(
187187
std::shared_ptr<rclcpp::Executor> executor, const std::string & manager_node_name,
188188
const std::string & node_namespace, const rclcpp::NodeOptions & options)
189189
: rclcpp::Node(manager_node_name, node_namespace, options),
190-
resource_manager_(std::make_unique<hardware_interface::ResourceManager>(
191-
update_rate_, this->get_node_clock_interface())),
190+
resource_manager_(
191+
std::make_unique<hardware_interface::ResourceManager>(this->get_node_clock_interface())),
192192
diagnostics_updater_(this),
193193
executor_(executor),
194194
loader_(std::make_shared<pluginlib::ClassLoader<controller_interface::ControllerInterface>>(
@@ -216,7 +216,13 @@ ControllerManager::ControllerManager(
216216
"[Deprecated] Passing the robot description parameter directly to the control_manager node "
217217
"is deprecated. Use the 'robot_description' topic from 'robot_state_publisher' instead.");
218218
init_resource_manager(robot_description_);
219-
init_services();
219+
if (is_resource_manager_initialized())
220+
{
221+
RCLCPP_WARN(
222+
get_logger(),
223+
"You have to restart the framework when using robot description from parameter!");
224+
init_services();
225+
}
220226
}
221227

222228
diagnostics_updater_.setHardwareID("ros2_control");
@@ -243,7 +249,7 @@ ControllerManager::ControllerManager(
243249
RCLCPP_WARN(get_logger(), "'update_rate' parameter not set, using default value.");
244250
}
245251

246-
if (resource_manager_->is_urdf_already_loaded())
252+
if (is_resource_manager_initialized())
247253
{
248254
init_services();
249255
}
@@ -271,36 +277,32 @@ void ControllerManager::robot_description_callback(const std_msgs::msg::String &
271277
RCLCPP_INFO(get_logger(), "Received robot description from topic.");
272278
RCLCPP_DEBUG(
273279
get_logger(), "'Content of robot description file: %s", robot_description.data.c_str());
274-
// TODO(mamueluth): errors should probably be caught since we don't want controller_manager node
275-
// to die if a non valid urdf is passed. However, should maybe be fine tuned.
276-
try
280+
robot_description_ = robot_description.data;
281+
if (is_resource_manager_initialized())
277282
{
278-
robot_description_ = robot_description.data;
279-
if (resource_manager_->is_urdf_already_loaded())
280-
{
281-
RCLCPP_WARN(
282-
get_logger(),
283-
"ResourceManager has already loaded an urdf file. Ignoring attempt to reload a robot "
284-
"description file.");
285-
return;
286-
}
287-
init_resource_manager(robot_description_);
288-
init_services();
283+
RCLCPP_WARN(
284+
get_logger(),
285+
"ResourceManager has already loaded an urdf file. Ignoring attempt to reload a robot "
286+
"description file.");
287+
return;
289288
}
290-
catch (std::runtime_error & e)
289+
init_resource_manager(robot_description_);
290+
if (is_resource_manager_initialized())
291291
{
292-
RCLCPP_ERROR_STREAM(
293-
get_logger(),
294-
"The published robot description file (urdf) seems not to be genuine. The following error "
295-
"was caught:"
296-
<< e.what());
292+
init_services();
297293
}
298294
}
299295

300296
void ControllerManager::init_resource_manager(const std::string & robot_description)
301297
{
302-
// TODO(destogl): manage this when there is an error - CM should not die because URDF is wrong...
303-
resource_manager_->load_urdf(robot_description);
298+
if (!resource_manager_->load_and_initialize_components(robot_description, update_rate_))
299+
{
300+
RCLCPP_WARN(
301+
get_logger(),
302+
"Could not load and initialize hardware. Please check previous output for more details. "
303+
"After you have corrected your URDF, try to publish robot description again.");
304+
return;
305+
}
304306

305307
// Get all components and if they are not defined in parameters activate them automatically
306308
auto components_to_activate = resource_manager_->get_components_status();

0 commit comments

Comments
 (0)