Skip to content

Commit 5122c31

Browse files
authored
NEW PR: Add component_container for EventsExecutor (#2885)
* Add component_container for EventsExecutor Signed-off-by: Mihir Rao <[email protected]> * Fix build error Signed-off-by: Mihir Rao <[email protected]> --------- Signed-off-by: Mihir Rao <[email protected]>
1 parent e6577c6 commit 5122c31

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

rclcpp_components/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ add_executable(
5656
)
5757
target_link_libraries(component_container component_manager rclcpp::rclcpp)
5858

59+
add_executable(
60+
component_container_event
61+
src/component_container_event.cpp
62+
)
63+
target_link_libraries(component_container_event component_manager rclcpp::rclcpp)
64+
5965
set(node_main_template_install_dir "share/${PROJECT_NAME}")
6066
install(FILES
6167
src/node_main.cpp.in
@@ -145,7 +151,7 @@ install(
145151

146152
# Install executables
147153
install(
148-
TARGETS component_container component_container_mt component_container_isolated
154+
TARGETS component_container component_container_mt component_container_isolated component_container_event
149155
RUNTIME DESTINATION lib/${PROJECT_NAME}
150156
)
151157

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2025 Open Source Robotics Foundation, Inc.Add commentMore actions
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.Add commentMore actions
14+
15+
#include <memory>
16+
17+
#include "rclcpp/rclcpp.hpp"
18+
#include "rclcpp/experimental/executors/events_executor/events_executor.hpp"
19+
20+
#include "rclcpp_components/component_manager.hpp"
21+
22+
int main(int argc, char * argv[])
23+
{
24+
/// Component container with an events executor.
25+
rclcpp::init(argc, argv);
26+
auto exec = std::make_shared<rclcpp::experimental::executors::EventsExecutor>();
27+
auto node = std::make_shared<rclcpp_components::ComponentManager>(exec);
28+
exec->add_node(node);
29+
exec->spin();
30+
}

0 commit comments

Comments
 (0)