diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/CHANGELOG.rst b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/CHANGELOG.rst deleted file mode 100644 index e36ce7b..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/CHANGELOG.rst +++ /dev/null @@ -1,304 +0,0 @@ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Changelog for package demo_nodes_cpp -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -0.34.0 (2024-04-26) -------------------- - -0.33.2 (2024-03-28) -------------------- -* A few uncrustify fixes for 0.78. (`#667 `_) -* Allow users to configure the executor for executables in `demo_nodes_cpp` (`#666 `_) -* Update maintainer list in package.xml files (`#665 `_) -* Contributors: Chris Lalancette, Michael Jeronimo, Yadu - -0.33.1 (2024-02-07) -------------------- - -0.33.0 (2024-01-24) -------------------- - -0.32.1 (2023-12-26) -------------------- -* Added extra documentation and clarifications. (`#651 `_) -* Contributors: jrutgeer - -0.32.0 (2023-11-06) -------------------- -* Add in support for both the PMR and custom allocator tutorials. (`#655 `_) -* Replacing old-style C++ allocator with a polymorphic memory resource (PMR) (`#653 `_) -* Contributors: Ali Ashkani Nia, Chris Lalancette - -0.31.1 (2023-09-07) -------------------- -* Remove unnecessary captures in the various demos. (`#647 `_) -* Contributors: Chris Lalancette - -0.31.0 (2023-08-21) -------------------- -* Dramatically speed up the demo_nodes_cpp tests (`#641 `_) -* Switch to using RCLCPP logging macros in the lifecycle package. (`#644 `_) -* Contributors: Chris Lalancette - -0.30.1 (2023-07-11) -------------------- -* failed to call introspection_client (`#643 `_) -* Contributors: Chen Lihui - -0.30.0 (2023-06-12) -------------------- -* Small cleanups to the demos when running through them. (`#639 `_) -* Cleanup demo_nodes_cpp CMake and dependencies (`#638 `_) -* Change the service introspection parameter off value to 'disabled' (`#634 `_) -* Contributors: Chris Lalancette - -0.29.0 (2023-06-07) -------------------- -* Add demos for using logger service (`#611 `_) -* Contributors: Barry Xu - -0.28.1 (2023-05-11) -------------------- - -0.28.0 (2023-04-27) -------------------- - -0.27.0 (2023-04-13) -------------------- -* Change all ROS2 -> ROS 2. (`#610 `_) -* Add matched event demo for rclcpp and rclpy (`#607 `_) -* Contributors: Barry Xu, Chris Lalancette - -0.26.0 (2023-04-11) -------------------- -* Fix the set_parameters_callback example program. (`#608 `_) -* [demo_nodes_cpp] Add YAML launch demos for topics (`#605 `_) -* update launch file name format to match documentation (`#588 `_) -* Contributors: Chris Lalancette, Damien LaRocque, Patrick Wspanialy - -0.25.0 (2023-03-01) -------------------- -* Service introspection (`#602 `_) - * Add in a rclcpp and rclpy demo of introspection. -* Contributors: Chris Lalancette - -0.24.1 (2023-02-24) -------------------- -* Added README.md for demo_cpp_nodes (`#599 `_) -* Contributors: Gary Bey - -0.24.0 (2023-02-14) -------------------- -* Update the demos to C++17. (`#594 `_) -* [rolling] Update maintainers - 2022-11-07 (`#589 `_) -* Contributors: Audrow Nash, Chris Lalancette - -0.23.0 (2022-11-02) -------------------- -* Demo for pre and post set parameter callback support (`#565 `_) - * local parameter callback support -* Contributors: Deepanshu Bansal - -0.22.0 (2022-09-13) -------------------- -* counter starts from 1, not 2. (`#562 `_) -* add a demo of content filter listener (`#557 `_) -* Contributors: Chen Lihui, Tomoya Fujita - -0.21.0 (2022-04-29) -------------------- - -0.20.1 (2022-04-08) -------------------- - -0.20.0 (2022-03-01) -------------------- - -0.19.0 (2022-01-14) -------------------- - -0.18.0 (2021-12-17) -------------------- -* Update maintainers to Audrow Nash and Michael Jeronimo (`#543 `_) -* Add how to fix the most vexing parse problem (`#541 `_) - * use uniform initialization -* Contributors: Audrow Nash, Tomoya Fujita - -0.17.0 (2021-10-18) -------------------- -* Fixing deprecated subscriber callback warnings (`#532 `_) -* Contributors: Abrar Rahman Protyasha - -0.16.0 (2021-08-11) -------------------- -* Update talker_loaned_message.cpp (`#518 `_) -* Contributors: Zongbao Feng - -0.15.0 (2021-05-14) -------------------- -* Revert "Use sizeof(char) in place for sizeof(void) (`#515 `_)" (`#516 `_) -* change how serialized message works with subscription (`#497 `_) -* Use sizeof(char) in place for sizeof(void) (`#515 `_) -* Fix small print issue in allocator tutorial. (`#509 `_) -* Contributors: Chris Lalancette, Michel Hidalgo, William Woodall - -0.14.2 (2021-04-26) -------------------- -* Small fixes for even_parameters_node. (`#500 `_) -* Contributors: Chris Lalancette - -0.14.1 (2021-04-19) -------------------- - -0.14.0 (2021-04-06) -------------------- -* change ParameterEventHandler to take events as const ref instead of shared pointer (`#494 `_) -* Fix integer type in RCLCPP\_* macro printf. (`#492 `_) -* Contributors: Chris Lalancette, William Woodall - -0.13.0 (2021-03-25) -------------------- -* Add a demo for the new ParameterEventHandler class (`#486 `_) -* Contributors: Michael Jeronimo - -0.12.1 (2021-03-18) -------------------- -* Filter qos overrides in paramter events demos (`#491 `_) -* Update code now that parameter types are static by default (`#487 `_) -* Contributors: Ivan Santiago Paunovic - -0.12.0 (2021-01-25) -------------------- -* Update logging macros (`#476 `_) -* Contributors: Audrow Nash - -0.11.0 (2020-12-10) -------------------- -* Make sure to wait for the service before declaring events. (`#473 `_) -* Update the package.xml files with the latest Open Robotics maintainers (`#466 `_) -* Contributors: Chris Lalancette, Michael Jeronimo - -0.10.1 (2020-09-21) -------------------- - -0.10.0 (2020-06-17) -------------------- - -0.9.3 (2020-06-01) ------------------- - -0.9.2 (2020-05-26) ------------------- - -0.9.1 (2020-05-12) ------------------- - -0.9.0 (2020-04-30) ------------------- -* avoid new deprecations (`#442 `_) -* use serialized message (`#441 `_) -* Replace deprecated launch_ros usage (`#437 `_) -* code style only: wrap after open parenthesis if not in one line (`#429 `_) -* Use `spin_until_future_complete` instead of `spin_some` in parameters_event demo (`#427 `_) -* change the logging demo test for updated console format (`#421 `_) -* [demo_nodes_cpp] Add XML launch demos (`#419 `_) -* Contributors: Dirk Thomas, Ivan Santiago Paunovic, Jacob Perron, Karsten Knese, Steven Macenski, William Woodall, Yutaka Kondo - -0.8.4 (2019-11-19) ------------------- -* Add in a more helpful usage message to allocator_tutorial. (`#409 `_) -* Contributors: Chris Lalancette - -0.8.3 (2019-11-11) ------------------- - -0.8.2 (2019-11-08) ------------------- -* Don't redefine add_dependencies (`#408 `_) -* Contributors: Dan Rose - -0.8.1 (2019-10-23) ------------------- -* rename return functions for loaned messages (`#403 `_) -* Replace ready_fn with ReadyToTest action (`#404 `_) -* remove intra-process manager impl (`#382 `_) -* zero copy api (`#394 `_) -* Remove command line parsing from C++ demos (`#401 `_) -* Need to specify NodeOption explicitly to allow declaration. (`#389 `_) -* Contributors: Alberto Soragna, Jacob Perron, Karsten Knese, Peter Baughman, tomoya - -0.8.0 (2019-09-26) ------------------- -* Adding visibility macros to demos (`#381 `_) -* Demos using composition (`#375 `_) -* Contributors: Siddharth Kucheria - -0.7.6 (2019-05-30) ------------------- - -0.7.5 (2019-05-29) ------------------- -* Update to use new parameter option names (`#355 `_) -* Contributors: William Woodall - -0.7.4 (2019-05-20) ------------------- - -0.7.3 (2019-05-10) ------------------- -* Added the ``parameter_blackboard`` demo to ``demo_nodes_cpp`` to make some tutorials easier. (`#333 `_) -* Contributors: William Woodall - -0.7.2 (2019-05-08) ------------------- -* changes to avoid deprecated API's (`#332 `_) -* Corrected publish calls with shared_ptr signature (`#327 `_) -* Migrate launch tests to new launch_testing features & API (`#318 `_) -* Contributors: Michel Hidalgo, William Woodall, ivanpauno - -0.7.1 (2019-04-26) ------------------- -* Updated to declare parameters. (`#241 `_) -* Contributors: Shane Loretz - -0.7.0 (2019-04-14) ------------------- -* Moved away from deprecated rclcpp APIs. (`#321 `_) -* Added launch along with launch_testing as test dependencies. (`#313 `_) -* Updated for NodeOptions Node constructor. (`#308 `_) -* Contributors: Emerson Knapp, Michael Carroll, Michel Hidalgo - -0.6.2 (2019-01-15) ------------------- - -0.6.1 (2018-12-13) ------------------- - -0.6.0 (2018-12-07) ------------------- -* Added semicolons to all RCLCPP and RCUTILS macros. (`#278 `_) -* Removed parameter node, all nodes take parameter by default now (`#265 `_) -* Added example of registering custom parameter validation callbacks (`#273 `_) -* Removed imu_listener node (`#272 `_) -* Refined demo_nodes_cpp source codes (`#269 `_) -* Fixed typo in comment (`#268 `_) -* Removed rosidl deps as this package doesnt generate any messages (`#264 `_) -* Fixed no return code for main() in several files (`#266 `_) -* Contributors: Chris Lalancette, Mikael Arguedas, Yutaka Kondo, testkit - -0.5.1 (2018-06-28) ------------------- - -0.5.0 (2018-06-27) ------------------- -* Reduced the publishing of the allocator_tutorial to 100Hz. (`#257 `_) - * Signed-off-by: Chris Lalancette -* Removed the now obsolete ros2param executable, use ``ros2 param`` instead. (`#251 `_) -* Fixed a potiential nullptr dereference issue in ``demo_nodes_cpp``. (`#242 `_) -* Added demo nodes which use the new serialized message typed publishers and subscriptions. (`#185 `_) -* Added a new-style launch file for the talker and listener demo nodes, called ``talker_listener.launch.py``. (`#244 `_) -* Updated launch files to account for the "old launch" getting renamespaced as ``launch`` -> ``launch.legacy``. (`#239 `_) -* Updated to handle refactor of the ``ParameterVariant`` class. (`#237 `_) -* Updated to account for the fact that the ROS Parameter services starts automatically now. (`#236 `_) -* Added some uses of parameter arrays to the ``set_and_get_parameters`` demo. (`#235 `_) -* Contributors: Chris Lalancette, Dirk Thomas, Karsten Knese, Mikael Arguedas, Shane Loretz, William Woodall, cshen diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/CMakeLists-NEW-changes.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/CMakeLists-NEW-changes.txt deleted file mode 100644 index fbd9d8e..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/CMakeLists-NEW-changes.txt +++ /dev/null @@ -1,299 +0,0 @@ -cmake_minimum_required(VERSION 3.12) - -project(demo_nodes_cpp) - -set(RCLCPP_COMPONENTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rclcpp_components) -include_directories(${RCLCPP_COMPONENTS_DIR}) - -# Default to C++17 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 17) - set(CMAKE_CXX_STANDARD_REQUIRED ON) -endif() - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -find_package(ament_cmake REQUIRED) -find_package(example_interfaces REQUIRED) -find_package(rcl REQUIRED) -find_package(rcl_interfaces REQUIRED) -find_package(rclcpp REQUIRED) -find_package(rclcpp_components REQUIRED) -find_package(rcpputils REQUIRED) -find_package(rcutils REQUIRED) -find_package(rmw REQUIRED) -find_package(std_msgs REQUIRED) - -find_package(class_loader REQUIRED) - - -include_directories( - ${rclcpp_INCLUDE_DIRS} - ${class_loader_INCLUDE_DIRS} - ) - - - add_executable(node_main_one_off_timer src/rclcpp_components/node_main_one_off_timer.cpp) - target_link_libraries(node_main_one_off_timer - ${rclcpp_LIBRARIES} - ${class_loader_LIBRARIES} - ) - - install(TARGETS - node_main_one_off_timer - DESTINATION lib/${PROJECT_NAME} - ) - -function(custom_executable subfolder target) - cmake_parse_arguments(ARG "" "" "DEPENDENCIES" ${ARGN}) - add_executable(${target} src/${subfolder}/${target}.cpp) - target_include_directories(${target} PRIVATE - "$" - "$") - target_link_libraries(${target} PRIVATE - ${ARG_DEPENDENCIES} - ) - install(TARGETS ${target} - DESTINATION lib/${PROJECT_NAME}) -endfunction() - -# TODO(clalancette): libc++ 14 (in Ubuntu 22.04) does not support -# Polymorphic memory resources: https://en.cppreference.com/w/cpp/compiler_support/17 -# So we use the old custom allocator clang for now; we can eventually remove this. -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 16.0.0) - set(allocator_file allocator_tutorial_custom) -else() - set(allocator_file allocator_tutorial_pmr) -endif() -add_executable(allocator_tutorial src/topics/${allocator_file}.cpp) -target_include_directories(allocator_tutorial PRIVATE - "$" - "$") -target_link_libraries(allocator_tutorial PRIVATE - rclcpp::rclcpp - ${std_msgs_TARGETS} -) -install(TARGETS allocator_tutorial - DESTINATION lib/${PROJECT_NAME}) - -custom_executable(services add_two_ints_client - DEPENDENCIES ${example_interfaces_TARGETS} rclcpp::rclcpp) - -custom_executable(parameters list_parameters_async - DEPENDENCIES rclcpp::rclcpp) - -custom_executable(parameters parameter_events - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp) - -custom_executable(parameters parameter_event_handler - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp) - -custom_executable(parameters set_and_get_parameters_async - DEPENDENCIES rclcpp::rclcpp) - -custom_executable(events matched_event_detect - DEPENDENCIES rclcpp::rclcpp ${std_msgs_TARGETS}) - -custom_executable(logging use_logger_service - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp ${std_msgs_TARGETS}) - -function(create_demo_library plugin executable) - cmake_parse_arguments(ARG "" "" "FILES;DEPENDENCIES" ${ARGN}) - set(library ${executable}_library) - add_library(${library} SHARED ${ARG_FILES}) - target_compile_definitions(${library} - PRIVATE "DEMO_NODES_CPP_BUILDING_DLL") - target_include_directories(${library} PRIVATE - "$" - "$") - target_link_libraries(${library} PRIVATE - ${ARG_DEPENDENCIES} - ) - install(TARGETS ${library} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin) - set(DEMO_EXECUTOR "rclcpp::executors::SingleThreadedExecutor" CACHE STRING "The executor for the demo nodes") - message(STATUS "Setting executor of ${executable} to ${DEMO_EXECUTOR}") - rclcpp_components_register_node(${library} - PLUGIN ${plugin} - EXECUTABLE ${executable} - EXECUTOR ${DEMO_EXECUTOR}) -endfunction() - -# Timers -create_demo_library("demo_nodes_cpp::OneOffTimerNode" one_off_timer - FILES src/timers/one_off_timer.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component) -create_demo_library("demo_nodes_cpp::ReuseTimerNode" reuse_timer - FILES src/timers/reuse_timer.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component) - -# Parameters -create_demo_library("demo_nodes_cpp::ListParameters" list_parameters - FILES src/parameters/list_parameters.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component) -create_demo_library("demo_nodes_cpp::ParameterBlackboard" parameter_blackboard - FILES src/parameters/parameter_blackboard.cpp - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) -create_demo_library("demo_nodes_cpp::SetAndGetParameters" set_and_get_parameters - FILES src/parameters/set_and_get_parameters.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component) -create_demo_library("demo_nodes_cpp::ParameterEventsAsyncNode" parameter_events_async - FILES src/parameters/parameter_events_async.cpp - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) -create_demo_library("demo_nodes_cpp::EvenParameterNode" even_parameters_node - FILES src/parameters/even_parameters_node.cpp - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) -create_demo_library("demo_nodes_cpp::SetParametersCallback" set_parameters_callback - FILES src/parameters/set_parameters_callback.cpp - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) - -# Services -create_demo_library("demo_nodes_cpp::ServerNode" add_two_ints_server - FILES src/services/add_two_ints_server.cpp - DEPENDENCIES ${example_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) -create_demo_library("demo_nodes_cpp::ClientNode" add_two_ints_client_async - FILES src/services/add_two_ints_client_async.cpp - DEPENDENCIES ${example_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) -create_demo_library("demo_nodes_cpp::IntrospectionServiceNode" introspection_service - FILES src/services/introspection_service.cpp - DEPENDENCIES ${example_interfaces_TARGETS} ${rcl_interfaces_TARGETS} rcl::rcl rclcpp::rclcpp rclcpp_components::component) -create_demo_library("demo_nodes_cpp::IntrospectionClientNode" introspection_client - FILES src/services/introspection_client.cpp - DEPENDENCIES ${example_interfaces_TARGETS} ${rcl_interfaces_TARGETS} rcl::rcl rclcpp::rclcpp rclcpp_components::component) - -# Topics -create_demo_library("demo_nodes_cpp::ContentFilteringPublisher" content_filtering_publisher - FILES src/topics/content_filtering_publisher.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) -create_demo_library("demo_nodes_cpp::ContentFilteringSubscriber" content_filtering_subscriber - FILES src/topics/content_filtering_subscriber.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component rcpputils::rcpputils ${std_msgs_TARGETS}) -create_demo_library("demo_nodes_cpp::Talker" talker - FILES src/topics/talker.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) -create_demo_library("demo_nodes_cpp::LoanedMessageTalker" talker_loaned_message - FILES src/topics/talker_loaned_message.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) -create_demo_library("demo_nodes_cpp::SerializedMessageTalker" talker_serialized_message - FILES src/topics/talker_serialized_message.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) -create_demo_library("demo_nodes_cpp::Listener" listener - FILES src/topics/listener.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) -create_demo_library("demo_nodes_cpp::SerializedMessageListener" listener_serialized_message - FILES src/topics/listener_serialized_message.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) -create_demo_library("demo_nodes_cpp::ListenerBestEffort" listener_best_effort - FILES src/topics/listener_best_effort.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) - -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() - - find_package(ament_cmake_pytest REQUIRED) - find_package(launch_testing_ament_cmake REQUIRED) - find_package(rmw_implementation_cmake REQUIRED) - # Add each test case. Multi-executable tests can be specified in - # semicolon-separated strings, like exe1;exe2. - set(tutorial_tests - "content_filtering_publisher@publish_ms=100:content_filtering_subscriber" - list_parameters_async - list_parameters - parameter_events_async - parameter_events - set_and_get_parameters_async - set_and_get_parameters - matched_event_detect - use_logger_service - "talker:listener" - ) - set(service_tutorial_tests - "add_two_ints_server@one_shot=True:add_two_ints_client" - "add_two_ints_server@one_shot=True:add_two_ints_client_async" - ) - - macro(tests) - set(tutorial_tests_to_test ${tutorial_tests}) - list(APPEND tutorial_tests_to_test ${service_tutorial_tests}) - - foreach(tutorial_test ${tutorial_tests_to_test}) - set(DEMO_NODES_CPP_EXPECTED_OUTPUT "") - set(DEMO_NODES_CPP_EXECUTABLE "") - set(exe_list "") - - # We're expecting each tutorial_test to be of the form: - # - # exe1[@param1=value1@param2=value2][:exe2[@param3=value3@param4=value4]] - # - # That is, you can have one or more executables, and each of those - # executables can be passed zero or more parameters. - # - # Unfortunately, we need to parse this list here in CMake since we need - # to know the executable name so we can generate an absolute path. - - # Convert the colon-separated list we were given to a semi-colon - # separated one so we can iterate over it in CMake. - string(REPLACE ":" ";" exes_and_params "${tutorial_test}") - foreach(exe_and_params ${exes_and_params}) - string(REPLACE "@" ";" params ${exe_and_params}) - # It is expected that the first variable is the executable - list(GET params 0 executable) - list(APPEND DEMO_NODES_CPP_EXPECTED_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/test/${executable}") - list(APPEND exe_list ${executable}) - set(target_file "$") - - # If there is anything left in the list at this time, assume they - # are parameters. - list(LENGTH params list_length) - if(${list_length} GREATER 1) - list(SUBLIST params 1 -1 params_only) - string(JOIN "@" target_file ${target_file} ${params_only}) - endif() - - # This is what will get substituted into test_executables_tutorial.py.in below. - # It looks exactly the same as exes_and_params, with the exception - # that the executable names have been substituted for the absolute paths. - list(APPEND DEMO_NODES_CPP_EXECUTABLE ${target_file}) - endforeach() - string(REPLACE ";" "_" exe_list_underscore "${exe_list}") - configure_file( - test/test_executables_tutorial.py.in - test_${exe_list_underscore}${target_suffix}.py.configured - @ONLY - ) - file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_${exe_list_underscore}${target_suffix}_$.py" - INPUT "${CMAKE_CURRENT_BINARY_DIR}/test_${exe_list_underscore}${target_suffix}.py.configured" - ) - - add_launch_test( - "${CMAKE_CURRENT_BINARY_DIR}/test_${exe_list_underscore}${target_suffix}_$.py" - TARGET test_tutorial_${exe_list_underscore}${target_suffix} - TIMEOUT 60 - ENV - RCL_ASSERT_RMW_ID_MATCHES=${rmw_implementation} - RMW_IMPLEMENTATION=${rmw_implementation} - ) - foreach(executable ${exe_list}) - set_property( - TEST test_tutorial_${exe_list_underscore}${target_suffix} - APPEND PROPERTY DEPENDS ${executable}${target_suffix}) - endforeach() - endforeach() - endmacro() - - call_for_each_rmw_implementation(tests) -endif() - -# Install launch files. -install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME}/ -) - -ament_package() diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/CMakeLists.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/CMakeLists.txt deleted file mode 100644 index 0c778e4..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/CMakeLists.txt +++ /dev/null @@ -1,277 +0,0 @@ -cmake_minimum_required(VERSION 3.12) - -project(demo_nodes_cpp) - -# Default to C++17 -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 17) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - endif() - - if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) - endif() - - find_package(ament_cmake REQUIRED) - find_package(example_interfaces REQUIRED) - find_package(rcl REQUIRED) - find_package(rcl_interfaces REQUIRED) - find_package(rclcpp REQUIRED) - find_package(rclcpp_components REQUIRED) - find_package(rcpputils REQUIRED) - find_package(rcutils REQUIRED) - find_package(rmw REQUIRED) - find_package(std_msgs REQUIRED) - - function(custom_executable subfolder target) - cmake_parse_arguments(ARG "" "" "DEPENDENCIES" ${ARGN}) - add_executable(${target} src/${subfolder}/${target}.cpp) - target_include_directories(${target} PRIVATE - "$" - "$") - target_link_libraries(${target} PRIVATE - ${ARG_DEPENDENCIES} - ) - install(TARGETS ${target} - DESTINATION lib/${PROJECT_NAME}) - endfunction() - - # TODO(clalancette): libc++ 14 (in Ubuntu 22.04) does not support - # Polymorphic memory resources: https://en.cppreference.com/w/cpp/compiler_support/17 - # So we use the old custom allocator clang for now; we can eventually remove this. - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 16.0.0) - set(allocator_file allocator_tutorial_custom) - else() - set(allocator_file allocator_tutorial_pmr) - endif() - add_executable(allocator_tutorial src/topics/${allocator_file}.cpp) - target_include_directories(allocator_tutorial PRIVATE - "$" - "$") - target_link_libraries(allocator_tutorial PRIVATE - rclcpp::rclcpp - ${std_msgs_TARGETS} - ) - install(TARGETS allocator_tutorial - DESTINATION lib/${PROJECT_NAME}) - - custom_executable(services add_two_ints_client - DEPENDENCIES ${example_interfaces_TARGETS} rclcpp::rclcpp) - - custom_executable(parameters list_parameters_async - DEPENDENCIES rclcpp::rclcpp) - - custom_executable(parameters parameter_events - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp) - - custom_executable(parameters parameter_event_handler - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp) - - custom_executable(parameters set_and_get_parameters_async - DEPENDENCIES rclcpp::rclcpp) - - custom_executable(events matched_event_detect - DEPENDENCIES rclcpp::rclcpp ${std_msgs_TARGETS}) - - custom_executable(logging use_logger_service - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp ${std_msgs_TARGETS}) - - function(create_demo_library plugin executable) - cmake_parse_arguments(ARG "" "" "FILES;DEPENDENCIES" ${ARGN}) - set(library ${executable}_library) - add_library(${library} SHARED ${ARG_FILES}) - target_compile_definitions(${library} - PRIVATE "DEMO_NODES_CPP_BUILDING_DLL") - target_include_directories(${library} PRIVATE - "$" - "$") - target_link_libraries(${library} PRIVATE - ${ARG_DEPENDENCIES} - ) - install(TARGETS ${library} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin) - set(DEMO_EXECUTOR "rclcpp::executors::SingleThreadedExecutor" CACHE STRING "The executor for the demo nodes") - message(STATUS "Setting executor of ${executable} to ${DEMO_EXECUTOR}") - rclcpp_components_register_node(${library} - PLUGIN ${plugin} - EXECUTABLE ${executable} - EXECUTOR ${DEMO_EXECUTOR}) - endfunction() - - # Timers - create_demo_library("demo_nodes_cpp::OneOffTimerNode" one_off_timer - FILES src/timers/one_off_timer.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component) - create_demo_library("demo_nodes_cpp::ReuseTimerNode" reuse_timer - FILES src/timers/reuse_timer.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component) - - # Parameters - create_demo_library("demo_nodes_cpp::ListParameters" list_parameters - FILES src/parameters/list_parameters.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component) - create_demo_library("demo_nodes_cpp::ParameterBlackboard" parameter_blackboard - FILES src/parameters/parameter_blackboard.cpp - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) - create_demo_library("demo_nodes_cpp::SetAndGetParameters" set_and_get_parameters - FILES src/parameters/set_and_get_parameters.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component) - create_demo_library("demo_nodes_cpp::ParameterEventsAsyncNode" parameter_events_async - FILES src/parameters/parameter_events_async.cpp - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) - create_demo_library("demo_nodes_cpp::EvenParameterNode" even_parameters_node - FILES src/parameters/even_parameters_node.cpp - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) - create_demo_library("demo_nodes_cpp::SetParametersCallback" set_parameters_callback - FILES src/parameters/set_parameters_callback.cpp - DEPENDENCIES ${rcl_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) - - # Services - create_demo_library("demo_nodes_cpp::ServerNode" add_two_ints_server - FILES src/services/add_two_ints_server.cpp - DEPENDENCIES ${example_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) - create_demo_library("demo_nodes_cpp::ClientNode" add_two_ints_client_async - FILES src/services/add_two_ints_client_async.cpp - DEPENDENCIES ${example_interfaces_TARGETS} rclcpp::rclcpp rclcpp_components::component) - create_demo_library("demo_nodes_cpp::IntrospectionServiceNode" introspection_service - FILES src/services/introspection_service.cpp - DEPENDENCIES ${example_interfaces_TARGETS} ${rcl_interfaces_TARGETS} rcl::rcl rclcpp::rclcpp rclcpp_components::component) - create_demo_library("demo_nodes_cpp::IntrospectionClientNode" introspection_client - FILES src/services/introspection_client.cpp - DEPENDENCIES ${example_interfaces_TARGETS} ${rcl_interfaces_TARGETS} rcl::rcl rclcpp::rclcpp rclcpp_components::component) - - # Topics - create_demo_library("demo_nodes_cpp::ContentFilteringPublisher" content_filtering_publisher - FILES src/topics/content_filtering_publisher.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) - create_demo_library("demo_nodes_cpp::ContentFilteringSubscriber" content_filtering_subscriber - FILES src/topics/content_filtering_subscriber.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component rcpputils::rcpputils ${std_msgs_TARGETS}) - create_demo_library("demo_nodes_cpp::Talker" talker - FILES src/topics/talker.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) - create_demo_library("demo_nodes_cpp::LoanedMessageTalker" talker_loaned_message - FILES src/topics/talker_loaned_message.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) - create_demo_library("demo_nodes_cpp::SerializedMessageTalker" talker_serialized_message - FILES src/topics/talker_serialized_message.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) - create_demo_library("demo_nodes_cpp::Listener" listener - FILES src/topics/listener.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) - create_demo_library("demo_nodes_cpp::SerializedMessageListener" listener_serialized_message - FILES src/topics/listener_serialized_message.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) - create_demo_library("demo_nodes_cpp::ListenerBestEffort" listener_best_effort - FILES src/topics/listener_best_effort.cpp - DEPENDENCIES rclcpp::rclcpp rclcpp_components::component ${std_msgs_TARGETS}) - - if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() - - find_package(ament_cmake_pytest REQUIRED) - find_package(launch_testing_ament_cmake REQUIRED) - find_package(rmw_implementation_cmake REQUIRED) - # Add each test case. Multi-executable tests can be specified in - # semicolon-separated strings, like exe1;exe2. - set(tutorial_tests - "content_filtering_publisher@publish_ms=100:content_filtering_subscriber" - list_parameters_async - list_parameters - parameter_events_async - parameter_events - set_and_get_parameters_async - set_and_get_parameters - matched_event_detect - use_logger_service - "talker:listener" - ) - set(service_tutorial_tests - "add_two_ints_server@one_shot=True:add_two_ints_client" - "add_two_ints_server@one_shot=True:add_two_ints_client_async" - ) - - macro(tests) - set(tutorial_tests_to_test ${tutorial_tests}) - list(APPEND tutorial_tests_to_test ${service_tutorial_tests}) - - foreach(tutorial_test ${tutorial_tests_to_test}) - set(DEMO_NODES_CPP_EXPECTED_OUTPUT "") - set(DEMO_NODES_CPP_EXECUTABLE "") - set(exe_list "") - - # We're expecting each tutorial_test to be of the form: - # - # exe1[@param1=value1@param2=value2][:exe2[@param3=value3@param4=value4]] - # - # That is, you can have one or more executables, and each of those - # executables can be passed zero or more parameters. - # - # Unfortunately, we need to parse this list here in CMake since we need - # to know the executable name so we can generate an absolute path. - - # Convert the colon-separated list we were given to a semi-colon - # separated one so we can iterate over it in CMake. - string(REPLACE ":" ";" exes_and_params "${tutorial_test}") - foreach(exe_and_params ${exes_and_params}) - string(REPLACE "@" ";" params ${exe_and_params}) - # It is expected that the first variable is the executable - list(GET params 0 executable) - list(APPEND DEMO_NODES_CPP_EXPECTED_OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/test/${executable}") - list(APPEND exe_list ${executable}) - set(target_file "$") - - # If there is anything left in the list at this time, assume they - # are parameters. - list(LENGTH params list_length) - if(${list_length} GREATER 1) - list(SUBLIST params 1 -1 params_only) - string(JOIN "@" target_file ${target_file} ${params_only}) - endif() - - # This is what will get substituted into test_executables_tutorial.py.in below. - # It looks exactly the same as exes_and_params, with the exception - # that the executable names have been substituted for the absolute paths. - list(APPEND DEMO_NODES_CPP_EXECUTABLE ${target_file}) - endforeach() - string(REPLACE ";" "_" exe_list_underscore "${exe_list}") - configure_file( - test/test_executables_tutorial.py.in - test_${exe_list_underscore}${target_suffix}.py.configured - @ONLY - ) - file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_${exe_list_underscore}${target_suffix}_$.py" - INPUT "${CMAKE_CURRENT_BINARY_DIR}/test_${exe_list_underscore}${target_suffix}.py.configured" - ) - - add_launch_test( - "${CMAKE_CURRENT_BINARY_DIR}/test_${exe_list_underscore}${target_suffix}_$.py" - TARGET test_tutorial_${exe_list_underscore}${target_suffix} - TIMEOUT 60 - ENV - RCL_ASSERT_RMW_ID_MATCHES=${rmw_implementation} - RMW_IMPLEMENTATION=${rmw_implementation} - ) - foreach(executable ${exe_list}) - set_property( - TEST test_tutorial_${exe_list_underscore}${target_suffix} - APPEND PROPERTY DEPENDS ${executable}${target_suffix}) - endforeach() - endforeach() - endmacro() - - call_for_each_rmw_implementation(tests) - endif() - - # Install launch files. - install(DIRECTORY - launch - DESTINATION share/${PROJECT_NAME}/ - ) - - ament_package() - diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/README.md b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/README.md deleted file mode 100644 index a779f97..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/README.md +++ /dev/null @@ -1,736 +0,0 @@ -## **What Is This?** - -This package provides several examples that demonstrate various inter-node communcations in ROS 2. - -This package consists of the following examples: -1. `add_two_ints_client` -2. `listener_serialized_message` -3. `reuse_timer` -4. `add_two_ints_client_async` -5. `list_parameters` -6. `set_and_get_parameters` -7. `add_two_ints_server` -8. `list_parameters_async` -9. `set_and_get_parameters_async` -10. `allocator_tutorial` -11. `one_off_timer` -12. `set_parameters_callback` -13. `content_filtering_publisher` -14. `parameter_blackboard` -15. `talker` -16. `content_filtering_subscriber` -17. `parameter_event_handler` -18. `talker_loaned_message` -19. `even_parameters_node` -20. `parameter_events` -21. `talker_serialized_message` -22. `listener` -23. `parameter_events_async` -24. `listener_best_effort` -25. `matched_event_detect` - -## **Build** - -Run the command below to compile the `demo_nodes_cpp` ROS 2 package: - -```bash -colcon build --packages-up-to demo_nodes_cpp -``` - -**Note**: By default, the demo executables will spin up the [SingleThreaded executor](https://docs.ros.org/en/rolling/Concepts/Intermediate/About-Executors.html#executors) if run in separate processes, i.e., not composed in the same component container. -To configure the demo executables to run with a different executor, build the package with the custom `DEMO_EXECUTOR` flag set to the fully qualified name of the executor. -For example, to run with the experimental `EventsExecutor`, - -```bash -colcon build --packages-select demo_nodes_cpp --cmake-args -DDEMO_EXECUTOR:STRING=rclcpp::experimental::executors::EventsExecutor -``` - -## **Run** - -### Basic Talker & Listener - -This runs a basic ROS 2 publisher and subscriber that exchanges the following string message with an incrementing integer: - -> Hello World: - -#### Talker - -```bash -# Open new terminal -ros2 run demo_nodes_cpp talker -``` - -#### Listener [Default] - -```bash -# Open new terminal -ros2 run demo_nodes_cpp listener -``` - -![](img/talker_listener.png) - -#### Listener [Best Effort] - -Compared to **Listener [Default]**, `listener_best_effort` runs a ROS 2 subscriber node that sets the Quality of Service (QoS) Reliability setting to **Best Effort** via the use of **rclcpp::SensorDataQoS**, as opposed to the default **Reliable**. - -Messages sent using this policy configuration attempts to deliver samples but may lose them if the network is not robust. - -```bash -# Open new terminal -ros2 run demo_nodes_cpp listener_best_effort -``` - -### Basic Server & Client - -This runs a ROS 2 server that provides a service to process two integers, outputting the sum back to ROS 2 client node. - -#### Server - -```bash -# Open new terminal -ros2 run demo_nodes_cpp add_two_ints_server -``` - -#### Client [Synchronous] - -```bash -# Open new terminal -ros2 run demo_nodes_cpp add_two_ints_client -``` - -#### Client [Asynchronous] - -```bash -# Open new terminal -ros2 run demo_nodes_cpp add_two_ints_client_async -``` - -![](img/server_client.png) - -### One-Off Timer - -This runs `one_off_timer` that runs a periodic timer callback that **cancels** and **creates** a **Wall Timer** every **3 callbacks**. - -```bash -ros2 run demo_nodes_cpp one_off_timer -``` - -![](img/one_off_timer.png) - -### Reuse Timer - -Similar to the previous demo, `reuse_timer` runs a periodic timer callback that **reuses the same Wall Timer** every **3 callbacks**. - -```bash -ros2 run demo_nodes_cpp reuse_timer -``` - -### Serialized Messaging - -This runs `talker_serialized_message` ROS 2 node that publishes a manual CDR serialization of the same string message. - -```bash -# Open new terminal -ros2 run demo_nodes_cpp talker_serialized_message -``` - -This runs `listener_serialized_message` ROS 2 node that subscribes and prints out the serialized string message published by `talker_serialized_message`. -```bash -# Open new terminal -ros2 run demo_nodes_cpp listener_serialized_message -``` - -![](img/serialized_messaging.png) - -### Content-Filter Messaging - -This runs `content_filtering_subscriber` and `content_filtering_publisher` ROS 2 nodes which exchanges temperature data on the `/temperature` topic. - -However the subscriber requests that data is only sent if the temperature is less than -30 C or greater than 100 C, saving bandwidth. - -```bash -# Open new terminal -ros2 run demo_nodes_cpp content_filtering_subscriber -``` - -```bash -# Open new terminal -ros2 run demo_nodes_cpp content_filtering_publisher -``` - -![](img/content_filtering_messaging.png) - -### List Parameters - -This runs `list_parameters` ROS 2 node which simply programmatically list example parameter names and prefixes: - -#### Synchronous - -```bash -# Open new terminal -ros2 run demo_nodes_cpp list_parameters -``` - -#### Asynchronous - -```bash -# Open new terminal -ros2 run demo_nodes_cpp list_parameters_async -``` - -### Set & Get Parameters - -This runs `set_and_get_parameters` ROS 2 node which programmatically sets and gets parameters. - -#### Synchronous - -```bash -# Open new terminal -ros2 run demo_nodes_cpp set_and_get_parameters -``` - -#### Asynchronous - -```bash -# Open new terminal -ros2 run demo_nodes_cpp set_and_get_parameters_async -``` - -### Allocator Tutorial - -This runs `allocator_tutorial` ROS 2 node that publishes a `std_msgs/msg/UInt32` message that contains an integer representing the number of allocations and deallocations that happened during the program. - -```bash -# Open new terminal -ros2 run demo_nodes_cpp allocator_tutorial -``` -![](img/allocator_tutorial.png) - -### Parameter Events - -This runs `parameter_events`/`parameter_events_async` ROS 2 node(s) which initiates 10 parameter events which changes an example string parameter. - -> foo -> bar -> baz -> foobar -> foo -> bar -> baz -> foobar -> foo -> bar - -#### Synchronous - -```bash -# Open new terminal -ros2 run demo_nodes_cpp parameter_events -``` - -#### Asynchronous - -```bash -# Open new terminal -ros2 run demo_nodes_cpp parameters_events_async -``` - -### Even Parameters Node - -This runs `even_parameters_node` ROS 2 node which shows a parameter callback that rejects all parameter updates except those that set an even integer. - -```bash -# Open new terminal -ros2 run demo_nodes_cpp even_parameters_node -``` - -![](img/even_parameters_node.png) - -### Set Parameters Callback - -This runs `set_parameters_callback` ROS 2 node which triggers a callback when ROS 2 double parameter `param1` is set. - -The callback then sets ROS 2 double parameter `param2` to a fixed `4.0`. - -```bash -# Open new terminal -ros2 run demo_nodes_cpp set_parameters_callback -``` - -### Parameter Blackboard - -This runs `parameter_blackboard` ROS 2 node which instantiates a ROS 2 parameter server which acts as a global "blackboard" for all nodes to get and set parameters. - -```bash -# Open new terminal -ros2 run demo_nodes_cpp parameter_blackboard -``` - -![](img/parameters_blackboard.png) - -### Parameter Event Handler - -This runs `parameter_event_handler` ROS 2 node which monitors changes to the following parameters: - -> node: "this_node" -> parameter: "an_int_param" - -> node: "/a_namespace/a_remote_node" -> parameter: "a_string_param" - -```bash -# Open new terminal -ros2 run demo_nodes_cpp parameter_event_handler -``` - -### Loaned Messager Talker - -This runs `loaned_message_talker` ROS 2 node that publishes unique messages which eliminates unnecessary copies throughout the ROS 2 stack to maximize performance. - -```bash -# Open new terminal -ros2 run demo_nodes_cpp talker_loaned_message -``` - -### Matched Event Detect - -This runs 3 ROS 2 nodes. -`matched_event_detect_node` node that set matched event callback for publisher and subscription separately to output connection or disconnection information. -`multi_sub_node` create/destroy subscriptions which connect the publisher of `matched_event_detect_node`. -`multi_pub_node` create/destroy publishers which connect the subscription of `matched_event_detect_node`. - -```bash -# Open new terminal -ros2 run demo_nodes_cpp matched_event_detect -``` - -## **Verify** - -### Basic Talker & Listener - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -```bash -# In terminal running talker -[INFO] [1674551635.122315831] [talker]: Publishing: 'Hello World: 1' -[INFO] [1674551636.122275756] [talker]: Publishing: 'Hello World: 2' -[INFO] [1674551637.122274384] [talker]: Publishing: 'Hello World: 3' -[INFO] [1674551638.122235965] [talker]: Publishing: 'Hello World: 4' -[INFO] [1674551639.122277484] [talker]: Publishing: 'Hello World: 5' -#... -``` - -```bash -# In terminal running listener/listener_best_effort -[INFO] [1674551636.122881229] [listener]: I heard: [Hello World: 1] -[INFO] [1674551637.122832606] [listener]: I heard: [Hello World: 2] -[INFO] [1674551638.122675099] [listener]: I heard: [Hello World: 3] -[INFO] [1674551639.122788087] [listener]: I heard: [Hello World: 4] -[INFO] [1674551640.122850575] [listener]: I heard: [Hello World: 5] -#... -``` - -### Basic Server & Client - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -#### Server -```bash -# In terminal running add_two_ints_server -[INFO] [1674553268.912391774] [add_two_ints_server]: Incoming request -a: 2 b: 3 -``` - -#### Client [Synchronous] -```bash -# In terminal running add_two_ints_client -[INFO] [1674553268.912602310] [add_two_ints_client]: Result of add_two_ints: 5 -``` - -#### Client [Asynchronous] -```bash -# In terminal running add_two_ints_client_async -[INFO] [1674553718.598690033] [add_two_ints_client]: Result of add_two_ints: 5 -``` - -### One-Off Timer - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -```bash -# In terminal running one_off_timer -[INFO] [1674552840.400680444] [one_off_timer]: in periodic_timer callback -[INFO] [1674552840.400915092] [one_off_timer]: resetting one off timer -[INFO] [1674552841.401204072] [one_off_timer]: in one_off_timer callback -[INFO] [1674552842.400698264] [one_off_timer]: in periodic_timer callback -[INFO] [1674552842.400819311] [one_off_timer]: not resetting one off timer -[INFO] [1674552844.400695640] [one_off_timer]: in periodic_timer callback -[INFO] [1674552844.400819933] [one_off_timer]: not resetting one off timer -[INFO] [1674552846.400684373] [one_off_timer]: in periodic_timer callback -[INFO] [1674552846.400799868] [one_off_timer]: resetting one off timer -[INFO] [1674552847.400948238] [one_off_timer]: in one_off_timer callback -[INFO] [1674552848.400703699] [one_off_timer]: in periodic_timer callback -[INFO] [1674552848.400828811] [one_off_timer]: not resetting one off timer -[INFO] [1674552850.400680424] [one_off_timer]: in periodic_timer callback -[INFO] [1674552850.400775977] [one_off_timer]: not resetting one off timer -[INFO] [1674552852.400690511] [one_off_timer]: in periodic_timer callback -[INFO] [1674552852.400815404] [one_off_timer]: resetting one off timer -[INFO] [1674552853.401060139] [one_off_timer]: in one_off_timer callback -#... -``` - -> Notice how -> the timer is reset only after two callback iterations. - -### Reuse Timer - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -```bash -[INFO] [1674554333.056000613] [reuse_timer]: in periodic_timer callback -[INFO] [1674554333.056432269] [reuse_timer]: resetting one off timer -[INFO] [1674554334.056732370] [reuse_timer]: in one_off_timer callback -[INFO] [1674554335.055978249] [reuse_timer]: in periodic_timer callback -[INFO] [1674554335.056111777] [reuse_timer]: not resetting one off timer -[INFO] [1674554337.055978910] [reuse_timer]: in periodic_timer callback -[INFO] [1674554337.056108925] [reuse_timer]: not resetting one off timer -[INFO] [1674554339.055966108] [reuse_timer]: in periodic_timer callback -[INFO] [1674554339.056083983] [reuse_timer]: resetting one off timer -[INFO] [1674554340.056295399] [reuse_timer]: in one_off_timer callback -#... -``` - -> Same as One-Off Timer. - -### Serialized Messaging - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -```bash -# In terminal running talker_serialized_message -ROS message: -Hello World:1 -serialized message: -00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 31 00 -ROS message: -Hello World:2 -serialized message: -00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 32 00 -ROS message: -Hello World:3 -serialized message: -00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 33 00 -``` -```bash -# In terminal running listerner_serialized_message -I heard data of length: 24 -00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 32 00 00 00 -serialized data after deserialization: Hello World:2 -I heard data of length: 24 -00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 33 00 00 00 -serialized data after deserialization: Hello World:3 -I heard data of length: 24 -00 01 00 00 0e 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 34 00 00 00 -serialized data after deserialization: Hello World:4 -#... -``` - -### Content-Filtering Messaging - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -```bash -# In terminal running content_filtering_publisher -[INFO] [1674563203.567530898] [content_filtering_publisher]: Publishing: '-100.000000' -[INFO] [1674563204.567508197] [content_filtering_publisher]: Publishing: '-90.000000' -[INFO] [1674563205.567517142] [content_filtering_publisher]: Publishing: '-80.000000' -#... -``` - -```bash -# In terminal running content_filtering_subscriber -[INFO] [1674563182.873825084] [content_filtering_subscriber]: subscribed to topic "/temperature" with content filter options "data < %0 OR data > %1, {-30.000000, 100.000000}" -[INFO] [1674563203.568310361] [content_filtering_subscriber]: I receive an emergency temperature data: [-100.000000] -[INFO] [1674563204.568128370] [content_filtering_subscriber]: I receive an emergency temperature data: [-90.000000] -[INFO] [1674563205.568082783] [content_filtering_subscriber]: I receive an emergency temperature data: [-80.000000] -#... -``` - -### List Parameters [Synchronous/Asynchronous] - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -```bash -[INFO] [1674563905.346022942] [list_parameters]: Setting parameters... -[INFO] [1674563905.347158439] [list_parameters]: Listing parameters... -[INFO] [1674563905.347570888] [list_parameters]: -Parameter names: - bar - foo - foo.first - foo.second -Parameter prefixes: - foo -``` - -### Set & Get Parameters [Synchronous/Asynchronous] - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -```bash -[INFO] [1674564137.057616328] [set_and_get_parameters]: -Parameter name: foo -Parameter value (integer): 2 -Parameter name: baz -Parameter value (double): 1.450000 -Parameter name: foobarbaz -Parameter value (bool_array): [true, false] -Parameter name: toto -Parameter value (byte_array): [0xff, 0x7f] -``` - -### Allocator Tutorial - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -```bash -This simple demo shows off a custom memory allocator to count all -instances of new/delete in the program. It can be run in either regular -mode (no arguments), or in intra-process mode (by passing 'intra' as a -command-line argument). It will then publish a message to the -'/allocator_tutorial' topic every 10 milliseconds until Ctrl-C is pressed. -At that time it will print a count of the number of allocations and -deallocations that happened during the program. - -Intra-process pipeline is OFF. -``` - -Run `ros2 topic echo /allocator_tutorial` to see the output in the ROS 2 topic, `/allocator_tutorial`: -```bash -# Open new terminal -data: 224 ---- -data: 228 ---- -data: 230 ---- -data: 231 ---- -data: 233 ---- -data: 234 ---- -data: 235 ---- -``` - -### Parameter Events [Synchronous/Asynchronous] - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -```bash -[INFO] [1674565202.370104660] [parameter_events]: -Parameter event: - new parameters: - foo - changed parameters: - deleted parameters: - -[INFO] [1674565202.370241604] [parameter_events]: -Parameter event: - new parameters: - bar - changed parameters: - deleted parameters: - -[INFO] [1674565202.370303487] [parameter_events]: -Parameter event: - new parameters: - baz - changed parameters: - deleted parameters: - -[INFO] [1674565202.370355113] [parameter_events]: -Parameter event: - new parameters: - foobar - changed parameters: - deleted parameters: - -[INFO] [1674565202.370398069] [parameter_events]: -Parameter event: - new parameters: - changed parameters: - foo - deleted parameters: - -[INFO] [1674565202.370424143] [parameter_events]: -Parameter event: - new parameters: - changed parameters: - bar - deleted parameters: - -[INFO] [1674565202.370447765] [parameter_events]: -Parameter event: - new parameters: - changed parameters: - baz - deleted parameters: - -[INFO] [1674565202.370470405] [parameter_events]: -Parameter event: - new parameters: - changed parameters: - foobar - deleted parameters: - -[INFO] [1674565202.370492871] [parameter_events]: -Parameter event: - new parameters: - changed parameters: - foo - deleted parameters: - -[INFO] [1674565202.370515168] [parameter_events]: -Parameter event: - new parameters: - changed parameters: - bar - deleted parameters: -``` - -### Even Parameters Node - -Run `ros2 param set /even_parameters_node myint 2` to set the parameter to a valid even integer and produce a similar result like below: - -```bash -[INFO] [1674566014.892688389] [even_parameters_node]: parameter 'myint' has changed and is now: 2 -``` - -Run `ros2 param set /even_parameters_node myint 3` to set the parameter to an invalid odd integer and produce a similar result like below: - -```bash -[INFO] [1674566088.870030436] [even_parameters_node]: Requested value '3' for parameter 'myint' is not an even number: rejecting change... -``` - -### Set Parameters Callback - -#### [Before] - -Run `ros2 param get /set_param_callback_node param1` should print the following to terminal: -```bash -Double value is: 0.0 -``` - -Run `ros2 param get /set_param_callback_node param2` should print the following to terminal: -```bash -Double value is 0.0 -``` - -#### [Change] - -Run `ros2 param set set_param_callback_node param1 10.0` and see it fail with -```bash -Setting parameter failed: cannot set 'param1' > 5.0 -``` - -Run `ros2 param set set_param_callback_node param1 3.0` -```bash -Set parameter successful -``` - -#### [After] - -Run `ros2 param get /set_param_callback_node param1` should print the following to terminal: -```bash -Double value is: 28.0 -``` - -Run `ros2 param get /set_param_callback_node param2` should print the following to terminal: -```bash -Double value is 4.0 -``` - -### Parameter Blackboard - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -```bash -INFO] [1674568261.762813104] [parameter_blackboard]: Parameter blackboard node named '/parameter_blackboard' ready, and serving '5' parameters already! -``` - -Running `ros2 param list` should reveal the 6 parameters served: -```bash -/parameter_blackboard: - qos_overrides./parameter_events.publisher.depth - qos_overrides./parameter_events.publisher.durability - qos_overrides./parameter_events.publisher.history - qos_overrides./parameter_events.publisher.reliability - start_type_description_service - use_sim_time -``` - -### Parameter Event Handler - -Run `ros2 param set this_node an_int_param 21` in a new terminal will produce the following results: -```bash -# In terminal running parameter_event_handler -[INFO] [1674569608.306038487] [this_node]: cb1: Received an update to parameter "an_int_param" of type integer: "21" -[INFO] [1674569608.306356753] [this_node]: cb3: Received an update to parameter "an_int_param" of type: integer: "21" -``` - -Run `ros2 param set /a_namespace/a_remote_node a_string_param "string value to set"` in a new terminal will produce the following results: -```bash -[INFO] [1674569622.728945232] [this_node]: cb2: Received an update to parameter "a_string_param" of type: string: "string value to set" -[INFO] [1674569622.729143396] [this_node]: cb3: Received an update to parameter "a_string_param" of type: string: "string value to set" -[INFO] [1674569622.729246614] [this_node]: cb3: Received an update to parameter "a_string_param" of type: string: "string value to set" -``` - -### Loaned Message Talker - -When executed correctly, strings should be printed to terminal similar to what is shown below: - -```bash -# In terminal running loaned_message_talker -[INFO] [1674570146.112222368] [loaned_message_talker]: Publishing: 'Hello World: 1' -[INFO] [1674570147.111670599] [loaned_message_talker]: Publishing: '2.000000' -[INFO] [1674570147.111853637] [loaned_message_talker]: Publishing: 'Hello World: 2' -[INFO] [1674570148.111662758] [loaned_message_talker]: Publishing: '3.000000' -[INFO] [1674570148.111804226] [loaned_message_talker]: Publishing: 'Hello World: 3' -[INFO] [1674570149.111651863] [loaned_message_talker]: Publishing: '4.000000' -[INFO] [1674570149.111819520] [loaned_message_talker]: Publishing: 'Hello World: 4' - -``` - -> Note that Fast-DDS does not support the loaned messages. The loaned message API is used in iceoryx right now, which workes with CycloneDDS. - -### Matched Event Detect - -When executed correctly, strings should be printed to terminal similar to what is shown below: -```bash -# In terminal running matched_event_detect -[INFO] [1679887690.127684740] [multi_sub_node]: Create a new subscription. -[INFO] [1679887690.128090105] [matched_event_detect_node]: First subscription is connected. -[INFO] [1679887690.128836774] [multi_sub_node]: Create a new subscription. -[INFO] [1679887690.129157780] [matched_event_detect_node]: The changed number of connected subscription is 1 and current number of connected subscription is 2. -[INFO] [1679887690.129193220] [multi_sub_node]: Destroy a subscription. -[INFO] [1679887690.130552475] [matched_event_detect_node]: The changed number of connected subscription is -1 and current number of connected subscription is 1. -[INFO] [1679887690.130588555] [multi_sub_node]: Destroy a subscription. -[INFO] [1679887690.131355128] [matched_event_detect_node]: Last subscription is disconnected. -[INFO] [1679887690.132014952] [multi_pub_node]: Create a new publisher. -[INFO] [1679887690.132262901] [matched_event_detect_node]: First publisher is connected. -[INFO] [1679887690.132898522] [multi_pub_node]: Create a new publisher. -[INFO] [1679887690.133143624] [matched_event_detect_node]: The changed number of connected publisher is 1 and current number of connected publisher is 2. -[INFO] [1679887690.133178687] [multi_pub_node]: Destroy a publisher. -[INFO] [1679887690.134139929] [matched_event_detect_node]: The changed number of connected publisher is -1 and current number of connected publisher is 1. -[INFO] [1679887690.134176647] [multi_pub_node]: Destroy a publisher. -[INFO] [1679887690.134887946] [matched_event_detect_node]: Last publisher is disconnected. -``` - -## **FAQ** - -`Q`: Encountered the following error in terminal when running **Loaned Message Talker**: - -```bash -[INFO] [1674570146.112148792] [rclcpp]: Currently used middleware can't loan messages. Local allocator will be used. -``` - -`A`: Ensure that **CycloneDDS** RMW is used by running `export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp`. - -## **References** - -1. [Zero-Copy via Loaned Messages](https://design.ros2.org/articles/zero_copy.html) -2. [ROS 2 Quality of Service Policies](https://design.ros2.org/articles/qos.html) -3. [Creating a content filtering subscription](https://docs.ros.org/en/rolling/Tutorials/Demos/Content-Filtering-Subscription.html) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/allocator_tutorial.png b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/allocator_tutorial.png deleted file mode 100644 index 9b4e216..0000000 Binary files a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/allocator_tutorial.png and /dev/null differ diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/content_filtering_messaging.png b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/content_filtering_messaging.png deleted file mode 100644 index 7038474..0000000 Binary files a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/content_filtering_messaging.png and /dev/null differ diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/even_parameters_node.png b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/even_parameters_node.png deleted file mode 100644 index 1b10916..0000000 Binary files a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/even_parameters_node.png and /dev/null differ diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/one_off_timer.png b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/one_off_timer.png deleted file mode 100644 index 5f6a625..0000000 Binary files a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/one_off_timer.png and /dev/null differ diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/parameter_blackboard.png b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/parameter_blackboard.png deleted file mode 100644 index 16931af..0000000 Binary files a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/parameter_blackboard.png and /dev/null differ diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/serialized_messaging.png b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/serialized_messaging.png deleted file mode 100644 index b15d29c..0000000 Binary files a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/serialized_messaging.png and /dev/null differ diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/server_client.png b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/server_client.png deleted file mode 100644 index 89ebe43..0000000 Binary files a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/server_client.png and /dev/null differ diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/talker_listener.png b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/talker_listener.png deleted file mode 100644 index 2360de4..0000000 Binary files a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/img/talker_listener.png and /dev/null differ diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/include/demo_nodes_cpp/visibility_control.h b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/include/demo_nodes_cpp/visibility_control.h deleted file mode 100644 index d9f8d42..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/include/demo_nodes_cpp/visibility_control.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2016 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef DEMO_NODES_CPP__VISIBILITY_CONTROL_H_ -#define DEMO_NODES_CPP__VISIBILITY_CONTROL_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ - #ifdef __GNUC__ - #define DEMO_NODES_CPP_EXPORT __attribute__ ((dllexport)) - #define DEMO_NODES_CPP_IMPORT __attribute__ ((dllimport)) - #else - #define DEMO_NODES_CPP_EXPORT __declspec(dllexport) - #define DEMO_NODES_CPP_IMPORT __declspec(dllimport) - #endif - #ifdef DEMO_NODES_CPP_BUILDING_DLL - #define DEMO_NODES_CPP_PUBLIC DEMO_NODES_CPP_EXPORT - #else - #define DEMO_NODES_CPP_PUBLIC DEMO_NODES_CPP_IMPORT - #endif - #define DEMO_NODES_CPP_PUBLIC_TYPE DEMO_NODES_CPP_PUBLIC - #define DEMO_NODES_CPP_LOCAL -#else - #define DEMO_NODES_CPP_EXPORT __attribute__ ((visibility("default"))) - #define DEMO_NODES_CPP_IMPORT - #if __GNUC__ >= 4 - #define DEMO_NODES_CPP_PUBLIC __attribute__ ((visibility("default"))) - #define DEMO_NODES_CPP_LOCAL __attribute__ ((visibility("hidden"))) - #else - #define DEMO_NODES_CPP_PUBLIC - #define DEMO_NODES_CPP_LOCAL - #endif - #define DEMO_NODES_CPP_PUBLIC_TYPE -#endif - -#ifdef __cplusplus -} -#endif - -#endif // DEMO_NODES_CPP__VISIBILITY_CONTROL_H_ diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_async_launch.py b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_async_launch.py deleted file mode 100644 index ae05742..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_async_launch.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2018 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Launch a add_two_ints_server and a (synchronous) add_two_ints_client.""" - -import launch -import launch_ros.actions - - -def generate_launch_description(): - server = launch_ros.actions.Node( - package='demo_nodes_cpp', executable='add_two_ints_server', output='screen') - client = launch_ros.actions.Node( - package='demo_nodes_cpp', executable='add_two_ints_client_async', output='screen') - return launch.LaunchDescription([ - server, - client, - # TODO(wjwwood): replace this with a `required=True|False` option on ExecuteProcess(). - # Shutdown launch when client exits. - launch.actions.RegisterEventHandler( - event_handler=launch.event_handlers.OnProcessExit( - target_action=client, - on_exit=[launch.actions.EmitEvent(event=launch.events.Shutdown())], - )), - ]) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_async_launch.xml b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_async_launch.xml deleted file mode 100644 index caf36b1..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_async_launch.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_launch.py b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_launch.py deleted file mode 100644 index 36023ae..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_launch.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2018 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Launch a add_two_ints_server and a (synchronous) add_two_ints_client.""" - -import launch -import launch_ros.actions - - -def generate_launch_description(): - server = launch_ros.actions.Node( - package='demo_nodes_cpp', executable='add_two_ints_server', output='screen') - client = launch_ros.actions.Node( - package='demo_nodes_cpp', executable='add_two_ints_client', output='screen') - return launch.LaunchDescription([ - server, - client, - # TODO(wjwwood): replace this with a `required=True|False` option on ExecuteProcess(). - # Shutdown launch when client exits. - launch.actions.RegisterEventHandler( - event_handler=launch.event_handlers.OnProcessExit( - target_action=client, - on_exit=[launch.actions.EmitEvent(event=launch.events.Shutdown())], - )), - ]) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_launch.xml b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_launch.xml deleted file mode 100644 index 93023c9..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/add_two_ints_launch.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/introspect_services_launch.py b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/introspect_services_launch.py deleted file mode 100644 index 25e5574..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/services/introspect_services_launch.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2023 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Launch the introspection service and client.""" - -import launch -import launch_ros.actions - - -def generate_launch_description(): - server = launch_ros.actions.Node( - package='demo_nodes_cpp', executable='introspection_service', output='screen') - client = launch_ros.actions.Node( - package='demo_nodes_cpp', executable='introspection_client', output='screen') - return launch.LaunchDescription([ - server, - client, - ]) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_best_effort_launch.py b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_best_effort_launch.py deleted file mode 100644 index d646112..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_best_effort_launch.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2018 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Launch a talker and a best effort listener.""" - -from launch import LaunchDescription -import launch_ros.actions - - -def generate_launch_description(): - return LaunchDescription([ - launch_ros.actions.Node( - package='demo_nodes_cpp', executable='talker', output='screen'), - launch_ros.actions.Node( - package='demo_nodes_cpp', executable='listener_best_effort', output='screen'), - ]) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_best_effort_launch.xml b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_best_effort_launch.xml deleted file mode 100644 index 94ff1b7..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_best_effort_launch.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_best_effort_launch.yaml b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_best_effort_launch.yaml deleted file mode 100644 index b7f546b..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_best_effort_launch.yaml +++ /dev/null @@ -1,9 +0,0 @@ -launch: - - node: - pkg: "demo_nodes_cpp" - exec: "talker" - output: "screen" - - node: - pkg: "demo_nodes_cpp" - exec: "listener_best_effort" - output: "screen" diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_launch.py b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_launch.py deleted file mode 100644 index 2db5b3d..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_launch.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2018 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Launch a talker and a listener.""" - -from launch import LaunchDescription -import launch_ros.actions - - -def generate_launch_description(): - return LaunchDescription([ - launch_ros.actions.Node( - package='demo_nodes_cpp', executable='talker', output='screen'), - launch_ros.actions.Node( - package='demo_nodes_cpp', executable='listener', output='screen'), - ]) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_launch.xml b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_launch.xml deleted file mode 100644 index cd59780..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_launch.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_launch.yaml b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_launch.yaml deleted file mode 100644 index ddb5293..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/launch/topics/talker_listener_launch.yaml +++ /dev/null @@ -1,9 +0,0 @@ -launch: - - node: - pkg: "demo_nodes_cpp" - exec: "talker" - output: "screen" - - node: - pkg: "demo_nodes_cpp" - exec: "listener" - output: "screen" diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/package.xml b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/package.xml deleted file mode 100644 index e2d9f7a..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/package.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - demo_nodes_cpp - 0.34.0 - - C++ nodes which were previously in the ros2/examples repository but are now just used for demo purposes. - - - Aditya Pande - Audrow Nash - - Apache License 2.0 - - Mabel Zhang - William Woodall - - ament_cmake - - example_interfaces - rcl - rclcpp - rclcpp_components - rcl_interfaces - rcpputils - rcutils - rmw - std_msgs - - example_interfaces - launch_ros - launch_xml - rcl - rclcpp - rclcpp_components - rcl_interfaces - rcpputils - rcutils - rmw - std_msgs - - ament_cmake_pytest - ament_lint_auto - ament_lint_common - launch - launch_testing - launch_testing_ament_cmake - launch_testing_ros - - - ament_cmake - - diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_add_two_ints_client_async.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_add_two_ints_client_async.cpp deleted file mode 100644 index b3cefee..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_add_two_ints_client_async.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "add_two_ints_client_async" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libadd_two_ints_client_async_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_add_two_ints_server.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_add_two_ints_server.cpp deleted file mode 100644 index 5494a8e..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_add_two_ints_server.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "add_two_ints_server" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libadd_two_ints_server_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_add_two_ints_client_async.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_add_two_ints_client_async.cpp.in deleted file mode 100644 index 9399554..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_add_two_ints_client_async.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "add_two_ints_client_async" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_add_two_ints_server.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_add_two_ints_server.cpp.in deleted file mode 100644 index f9fbeb9..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_add_two_ints_server.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "add_two_ints_server" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_content_filtering_publisher.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_content_filtering_publisher.cpp.in deleted file mode 100644 index e25e6df..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_content_filtering_publisher.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "content_filtering_publisher" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_content_filtering_subscriber.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_content_filtering_subscriber.cpp.in deleted file mode 100644 index ace9246..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_content_filtering_subscriber.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "content_filtering_subscriber" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_even_parameters_node.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_even_parameters_node.cpp.in deleted file mode 100644 index 683416e..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_even_parameters_node.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "even_parameters_node" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_introspection_client.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_introspection_client.cpp.in deleted file mode 100644 index d496008..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_introspection_client.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "introspection_client" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_introspection_service.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_introspection_service.cpp.in deleted file mode 100644 index d01da72..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_introspection_service.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "introspection_service" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_list_parameters.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_list_parameters.cpp.in deleted file mode 100644 index 04cfbee..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_list_parameters.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "list_parameters" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_listener.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_listener.cpp.in deleted file mode 100644 index e91b772..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_listener.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_listener_best_effort.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_listener_best_effort.cpp.in deleted file mode 100644 index 375bd89..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_listener_best_effort.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener_best_effort" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_listener_serialized_message.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_listener_serialized_message.cpp.in deleted file mode 100644 index 7e2feef..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_listener_serialized_message.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener_serialized_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_one_off_timer.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_one_off_timer.cpp.in deleted file mode 100644 index 2ddcc7a..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_one_off_timer.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "one_off_timer" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_parameter_blackboard.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_parameter_blackboard.cpp.in deleted file mode 100644 index 68efdfd..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_parameter_blackboard.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "parameter_blackboard" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_parameter_events_async.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_parameter_events_async.cpp.in deleted file mode 100644 index db9e782..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_parameter_events_async.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "parameter_events_async" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_reuse_timer.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_reuse_timer.cpp.in deleted file mode 100644 index 4647d32..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_reuse_timer.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "reuse_timer" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_set_and_get_parameters.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_set_and_get_parameters.cpp.in deleted file mode 100644 index 10c3301..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_set_and_get_parameters.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "set_and_get_parameters" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_set_parameters_callback.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_set_parameters_callback.cpp.in deleted file mode 100644 index fcf5658..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_set_parameters_callback.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "set_parameters_callback" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_talker.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_talker.cpp.in deleted file mode 100644 index 2d0db74..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_talker.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_talker_loaned_message.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_talker_loaned_message.cpp.in deleted file mode 100644 index 59d4470..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_talker_loaned_message.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker_loaned_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_talker_serialized_message.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_talker_serialized_message.cpp.in deleted file mode 100644 index 13bbe40..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_configured_talker_serialized_message.cpp.in +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker_serialized_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_content_filtering_publisher.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_content_filtering_publisher.cpp deleted file mode 100644 index 1ab35cc..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_content_filtering_publisher.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "content_filtering_publisher" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libcontent_filtering_publisher_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_content_filtering_subscriber.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_content_filtering_subscriber.cpp deleted file mode 100644 index a07fe6a..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_content_filtering_subscriber.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "content_filtering_subscriber" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libcontent_filtering_subscriber_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_even_parameters_node.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_even_parameters_node.cpp deleted file mode 100644 index edf8146..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_even_parameters_node.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "even_parameters_node" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libeven_parameters_node_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_introspection_client.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_introspection_client.cpp deleted file mode 100644 index 190a13f..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_introspection_client.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "introspection_client" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libintrospection_client_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_introspection_service.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_introspection_service.cpp deleted file mode 100644 index 7737f59..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_introspection_service.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "introspection_service" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libintrospection_service_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_list_parameters.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_list_parameters.cpp deleted file mode 100644 index dfac37b..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_list_parameters.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "list_parameters" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "liblist_parameters_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_listener.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_listener.cpp deleted file mode 100644 index 5933c1b..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_listener.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "liblistener_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_listener_best_effort.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_listener_best_effort.cpp deleted file mode 100644 index 0b5e3c0..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_listener_best_effort.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener_best_effort" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "liblistener_best_effort_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_listener_serialized_message.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_listener_serialized_message.cpp deleted file mode 100644 index 42f09d4..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_listener_serialized_message.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener_serialized_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "liblistener_serialized_message_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_one_off_timer.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_one_off_timer.cpp deleted file mode 100644 index 947626e..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_one_off_timer.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "one_off_timer" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libone_off_timer_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_parameter_blackboard.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_parameter_blackboard.cpp deleted file mode 100644 index 3fa153d..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_parameter_blackboard.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "parameter_blackboard" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libparameter_blackboard_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_parameter_events_async.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_parameter_events_async.cpp deleted file mode 100644 index 6f0d681..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_parameter_events_async.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "parameter_events_async" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libparameter_events_async_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_reuse_timer.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_reuse_timer.cpp deleted file mode 100644 index ef901d5..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_reuse_timer.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "reuse_timer" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libreuse_timer_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_set_and_get_parameters.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_set_and_get_parameters.cpp deleted file mode 100644 index ee662ad..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_set_and_get_parameters.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "set_and_get_parameters" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libset_and_get_parameters_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_set_parameters_callback.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_set_parameters_callback.cpp deleted file mode 100644 index 3bd9b72..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_set_parameters_callback.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "set_parameters_callback" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libset_parameters_callback_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_talker.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_talker.cpp deleted file mode 100644 index bc07fee..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_talker.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libtalker_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_talker_loaned_message.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_talker_loaned_message.cpp deleted file mode 100644 index acf9e1d..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_talker_loaned_message.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker_loaned_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libtalker_loaned_message_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_talker_serialized_message.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_talker_serialized_message.cpp deleted file mode 100644 index 6fb48ec..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/rclcpp_components/node_main_talker_serialized_message.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#include "rclcpp/executors/single_threaded_executor.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker_serialized_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libtalker_serialized_message_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/events/matched_event_detect.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/events/matched_event_detect.cpp deleted file mode 100644 index 92927d1..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/events/matched_event_detect.cpp +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright 2023 Sony Group Corporation. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" - -#include "std_msgs/msg/string.hpp" - -using namespace std::chrono_literals; - -// This demo program shows matched event work. -// Matched event occurs when publisher and subscription establishes the connection. -// Class MatchedEventDetectNode output connection information of publisher and subscription. -// Class MultiSubNode is used to create/destroy subscription to connect/disconnect the publisher of -// MatchedEventDetectNode. -// Class MultiPubNode is used to created/destroy publisher to connect/disconnect the subscription -// of MatchedEventDetectNode. - -class MatchedEventDetectNode : public rclcpp::Node -{ -public: - explicit MatchedEventDetectNode( - const std::string & pub_topic_name, - const std::string & sub_topic_name) - : Node("matched_event_detect_node") - { - rclcpp::PublisherOptions pub_options; - pub_options.event_callbacks.matched_callback = - [this](rclcpp::MatchedInfo & s) { - if (any_subscription_connected_) { - if (s.current_count == 0) { - RCLCPP_INFO(this->get_logger(), "Last subscription is disconnected."); - any_subscription_connected_ = false; - } else { - RCLCPP_INFO( - this->get_logger(), - "The changed number of connected subscription is %d and current number of connected" - " subscription is %lu.", s.current_count_change, s.current_count); - } - } else { - if (s.current_count != 0) { - RCLCPP_INFO(this->get_logger(), "First subscription is connected."); - any_subscription_connected_ = true; - } - } - promise_->set_value(true); - }; - - pub_ = create_publisher( - pub_topic_name, 10, pub_options); - - rclcpp::SubscriptionOptions sub_options; - sub_options.event_callbacks.matched_callback = - [this](rclcpp::MatchedInfo & s) { - if (any_publisher_connected_) { - if (s.current_count == 0) { - RCLCPP_INFO(this->get_logger(), "Last publisher is disconnected."); - any_publisher_connected_ = false; - } else { - RCLCPP_INFO( - this->get_logger(), - "The changed number of connected publisher is %d and current number of connected" - " publisher is %lu.", s.current_count_change, s.current_count); - } - } else { - if (s.current_count != 0) { - RCLCPP_INFO(this->get_logger(), "First publisher is connected."); - any_publisher_connected_ = true; - } - } - promise_->set_value(true); - }; - sub_ = create_subscription( - sub_topic_name, - 10, - [](std_msgs::msg::String::ConstSharedPtr) {}, - sub_options); - } - - std::future get_future() - { - promise_.reset(new std::promise()); - return promise_->get_future(); - } - -private: - rclcpp::Publisher::SharedPtr pub_; - rclcpp::Subscription::SharedPtr sub_; - bool any_subscription_connected_{false}; - bool any_publisher_connected_{false}; - std::shared_ptr> promise_; -}; - -class MultiSubNode : public rclcpp::Node -{ -public: - explicit MultiSubNode(const std::string & topic_name) - : Node("multi_sub_node"), - topic_name_(topic_name) - {} - - rclcpp::Subscription::WeakPtr create_one_sub(void) - { - RCLCPP_INFO(this->get_logger(), "Create a new subscription."); - auto sub = create_subscription( - topic_name_, - 10, - [](std_msgs::msg::String::ConstSharedPtr) {}); - - subs_.emplace_back(sub); - return sub; - } - - void destroy_one_sub(rclcpp::Subscription::WeakPtr sub) - { - auto sub_shared_ptr = sub.lock(); - if (sub_shared_ptr == nullptr) { - return; - } - - for (auto s = subs_.begin(); s != subs_.end(); s++) { - if (*s == sub_shared_ptr) { - RCLCPP_INFO(this->get_logger(), "Destroy a subscription."); - subs_.erase(s); - break; - } - } - } - -private: - std::string topic_name_; - std::vector::SharedPtr> subs_; -}; - -class MultiPubNode : public rclcpp::Node -{ -public: - explicit MultiPubNode(const std::string & topic_name) - : Node("multi_pub_node"), - topic_name_(topic_name) - {} - - rclcpp::Publisher::WeakPtr create_one_pub(void) - { - RCLCPP_INFO(this->get_logger(), "Create a new publisher."); - auto pub = create_publisher(topic_name_, 10); - pubs_.emplace_back(pub); - - return pub; - } - - void destroy_one_pub(rclcpp::Publisher::WeakPtr pub) - { - auto pub_shared_ptr = pub.lock(); - if (pub_shared_ptr == nullptr) { - return; - } - - for (auto s = pubs_.begin(); s != pubs_.end(); s++) { - if (*s == pub_shared_ptr) { - RCLCPP_INFO(this->get_logger(), "Destroy a publisher."); - pubs_.erase(s); - break; - } - } - } - -private: - std::string topic_name_; - std::vector::SharedPtr> pubs_; -}; - -int main(int argc, char ** argv) -{ - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - rclcpp::init(argc, argv); - - std::string topic_name_for_detect_pub_matched_event = "pub_topic_matched_event_detect"; - std::string topic_name_for_detect_sub_matched_event = "sub_topic_matched_event_detect"; - - rclcpp::executors::SingleThreadedExecutor executor; - - auto matched_event_detect_node = std::make_shared( - topic_name_for_detect_pub_matched_event, - topic_name_for_detect_sub_matched_event); - - auto multi_sub_node = std::make_shared( - topic_name_for_detect_pub_matched_event); - - auto multi_pub_node = std::make_shared( - topic_name_for_detect_sub_matched_event); - - auto maximum_wait_time = 10s; - - executor.add_node(matched_event_detect_node); - executor.add_node(multi_sub_node); - executor.add_node(multi_pub_node); - - // MatchedEventDetectNode will output: - // First subscription is connected. - auto sub1 = multi_sub_node->create_one_sub(); - executor.spin_until_future_complete(matched_event_detect_node->get_future(), maximum_wait_time); - - // MatchedEventDetectNode will output: - // The changed number of connected subscription is 1 and current number of connected subscription - // is 2. - auto sub2 = multi_sub_node->create_one_sub(); - executor.spin_until_future_complete(matched_event_detect_node->get_future(), maximum_wait_time); - - // MatchedEventDetectNode will output: - // The changed number of connected subscription is -1 and current number of connected subscription - // is 1. - multi_sub_node->destroy_one_sub(sub1); - executor.spin_until_future_complete(matched_event_detect_node->get_future(), maximum_wait_time); - - // MatchedEventDetectNode will output: - // Last subscription is disconnected. - multi_sub_node->destroy_one_sub(sub2); - executor.spin_until_future_complete(matched_event_detect_node->get_future(), maximum_wait_time); - - // MatchedEventDetectNode will output: - // First publisher is connected. - auto pub1 = multi_pub_node->create_one_pub(); - executor.spin_until_future_complete(matched_event_detect_node->get_future(), maximum_wait_time); - - // MatchedEventDetectNode will output: - // The changed number of connected publisher is 1 and current number of connected publisher - // is 2. - auto pub2 = multi_pub_node->create_one_pub(); - executor.spin_until_future_complete(matched_event_detect_node->get_future(), maximum_wait_time); - - // MatchedEventDetectNode will output: - // The changed number of connected publisher is -1 and current number of connected publisher - // is 1. - multi_pub_node->destroy_one_pub(pub1); - executor.spin_until_future_complete(matched_event_detect_node->get_future(), maximum_wait_time); - - // MatchedEventDetectNode will output: - // Last publisher is disconnected. - multi_pub_node->destroy_one_pub(pub2); - executor.spin_until_future_complete(matched_event_detect_node->get_future(), maximum_wait_time); - - rclcpp::shutdown(); - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/even_parameters_node.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/even_parameters_node.cpp deleted file mode 100644 index 5ea7782..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/even_parameters_node.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2018 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include - -#include "rcl_interfaces/msg/set_parameters_result.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -namespace demo_nodes_cpp -{ -class EvenParameterNode : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit EvenParameterNode(rclcpp::NodeOptions options) - : Node("even_parameters_node", options.allow_undeclared_parameters(true)) - { - RCLCPP_INFO(get_logger(), "This example node shows a parameter callback that rejects"); - RCLCPP_INFO(get_logger(), "all parameter updates except for those that set an even integer."); - RCLCPP_INFO(get_logger(), "Try running 'ros2 param set /even_parameters_node myint 2' to"); - RCLCPP_INFO(get_logger(), "successfully set a parameter."); - - // Declare a parameter change request callback - // This function will enforce that only setting even integer parameters is allowed - // any other change will be discarded - auto param_change_callback = - [this](std::vector parameters) - { - auto result = rcl_interfaces::msg::SetParametersResult(); - result.successful = true; - for (auto parameter : parameters) { - rclcpp::ParameterType parameter_type = parameter.get_type(); - if (rclcpp::ParameterType::PARAMETER_NOT_SET == parameter_type) { - RCLCPP_INFO( - this->get_logger(), "parameter '%s' deleted successfully", - parameter.get_name().c_str() - ); - result.successful &= true; - } else if (rclcpp::ParameterType::PARAMETER_INTEGER == parameter_type) { - if (parameter.as_int() % 2 != 0) { - RCLCPP_INFO_STREAM( - this->get_logger(), - "Requested value '" << parameter.as_int() << "' for parameter '" << - parameter.get_name() << "' is not an even number: rejecting change..." - ); - result.reason = "only even integers can be set"; - result.successful = false; - } else { - RCLCPP_INFO( - this->get_logger(), - "parameter '%s' has changed and is now: %s", - parameter.get_name().c_str(), - parameter.value_to_string().c_str() - ); - result.successful &= true; - } - } else { - RCLCPP_INFO( - this->get_logger(), "only integer parameters can be set\n" - "requested value for parameter '%s' is not an even number, rejecting change...", - parameter.get_name().c_str() - ); - result.reason = "only integer parameters can be set"; - result.successful = false; - } - } - return result; - }; - // callback_handler needs to be alive to keep the callback functional - callback_handler = this->add_on_set_parameters_callback(param_change_callback); - } - - OnSetParametersCallbackHandle::SharedPtr callback_handler; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::EvenParameterNode) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/list_parameters.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/list_parameters.cpp deleted file mode 100644 index f92808b..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/list_parameters.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2015 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -using namespace std::chrono_literals; - -namespace demo_nodes_cpp -{ - -class ListParameters : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit ListParameters(const rclcpp::NodeOptions & options) - : Node("list_parameters", options) - { - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - this->declare_parameter("foo", 0); - this->declare_parameter("bar", ""); - this->declare_parameter("baz", 0.); - this->declare_parameter("foo.first", 0); - this->declare_parameter("foo.second", 0); - this->declare_parameter("foobar", false); - - auto parameters_client = std::make_shared(this); - while (!parameters_client->wait_for_service(1s)) { - if (!rclcpp::ok()) { - RCLCPP_ERROR(this->get_logger(), "Interrupted while waiting for the service. Exiting."); - rclcpp::shutdown(); - } - RCLCPP_INFO(this->get_logger(), "service not available, waiting again..."); - } - - RCLCPP_INFO(this->get_logger(), "Setting parameters..."); - // Set several different types of parameters. - auto set_parameters_results = parameters_client->set_parameters( - { - rclcpp::Parameter("foo", 2), - rclcpp::Parameter("bar", "hello"), - rclcpp::Parameter("baz", 1.45), - rclcpp::Parameter("foo.first", 8), - rclcpp::Parameter("foo.second", 42), - rclcpp::Parameter("foobar", true), - }); - - RCLCPP_INFO(this->get_logger(), "Listing parameters..."); - // List the details of a few parameters up to a namespace depth of 10. - auto parameters_and_prefixes = parameters_client->list_parameters({"foo", "bar"}, 10); - - std::stringstream ss; - ss << "\nParameter names:"; - for (auto & name : parameters_and_prefixes.names) { - ss << "\n " << name; - } - ss << "\nParameter prefixes:"; - for (auto & prefix : parameters_and_prefixes.prefixes) { - ss << "\n " << prefix; - } - RCLCPP_INFO(this->get_logger(), "%s", ss.str().c_str()); - rclcpp::shutdown(); - } -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::ListParameters) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/list_parameters_async.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/list_parameters_async.cpp deleted file mode 100644 index 2d7c0f3..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/list_parameters_async.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2015 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" - -using namespace std::chrono_literals; - -int main(int argc, char ** argv) -{ - // Force flush of the stdout buffer. - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - - rclcpp::init(argc, argv); - - auto node = rclcpp::Node::make_shared("list_parameters_async"); - - // Declare parameters that may be set on this node - node->declare_parameter("foo", 0); - node->declare_parameter("bar", ""); - node->declare_parameter("baz", 0.); - node->declare_parameter("foo.first", 0); - node->declare_parameter("foo.second", 0); - node->declare_parameter("foobar", false); - - auto parameters_client = std::make_shared(node); - - while (!parameters_client->wait_for_service(1s)) { - if (!rclcpp::ok()) { - RCLCPP_ERROR(node->get_logger(), "Interrupted while waiting for the service. Exiting."); - return 0; - } - RCLCPP_INFO(node->get_logger(), "service not available, waiting again..."); - } - - RCLCPP_INFO(node->get_logger(), "Setting parameters..."); - // Set several differnet types of parameters. - auto results = parameters_client->set_parameters( - { - rclcpp::Parameter("foo", 2), - rclcpp::Parameter("bar", "hello"), - rclcpp::Parameter("baz", 1.45), - rclcpp::Parameter("foo.first", 8), - rclcpp::Parameter("foo.second", 42), - rclcpp::Parameter("foobar", true), - }); - // Wait for the result. - rclcpp::spin_until_future_complete(node, results); - - RCLCPP_INFO(node->get_logger(), "Listing parameters..."); - // List the details of a few parameters up to a namespace depth of 10. - auto parameter_list_future = parameters_client->list_parameters({"foo", "bar"}, 10); - - if (rclcpp::spin_until_future_complete(node, parameter_list_future) != - rclcpp::FutureReturnCode::SUCCESS) - { - RCLCPP_ERROR(node->get_logger(), "service call failed, exiting tutorial."); - return -1; - } - auto parameter_list = parameter_list_future.get(); - - std::stringstream ss; - ss << "\nParameter names:"; - for (auto & name : parameter_list.names) { - ss << "\n " << name; - } - ss << "\nParameter prefixes:"; - for (auto & prefix : parameter_list.prefixes) { - ss << "\n " << prefix; - } - RCLCPP_INFO(node->get_logger(), "%s", ss.str().c_str()); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_blackboard.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_blackboard.cpp deleted file mode 100644 index 9170e92..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_blackboard.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include - -#include "rcl_interfaces/srv/list_parameters.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -namespace demo_nodes_cpp -{ - -class ParameterBlackboard : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit ParameterBlackboard( - rclcpp::NodeOptions options - ) - : Node( - "parameter_blackboard", - options.allow_undeclared_parameters(true). - automatically_declare_parameters_from_overrides(true)) - { - RCLCPP_INFO( - this->get_logger(), - "Parameter blackboard node named '%s' ready, and serving '%zu' parameters already!", - this->get_fully_qualified_name(), this->list_parameters( - {}, rcl_interfaces::srv::ListParameters::Request::DEPTH_RECURSIVE).names.size()); - } -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::ParameterBlackboard) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_event_handler.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_event_handler.cpp deleted file mode 100644 index 6eb1e0f..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_event_handler.cpp +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2021 Open Source Robotics Foundation, Inc. -// Copyright (c) 2020 Intel Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include -#include - -#include "rcl_interfaces/msg/parameter_event.hpp" -#include "rclcpp/rclcpp.hpp" - -// A utility class to assist in spinning a separate node -class NodeThread -{ -public: - explicit NodeThread(rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_base) - : node_(node_base) - { - thread_ = std::make_unique( - [&]() - { - executor_.add_node(node_); - executor_.spin(); - executor_.remove_node(node_); - }); - } - - template - explicit NodeThread(NodeT node) - : NodeThread(node->get_node_base_interface()) - {} - - ~NodeThread() - { - executor_.cancel(); - thread_->join(); - } - -protected: - rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_; - std::unique_ptr thread_; - rclcpp::executors::SingleThreadedExecutor executor_; -}; - -int main(int argc, char ** argv) -{ - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - rclcpp::init(argc, argv); - - const char * node_name = "this_node"; - const char * param_name = "an_int_param"; - - // Create a node with an integer parameter - auto node = rclcpp::Node::make_shared(node_name); - node->declare_parameter(param_name, 0); - - // Let's create another "remote" node in a separate namespace with its own string parameter - auto remote_node_name = "a_remote_node"; - auto remote_node_namespace = "/a_namespace"; - auto remote_param_name = "a_string_param"; - auto remote_node = rclcpp::Node::make_shared(remote_node_name, remote_node_namespace); - remote_node->declare_parameter(remote_param_name, "default_string_value"); - auto remote_thread = std::make_unique(remote_node); - - // Now, create a parameter subscriber that can be used to monitor parameter changes on - // our own local node as well as other remote nodes - auto param_subscriber = std::make_shared(node); - - // First, set a callback for the local integer parameter. In this case, we don't - // provide a node name (the third, optional, parameter). - auto cb1 = [&node](const rclcpp::Parameter & p) { - RCLCPP_INFO( - node->get_logger(), - "cb1: Received an update to parameter \"%s\" of type %s: \"%" PRId64 "\"", - p.get_name().c_str(), - p.get_type_name().c_str(), - p.as_int()); - }; - auto handle1 = param_subscriber->add_parameter_callback(param_name, cb1); - - // Now, add a callback to monitor any changes to the remote node's parameter. In this - // case, we supply the remote node name. - auto cb2 = [&node](const rclcpp::Parameter & p) { - RCLCPP_INFO( - node->get_logger(), "cb2: Received an update to parameter \"%s\" of type: %s: \"%s\"", - p.get_name().c_str(), - p.get_type_name().c_str(), - p.as_string().c_str()); - }; - auto fqn = remote_node_namespace + std::string("/") + remote_node_name; - auto handle2 = param_subscriber->add_parameter_callback( - remote_param_name, cb2, fqn); - - // We can also monitor all parameter changes and do our own filtering/searching - auto cb3 = - [fqn, remote_param_name, &node](const rcl_interfaces::msg::ParameterEvent & event) { - // Use a regular expression to scan for any updates to parameters in "/a_namespace" - // as well as any parameter changes to our own node - std::regex re("(/a_namespace/.*)|(/this_node)"); - if (regex_match(event.node, re)) { - // You can use 'get_parameter_from_event' if you know the node name and parameter name - // that you're looking for - rclcpp::Parameter p; - if (rclcpp::ParameterEventHandler::get_parameter_from_event( - event, p, - remote_param_name, fqn)) - { - RCLCPP_INFO( - node->get_logger(), "cb3: Received an update to parameter \"%s\" of type: %s: \"%s\"", - p.get_name().c_str(), - p.get_type_name().c_str(), - p.as_string().c_str()); - } - - // You can also use 'get_parameter*s*_from_event' to enumerate all changes that came - // in on this event - auto params = rclcpp::ParameterEventHandler::get_parameters_from_event(event); - for (auto & p : params) { - RCLCPP_INFO( - node->get_logger(), "cb3: Received an update to parameter \"%s\" of type: %s: \"%s\"", - p.get_name().c_str(), - p.get_type_name().c_str(), - p.value_to_string().c_str()); - } - } - }; - auto handle3 = param_subscriber->add_parameter_event_callback(cb3); - - printf("This demo is monitoring for the following parameter changes:\n\n"); - printf("\tnode: \"%s\"\n", node_name); - printf("\tparameter: \"%s\"\n", param_name); - printf("\n"); - printf("\tnode: \"%s\"\n", fqn.c_str()); - printf("\tparameter: \"%s\"\n", remote_param_name); - printf("\n"); - printf( - "To activate the callbacks, from a separate shell/console window, " - "execute either of the following example commands:\n\n"); - printf("\t$ ros2 param set %s %s 21\n", node_name, param_name); - printf("\t$ ros2 param set %s %s \"string value to set\"\n\n", fqn.c_str(), remote_param_name); - - // Process messages until ^C - rclcpp::spin(node->get_node_base_interface()); - - rclcpp::shutdown(); - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_events.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_events.cpp deleted file mode 100644 index 0265908..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_events.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2015 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include -#include - -#include "rcl_interfaces/msg/parameter_event.hpp" -#include "rclcpp/rclcpp.hpp" - -using namespace std::chrono_literals; - -bool on_parameter_event( - rcl_interfaces::msg::ParameterEvent::UniquePtr event, rclcpp::Logger logger) -{ - // TODO(wjwwood): The message should have an operator<<, which would replace all of this. - std::stringstream ss; - // ignore qos overrides - event->new_parameters.erase( - std::remove_if( - event->new_parameters.begin(), - event->new_parameters.end(), - [](const auto & item) { - const char * param_override_prefix = "qos_overrides."; - return std::strncmp( - item.name.c_str(), param_override_prefix, sizeof(param_override_prefix) - 1) == 0u; - }), - event->new_parameters.end()); - if ( - !event->new_parameters.size() && !event->changed_parameters.size() && - !event->deleted_parameters.size()) - { - return false; - } - ss << "\nParameter event:\n new parameters:"; - for (auto & new_parameter : event->new_parameters) { - ss << "\n " << new_parameter.name; - } - ss << "\n changed parameters:"; - for (auto & changed_parameter : event->changed_parameters) { - ss << "\n " << changed_parameter.name; - } - ss << "\n deleted parameters:"; - for (auto & deleted_parameter : event->deleted_parameters) { - ss << "\n " << deleted_parameter.name; - } - ss << "\n"; - RCLCPP_INFO(logger, "%s", ss.str().c_str()); - return true; -} - -int main(int argc, char ** argv) -{ - // Force flush of the stdout buffer. - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - - rclcpp::init(argc, argv); - - auto node = rclcpp::Node::make_shared("parameter_events"); - - auto parameters_client = std::make_shared(node); - while (!parameters_client->wait_for_service(1s)) { - if (!rclcpp::ok()) { - RCLCPP_ERROR(node->get_logger(), "Interrupted while waiting for the service. Exiting."); - return 0; - } - RCLCPP_INFO(node->get_logger(), "service not available, waiting again..."); - } - - auto events_received_promise = std::make_shared>(); - auto events_received_future = events_received_promise->get_future(); - - // Setup callback for changes to parameters. - auto sub = parameters_client->on_parameter_event( - [node, promise = std::move(events_received_promise)]( - rcl_interfaces::msg::ParameterEvent::UniquePtr event) -> void - { - static size_t n_times_called = 0u; - if (on_parameter_event(std::move(event), node->get_logger())) { - ++n_times_called; - } - if (10u == n_times_called) { - // This callback will be called 10 times, set the promise when that happens. - promise->set_value(); - } - }); - - // Declare parameters that may be set on this node - node->declare_parameter("foo", 0); - node->declare_parameter("bar", ""); - node->declare_parameter("baz", 0.); - node->declare_parameter("foobar", false); - - // Set several different types of parameters. - auto set_parameters_results = parameters_client->set_parameters( - { - rclcpp::Parameter("foo", 2), - rclcpp::Parameter("bar", "hello"), - rclcpp::Parameter("baz", 1.45), - rclcpp::Parameter("foobar", true), - }); - - // Change the value of some of them. - set_parameters_results = parameters_client->set_parameters( - { - rclcpp::Parameter("foo", 3), - rclcpp::Parameter("bar", "world"), - }); - - // TODO(wjwwood): Create and use delete_parameter - - rclcpp::spin_until_future_complete(node, events_received_future.share()); - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_events_async.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_events_async.cpp deleted file mode 100644 index ec94195..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/parameter_events_async.cpp +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2015 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include - -#include "rcl_interfaces/msg/parameter_event.hpp" -#include "rcl_interfaces/msg/set_parameters_result.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -using namespace std::chrono_literals; -using SetParametersResult = - std::shared_future>; -namespace demo_nodes_cpp -{ -class ParameterEventsAsyncNode : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit ParameterEventsAsyncNode(const rclcpp::NodeOptions & options) - : Node("parameter_events", options) - { - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - // Typically a parameter client is created for a remote node by passing the name of the remote - // node in the constructor; in this example we create a parameter client for this node itself. - parameters_client_ = std::make_shared(this); - - auto on_parameter_event_callback = - [this](rcl_interfaces::msg::ParameterEvent::UniquePtr event) -> void - { - // ignore qos overrides - event->new_parameters.erase( - std::remove_if( - event->new_parameters.begin(), - event->new_parameters.end(), - [](const auto & item) { - const char * param_override_prefix = "qos_overrides."; - return std::strncmp( - item.name.c_str(), param_override_prefix, sizeof(param_override_prefix) - 1) == 0u; - }), - event->new_parameters.end()); - if ( - !event->new_parameters.size() && !event->changed_parameters.size() && - !event->deleted_parameters.size()) - { - return; - } - // TODO(wjwwood): The message should have an operator<<, which would replace all of this. - std::stringstream ss; - ss << "\nParameter event:\n new parameters:"; - for (auto & new_parameter : event->new_parameters) { - ss << "\n " << new_parameter.name; - } - ss << "\n changed parameters:"; - for (auto & changed_parameter : event->changed_parameters) { - ss << "\n " << changed_parameter.name; - } - ss << "\n deleted parameters:"; - for (auto & deleted_parameter : event->deleted_parameters) { - ss << "\n " << deleted_parameter.name; - } - ss << "\n"; - RCLCPP_INFO(this->get_logger(), "%s", ss.str().c_str()); - }; - - // Setup callback for changes to parameters. - parameter_event_sub_ = parameters_client_->on_parameter_event(on_parameter_event_callback); - - // Even though this is in the same node, we still have to wait for the - // service to be available before declaring parameters (otherwise there is - // a chance we'll miss some events in the callback). - while (!parameters_client_->wait_for_service(1s)) { - if (!rclcpp::ok()) { - RCLCPP_ERROR(this->get_logger(), "interrupted while waiting for the service. exiting."); - rclcpp::shutdown(); - return; - } - RCLCPP_INFO(this->get_logger(), "service not available, waiting again..."); - } - - // Declare parameters that may be set on this node - this->declare_parameter("foo", 0); - this->declare_parameter("bar", ""); - this->declare_parameter("baz", 0.); - this->declare_parameter("foobar", false); - - // Queue a `set_parameters` request as soon as `spin` is called on this node. - // TODO(dhood): consider adding a "call soon" notion to Node to not require a timer for this. - timer_ = create_wall_timer( - 200ms, - [this]() { - this->queue_first_set_parameter_request(); - }); - } - -private: - // Set several different types of parameters. - DEMO_NODES_CPP_LOCAL - void queue_first_set_parameter_request() - { - timer_->cancel(); // Prevent another request from being queued by the timer. - while (!parameters_client_->wait_for_service(1s)) { - if (!rclcpp::ok()) { - RCLCPP_ERROR(this->get_logger(), "interrupted while waiting for the service. exiting."); - rclcpp::shutdown(); - return; - } - RCLCPP_INFO(this->get_logger(), "service not available, waiting again..."); - } - auto response_received_callback = [this](SetParametersResult future) { - // Check to see if they were set. - for (auto & result : future.get()) { - if (!result.successful) { - RCLCPP_ERROR(this->get_logger(), "Failed to set parameter: %s", result.reason.c_str()); - } - } - this->queue_second_set_parameter_request(); - }; - - parameters_client_->set_parameters( - { - rclcpp::Parameter("foo", 2), - rclcpp::Parameter("bar", "hello"), - rclcpp::Parameter("baz", 1.45), - rclcpp::Parameter("foobar", true), - }, response_received_callback); - } - - // Change the value of some of them. - DEMO_NODES_CPP_LOCAL - void queue_second_set_parameter_request() - { - auto response_received_callback = [this](SetParametersResult future) { - // Check to see if they were set. - for (auto & result : future.get()) { - if (!result.successful) { - RCLCPP_ERROR(this->get_logger(), "Failed to set parameter: %s", result.reason.c_str()); - } - } - // TODO(wjwwood): Create and use delete_parameter - - // Give time for all of the ParameterEvent callbacks to be received. - timer_ = create_wall_timer( - 100ms, - []() { - rclcpp::shutdown(); - }); - }; - parameters_client_->set_parameters( - { - rclcpp::Parameter("foo", 3), - rclcpp::Parameter("bar", "world"), - }, response_received_callback); - } - - rclcpp::AsyncParametersClient::SharedPtr parameters_client_; - rclcpp::Subscription::SharedPtr parameter_event_sub_; - rclcpp::TimerBase::SharedPtr timer_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::ParameterEventsAsyncNode) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/set_and_get_parameters.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/set_and_get_parameters.cpp deleted file mode 100644 index d613ce5..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/set_and_get_parameters.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2015 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -using namespace std::chrono_literals; - -namespace demo_nodes_cpp -{ - -class SetAndGetParameters : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit SetAndGetParameters(const rclcpp::NodeOptions & options) - : Node("set_and_get_parameters", options) - { - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - this->declare_parameter("foo", 0); - this->declare_parameter("bar", ""); - this->declare_parameter("baz", 0.); - this->declare_parameter("foobar", false); - this->declare_parameter("foobarbaz", std::vector{}); - this->declare_parameter("toto", std::vector{}); - - auto parameters_client = std::make_shared(this); - while (!parameters_client->wait_for_service(1s)) { - if (!rclcpp::ok()) { - RCLCPP_ERROR(this->get_logger(), "Interrupted while waiting for the service. Exiting."); - rclcpp::shutdown(); - } - RCLCPP_INFO(this->get_logger(), "service not available, waiting again..."); - } - - // Set several different types of parameters. - auto set_parameters_results = parameters_client->set_parameters( - { - rclcpp::Parameter("foo", 2), - rclcpp::Parameter("bar", "hello"), - rclcpp::Parameter("baz", 1.45), - rclcpp::Parameter("foobar", true), - rclcpp::Parameter("foobarbaz", std::vector({true, false})), - rclcpp::Parameter("toto", std::vector({0xff, 0x7f})), - }); - // Check to see if they were set. - for (auto & result : set_parameters_results) { - if (!result.successful) { - RCLCPP_ERROR(this->get_logger(), "Failed to set parameter: %s", result.reason.c_str()); - } - } - - std::stringstream ss; - // Get a few of the parameters just set. - for ( - auto & parameter : parameters_client->get_parameters( - {"foo", "baz", "foobarbaz", "toto"})) - { - ss << "\nParameter name: " << parameter.get_name(); - ss << "\nParameter value (" << parameter.get_type_name() << "): " << - parameter.value_to_string(); - } - RCLCPP_INFO(this->get_logger(), "%s", ss.str().c_str()); - - rclcpp::shutdown(); - } -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::SetAndGetParameters) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/set_and_get_parameters_async.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/set_and_get_parameters_async.cpp deleted file mode 100644 index e10d987..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/set_and_get_parameters_async.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2015 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" - -using namespace std::chrono_literals; - -int main(int argc, char ** argv) -{ - // Force flush of the stdout buffer. - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - - rclcpp::init(argc, argv); - - auto node = rclcpp::Node::make_shared("set_and_get_parameters_async"); - - // Declare parameters that may be set on this node - node->declare_parameter("foo", 0); - node->declare_parameter("bar", ""); - node->declare_parameter("baz", 0.); - node->declare_parameter("foobar", false); - node->declare_parameter("foobarbaz", std::vector{}); - node->declare_parameter("toto", std::vector{}); - - auto parameters_client = std::make_shared(node); - while (!parameters_client->wait_for_service(1s)) { - if (!rclcpp::ok()) { - RCLCPP_ERROR(node->get_logger(), "Interrupted while waiting for the service. Exiting."); - return 0; - } - RCLCPP_INFO(node->get_logger(), "service not available, waiting again..."); - } - - // Set several different types of parameters. - auto results = parameters_client->set_parameters( - { - rclcpp::Parameter("foo", 2), - rclcpp::Parameter("bar", "hello"), - rclcpp::Parameter("baz", 1.45), - rclcpp::Parameter("foobar", true), - rclcpp::Parameter("foobarbaz", std::vector({true, false})), - rclcpp::Parameter("toto", std::vector({0xff, 0x7f})), - }); - // Wait for the results. - if (rclcpp::spin_until_future_complete(node, results) != - rclcpp::FutureReturnCode::SUCCESS) - { - RCLCPP_ERROR(node->get_logger(), "set_parameters service call failed. Exiting tutorial."); - return -1; - } - // Check to see if they were set. - for (auto & result : results.get()) { - if (!result.successful) { - RCLCPP_ERROR(node->get_logger(), "Failed to set parameter: %s", result.reason.c_str()); - } - } - - // Get a few of the parameters just set. - auto parameters = parameters_client->get_parameters({"foo", "baz", "foobarbaz", "toto"}); - if (rclcpp::spin_until_future_complete(node, parameters) != - rclcpp::FutureReturnCode::SUCCESS) - { - RCLCPP_ERROR(node->get_logger(), "get_parameters service call failed. Exiting tutorial."); - return -1; - } - std::stringstream ss; - for (auto & parameter : parameters.get()) { - ss << "\nParameter name: " << parameter.get_name(); - ss << "\nParameter value (" << parameter.get_type_name() << "): " << - parameter.value_to_string(); - } - RCLCPP_INFO(node->get_logger(), "%s", ss.str().c_str()); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/set_parameters_callback.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/set_parameters_callback.cpp deleted file mode 100644 index 7cc8288..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/parameters/set_parameters_callback.cpp +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2022 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * Example usage: changing 'param1' successfully will result in setting of 'param2'. - * ros2 service call /set_param_callback_node/set_parameters rcl_interfaces/srv/SetParameters - "{parameters: [{name: "param1", value: {type: 3, double_value: 1.0}}]}" - */ - -#include - -#include "rclcpp/rclcpp.hpp" -#include "rcl_interfaces/msg/set_parameters_result.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -/** - * This example node demonstrates the usage of pre_set, on_set - * and post_set parameter callbacks - */ -namespace demo_nodes_cpp -{ -class SetParametersCallback : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit SetParametersCallback(const rclcpp::NodeOptions & options) - : Node("set_param_callback_node", options) - { - // Declare a parameter named "param1" in this node, with default value 1.0: - this->declare_parameter("param1", 1.0); - // Retrieve the value of 'param1' into a member variable 'value_1_'. - value_1_ = this->get_parameter("param1").as_double(); - - // Following statement does the same for 'param2' and 'value_2_', but in a more concise way: - value_2_ = this->declare_parameter("param2", 2.0); - - // Define a callback function that will be registered as the 'pre_set_parameters_callback': - // This callback is passed the list of the Parameter objects that are intended to be changed, - // and returns nothing. - // Through this callback it is possible to modify the upcoming changes by changing, - // adding or removing entries of the Parameter list. - // - // This callback should not change the state of the node (i.e. in this example - // the callback should not change 'value_1_' and 'value_2_'). - // - auto modify_upcoming_parameters_callback = - [](std::vector & parameters) { - // As an example: whenever "param1" is changed, "param2" is set to 4.0: - for (auto & param : parameters) { - if (param.get_name() == "param1") { - parameters.push_back(rclcpp::Parameter("param2", 4.0)); - } - } - }; - - - // Define a callback function that will be registered as the 'on_set_parameters_callback': - // The purpose of this callback is to allow the node to inspect the upcoming change - // to the parameters and explicitly approve or reject the change. - // If the change is rejected, no parameters are changed. - // - // This callback should not change the state of the node (i.e. in this example - // the callback should not change 'value_1_' and 'value_2_'). - // - auto validate_upcoming_parameters_callback = - [](std::vector parameters) { - rcl_interfaces::msg::SetParametersResult result; - result.successful = true; - - for (const auto & param : parameters) { - // As an example: no parameters are changed if a value > 5.0 is specified for 'param1', - // or a value < -5.0 for 'param2'. - if (param.get_name() == "param1") { - if (param.get_value() > 5.0) { - result.successful = false; - result.reason = "cannot set 'param1' > 5.0"; - break; - } - } else if (param.get_name() == "param2") { - if (param.get_value() < -5.0) { - result.successful = false; - result.reason = "cannot set 'param2' < -5.0"; - break; - } - } - } - - return result; - }; - - // Define a callback function that will be registered as the 'post_set_parameters_callback': - // This callback is passed a list of immutable Parameter objects, and returns nothing. - // The purpose of this callback is to react to changes from parameters - // that have successfully been accepted. - // - // This callback can change the internal state of the node. E.g.: - // - In this example the callback updates the local copies 'value_1_' and 'value_2_', - // - Another example could be to trigger recalculation of a kinematic model due to - // the change of link length parameters, - // - Yet another example could be to emit a signal for an HMI update, - // - Etc. - // - auto react_to_updated_parameters_callback = - [this](const std::vector & parameters) { - for (const auto & param : parameters) { - if (param.get_name() == "param1") { - value_1_ = param.get_value(); - RCLCPP_INFO(get_logger(), "Member variable 'value_1_' set to: %f.", value_1_); - } - if (param.get_name() == "param2") { - value_2_ = param.get_value(); - RCLCPP_INFO(get_logger(), "Member variable 'value_2_' set to: %f.", value_2_); - } - } - }; - - - // Register the callbacks: - // In this example all three callbacks are registered, but this is not mandatory - // The handles (i.e. the returned shared pointers) must be kept, as the callback - // is only registered as long as the shared pointer is alive. - pre_set_parameters_callback_handle_ = this->add_pre_set_parameters_callback( - modify_upcoming_parameters_callback); - on_set_parameters_callback_handle_ = this->add_on_set_parameters_callback( - validate_upcoming_parameters_callback); - post_set_parameters_callback_handle_ = this->add_post_set_parameters_callback( - react_to_updated_parameters_callback); - - - // Output some info: - RCLCPP_INFO(get_logger(), "This node demonstrates the use of parameter callbacks."); - RCLCPP_INFO(get_logger(), "As an example, it exhibits the following behavior:"); - RCLCPP_INFO( - get_logger(), - " * Two parameters of type double are declared in the node: 'param1' and 'param2'"); - RCLCPP_INFO(get_logger(), " * 'param1' cannot be set to a value > 5.0"); - RCLCPP_INFO(get_logger(), " * 'param2' cannot be set to a value < -5.0"); - RCLCPP_INFO(get_logger(), " * Each time 'param1' is set, 'param2' is automatically set to 4.0"); - RCLCPP_INFO( - get_logger(), - " * Member variables 'value_1_' and 'value_2_' are updated upon change of the parameters."); - RCLCPP_INFO(get_logger(), "To try it out set a parameter, e.g.:"); - RCLCPP_INFO(get_logger(), " ros2 param set set_param_callback_node param1 10.0"); - RCLCPP_INFO(get_logger(), " ros2 param set set_param_callback_node param1 3.0"); - RCLCPP_INFO(get_logger(), "The first command will fail."); - RCLCPP_INFO(get_logger(), "The 2nd command will set 'param1' to 3.0 and 'param2' to 4.0."); - } - -private: - rclcpp::node_interfaces::PreSetParametersCallbackHandle::SharedPtr - pre_set_parameters_callback_handle_; - rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr - on_set_parameters_callback_handle_; - rclcpp::node_interfaces::PostSetParametersCallbackHandle::SharedPtr - post_set_parameters_callback_handle_; - - double value_1_; - double value_2_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::SetParametersCallback) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_add_two_ints_client_async.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_add_two_ints_client_async.cpp deleted file mode 100644 index 8ff1946..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_add_two_ints_client_async.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "add_two_ints_client_async" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libadd_two_ints_client_async_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_add_two_ints_server.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_add_two_ints_server.cpp deleted file mode 100644 index 7bef898..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_add_two_ints_server.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "add_two_ints_server" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libadd_two_ints_server_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_add_two_ints_client_async.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_add_two_ints_client_async.cpp.in deleted file mode 100644 index e92c586..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_add_two_ints_client_async.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "add_two_ints_client_async" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_add_two_ints_server.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_add_two_ints_server.cpp.in deleted file mode 100644 index f6f1591..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_add_two_ints_server.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "add_two_ints_server" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_content_filtering_publisher.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_content_filtering_publisher.cpp.in deleted file mode 100644 index b621002..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_content_filtering_publisher.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "content_filtering_publisher" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_content_filtering_subscriber.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_content_filtering_subscriber.cpp.in deleted file mode 100644 index bf6f675..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_content_filtering_subscriber.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "content_filtering_subscriber" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_even_parameters_node.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_even_parameters_node.cpp.in deleted file mode 100644 index cc83c50..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_even_parameters_node.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "even_parameters_node" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_introspection_client.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_introspection_client.cpp.in deleted file mode 100644 index 5d7767e..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_introspection_client.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "introspection_client" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_introspection_service.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_introspection_service.cpp.in deleted file mode 100644 index 14ccab1..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_introspection_service.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "introspection_service" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_list_parameters.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_list_parameters.cpp.in deleted file mode 100644 index 20bee76..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_list_parameters.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "list_parameters" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_listener.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_listener.cpp.in deleted file mode 100644 index e95a78d..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_listener.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_listener_best_effort.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_listener_best_effort.cpp.in deleted file mode 100644 index a8e1ba4..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_listener_best_effort.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener_best_effort" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_listener_serialized_message.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_listener_serialized_message.cpp.in deleted file mode 100644 index f506d4c..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_listener_serialized_message.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener_serialized_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_one_off_timer.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_one_off_timer.cpp.in deleted file mode 100644 index 7b026bb..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_one_off_timer.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "one_off_timer" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_parameter_blackboard.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_parameter_blackboard.cpp.in deleted file mode 100644 index 696da24..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_parameter_blackboard.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "parameter_blackboard" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_parameter_events_async.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_parameter_events_async.cpp.in deleted file mode 100644 index b27233f..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_parameter_events_async.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "parameter_events_async" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_reuse_timer.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_reuse_timer.cpp.in deleted file mode 100644 index 5fd864c..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_reuse_timer.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "reuse_timer" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_set_and_get_parameters.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_set_and_get_parameters.cpp.in deleted file mode 100644 index 10c3301..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_set_and_get_parameters.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "set_and_get_parameters" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_set_parameters_callback.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_set_parameters_callback.cpp.in deleted file mode 100644 index 4d01782..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_set_parameters_callback.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "set_parameters_callback" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_talker.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_talker.cpp.in deleted file mode 100644 index fd11c9d..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_talker.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_talker_loaned_message.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_talker_loaned_message.cpp.in deleted file mode 100644 index 30abe75..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_talker_loaned_message.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker_loaned_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_talker_serialized_message.cpp.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_talker_serialized_message.cpp.in deleted file mode 100644 index 3e202aa..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_configured_talker_serialized_message.cpp.in +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker_serialized_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "$"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_content_filtering_publisher.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_content_filtering_publisher.cpp deleted file mode 100644 index 4070527..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_content_filtering_publisher.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "content_filtering_publisher" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libcontent_filtering_publisher_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_content_filtering_subscriber.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_content_filtering_subscriber.cpp deleted file mode 100644 index 0da6abc..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_content_filtering_subscriber.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "content_filtering_subscriber" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libcontent_filtering_subscriber_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_even_parameters_node.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_even_parameters_node.cpp deleted file mode 100644 index 8e6f4eb..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_even_parameters_node.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "even_parameters_node" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libeven_parameters_node_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_introspection_client.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_introspection_client.cpp deleted file mode 100644 index cf1295d..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_introspection_client.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "introspection_client" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libintrospection_client_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_introspection_service.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_introspection_service.cpp deleted file mode 100644 index 7737f59..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_introspection_service.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "introspection_service" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libintrospection_service_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_list_parameters.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_list_parameters.cpp deleted file mode 100644 index 342c7cd..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_list_parameters.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "list_parameters" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "liblist_parameters_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_listener.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_listener.cpp deleted file mode 100644 index c44a474..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_listener.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "liblistener_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_listener_best_effort.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_listener_best_effort.cpp deleted file mode 100644 index 9623436..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_listener_best_effort.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener_best_effort" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "liblistener_best_effort_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_listener_serialized_message.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_listener_serialized_message.cpp deleted file mode 100644 index 02c6dae..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_listener_serialized_message.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "listener_serialized_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "liblistener_serialized_message_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_one_off_timer.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_one_off_timer.cpp deleted file mode 100644 index 01c7979..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_one_off_timer.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "one_off_timer" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libone_off_timer_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_parameter_blackboard.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_parameter_blackboard.cpp deleted file mode 100644 index aec96bd..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_parameter_blackboard.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "parameter_blackboard" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libparameter_blackboard_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_parameter_events_async.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_parameter_events_async.cpp deleted file mode 100644 index 0096794..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_parameter_events_async.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "parameter_events_async" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libparameter_events_async_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_reuse_timer.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_reuse_timer.cpp deleted file mode 100644 index 581a2dd..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_reuse_timer.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "reuse_timer" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libreuse_timer_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_set_and_get_parameters.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_set_and_get_parameters.cpp deleted file mode 100644 index 6a6b8e6..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_set_and_get_parameters.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "set_and_get_parameters" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libset_and_get_parameters_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_set_parameters_callback.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_set_parameters_callback.cpp deleted file mode 100644 index 2b6da0e..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_set_parameters_callback.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "set_parameters_callback" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libset_parameters_callback_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_talker.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_talker.cpp deleted file mode 100644 index ac19d01..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_talker.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libtalker_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_talker_loaned_message.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_talker_loaned_message.cpp deleted file mode 100644 index 44526df..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_talker_loaned_message.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker_loaned_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libtalker_loaned_message_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_talker_serialized_message.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_talker_serialized_message.cpp deleted file mode 100644 index e31d614..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/rclcpp_components/node_main_talker_serialized_message.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "class_loader/class_loader.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/node_factory.hpp" -#include "rclcpp_components/node_factory_template.hpp" - -#define NODE_MAIN_LOGGER_NAME "talker_serialized_message" - -int main(int argc, char * argv[]) -{ - auto args = rclcpp::init_and_remove_ros_arguments(argc, argv); - rclcpp::Logger logger = rclcpp::get_logger(NODE_MAIN_LOGGER_NAME); - rclcpp::executors::SingleThreadedExecutor exec; - rclcpp::NodeOptions options; - options.arguments(args); - std::vector node_wrappers; - - std::string library_name = "libtalker_serialized_message_library.so"; - std::string class_name = "rclcpp_components::NodeFactoryTemplate"; - - RCLCPP_DEBUG(logger, "Load library %s", library_name.c_str()); - auto loader = std::make_unique(library_name); - auto classes = loader->getAvailableClasses(); - for (const auto & clazz : classes) { - std::string name = clazz.c_str(); - if (name.compare(class_name) == 0) { - RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str()); - std::shared_ptr node_factory = nullptr; - try { - node_factory = loader->createInstance(clazz); - } catch (const std::exception & ex) { - RCLCPP_ERROR(logger, "Failed to load library %s", ex.what()); - return 1; - } catch (...) { - RCLCPP_ERROR(logger, "Failed to load library"); - return 1; - } - auto wrapper = node_factory->create_node_instance(options); - auto node = wrapper.get_node_base_interface(); - node_wrappers.push_back(wrapper); - exec.add_node(node); - } - } - - exec.spin(); - - for (auto wrapper : node_wrappers) { - exec.remove_node(wrapper.get_node_base_interface()); - } - node_wrappers.clear(); - - rclcpp::shutdown(); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/add_two_ints_client.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/add_two_ints_client.cpp deleted file mode 100644 index 8442801..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/add_two_ints_client.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2014 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include - -#include "rclcpp/rclcpp.hpp" - -#include "example_interfaces/srv/add_two_ints.hpp" - -using namespace std::chrono_literals; - -// TODO(wjwwood): make this into a method of rclcpp::Client. -example_interfaces::srv::AddTwoInts::Response::SharedPtr send_request( - rclcpp::Node::SharedPtr node, - rclcpp::Client::SharedPtr client, - example_interfaces::srv::AddTwoInts::Request::SharedPtr request) -{ - auto result = client->async_send_request(request); - // Wait for the result. - if (rclcpp::spin_until_future_complete(node, result) == - rclcpp::FutureReturnCode::SUCCESS) - { - return result.get(); - } else { - return NULL; - } -} - -int main(int argc, char ** argv) -{ - // Force flush of the stdout buffer. - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - - rclcpp::init(argc, argv); - - auto node = rclcpp::Node::make_shared("add_two_ints_client"); - - auto client = node->create_client("add_two_ints"); - - auto request = std::make_shared(); - request->a = 2; - request->b = 3; - - while (!client->wait_for_service(1s)) { - if (!rclcpp::ok()) { - RCLCPP_ERROR(node->get_logger(), "Interrupted while waiting for the service. Exiting."); - return 0; - } - RCLCPP_INFO(node->get_logger(), "service not available, waiting again..."); - } - - // TODO(wjwwood): make it like `client->send_request(node, request)->sum` - // TODO(wjwwood): consider error condition - auto result = send_request(node, client, request); - if (result) { - RCLCPP_INFO_STREAM(node->get_logger(), "Result of add_two_ints: " << result->sum); - } else { - RCLCPP_ERROR(node->get_logger(), "Interrupted while waiting for response. Exiting."); - } - - rclcpp::shutdown(); - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/add_two_ints_client_async.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/add_two_ints_client_async.cpp deleted file mode 100644 index 69ee373..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/add_two_ints_client_async.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2014 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "example_interfaces/srv/add_two_ints.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -using namespace std::chrono_literals; - -namespace demo_nodes_cpp -{ -class ClientNode : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit ClientNode(const rclcpp::NodeOptions & options) - : Node("add_two_ints_client", options) - { - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - client_ = create_client("add_two_ints"); - queue_async_request(); - } - - DEMO_NODES_CPP_PUBLIC - void queue_async_request() - { - while (!client_->wait_for_service(1s)) { - if (!rclcpp::ok()) { - RCLCPP_ERROR(this->get_logger(), "Interrupted while waiting for the service. Exiting."); - return; - } - RCLCPP_INFO(this->get_logger(), "service not available, waiting again..."); - } - auto request = std::make_shared(); - request->a = 2; - request->b = 3; - - // We give the async_send_request() method a callback that will get executed once the response - // is received. - // This way we can return immediately from this method and allow other work to be done by the - // executor in `spin` while waiting for the response. - using ServiceResponseFuture = - rclcpp::Client::SharedFuture; - auto response_received_callback = [this](ServiceResponseFuture future) { - auto result = future.get(); - RCLCPP_INFO(this->get_logger(), "Result of add_two_ints: %" PRId64, result->sum); - rclcpp::shutdown(); - }; - auto future_result = client_->async_send_request(request, response_received_callback); - } - -private: - rclcpp::Client::SharedPtr client_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::ClientNode) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/add_two_ints_server.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/add_two_ints_server.cpp deleted file mode 100644 index fe2c0d9..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/add_two_ints_server.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2014 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "example_interfaces/srv/add_two_ints.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -namespace demo_nodes_cpp -{ - -class ServerNode final : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit ServerNode(const rclcpp::NodeOptions & options) - : Node("add_two_ints_server", options) - { - auto handle_add_two_ints = [this]( - const std::shared_ptr request_header, - const std::shared_ptr request, - std::shared_ptr response) -> void - { - (void)request_header; - RCLCPP_INFO( - this->get_logger(), "Incoming request\na: %" PRId64 " b: %" PRId64, - request->a, request->b); - response->sum = request->a + request->b; - - saw_request_ = true; - }; - // Create a service that will use the callback function to handle requests. - srv_ = create_service("add_two_ints", handle_add_two_ints); - - bool one_shot = this->declare_parameter("one_shot", false); - if (one_shot) { - timer_ = this->create_wall_timer( - std::chrono::milliseconds(100), - [this]() { - if (saw_request_) { - rclcpp::shutdown(); - } - }); - } - } - -private: - rclcpp::Service::SharedPtr srv_; - rclcpp::TimerBase::SharedPtr timer_; - bool saw_request_{false}; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::ServerNode) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/introspection_client.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/introspection_client.cpp deleted file mode 100644 index 53ca345..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/introspection_client.cpp +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2023 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "rcl/service_introspection.h" - -#include "rclcpp/qos.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "example_interfaces/srv/add_two_ints.hpp" -#include "rcl_interfaces/msg/set_parameters_result.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -// This demo program shows how to configure client introspection on the fly, -// by hooking it up to a parameter. This program consists of a client -// node (IntrospectionClientNode) that has a timer callback that runs every -// 500 milliseconds. If the service is not yet ready, no further work is done. -// If the client doesn't currently have a request in flight, then it creates a -// new AddTwoInts service request, and asynchronously sends it to the service. -// When that request completes, it sets the flag back to having no requests in -// flight so another request is sent. -// -// The above is a fairly common ROS 2 client, but what this program is trying -// to demonstrate is introspection capabilities. The IntrospectionClientNode -// has a string parameter called 'client_configure_introspection'. If this is -// set to 'disabled' (the default), then no introspection happens. If this is set -// to 'metadata' (see details on how to set the parameters below), then -// essential metadata (timestamps, sequence numbers, etc) is sent to a hidden -// topic called /add_two_ints/_service_event. -// -// To see this in action, run the following: -// -// ros2 launch demo_nodes_cpp introspect_services_launch.py -// Since the default for introspection is 'disabled', this is no different than -// a normal client and server. No additional topics will be made, and -// no introspection data will be sent. However, changing the introspection -// configuration dynamically is fully supported. This can be seen by -// running 'ros2 param set /introspection_client client_configure_introspection metadata' -// which will configure the client to start sending service introspection -// metadata to /add_two_ints/_service_event. -// -// Once the parameter is set, introspection data can be seen by running: -// ros2 topic echo /add_two_ints/_service_event - -namespace demo_nodes_cpp -{ -class IntrospectionClientNode : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit IntrospectionClientNode(const rclcpp::NodeOptions & options) - : Node("introspection_client", options) - { - client_ = create_client("add_two_ints"); - - auto on_set_parameter_callback = - [](std::vector parameters) { - rcl_interfaces::msg::SetParametersResult result; - result.successful = true; - for (const rclcpp::Parameter & param : parameters) { - if (param.get_name() != "client_configure_introspection") { - continue; - } - - if (param.get_type() != rclcpp::ParameterType::PARAMETER_STRING) { - result.successful = false; - result.reason = "must be a string"; - break; - } - - if (param.as_string() != "disabled" && param.as_string() != "metadata" && - param.as_string() != "contents") - { - result.successful = false; - result.reason = "must be one of 'disabled', 'metadata', or 'contents'"; - break; - } - } - - return result; - }; - - auto post_set_parameter_callback = - [this](const std::vector & parameters) { - for (const rclcpp::Parameter & param : parameters) { - if (param.get_name() != "client_configure_introspection") { - continue; - } - - rcl_service_introspection_state_t introspection_state = RCL_SERVICE_INTROSPECTION_OFF; - - if (param.as_string() == "disabled") { - introspection_state = RCL_SERVICE_INTROSPECTION_OFF; - } else if (param.as_string() == "metadata") { - introspection_state = RCL_SERVICE_INTROSPECTION_METADATA; - } else if (param.as_string() == "contents") { - introspection_state = RCL_SERVICE_INTROSPECTION_CONTENTS; - } - - this->client_->configure_introspection( - this->get_clock(), rclcpp::SystemDefaultsQoS(), introspection_state); - break; - } - }; - - on_set_parameters_callback_handle_ = this->add_on_set_parameters_callback( - on_set_parameter_callback); - post_set_parameters_callback_handle_ = this->add_post_set_parameters_callback( - post_set_parameter_callback); - - this->declare_parameter("client_configure_introspection", "disabled"); - - timer_ = this->create_wall_timer( - std::chrono::milliseconds(500), - [this]() { - if (!client_->service_is_ready()) { - return; - } - - if (!request_in_progress_) { - auto request = std::make_shared(); - request->a = 2; - request->b = 3; - request_in_progress_ = true; - client_->async_send_request( - request, - [this](rclcpp::Client::SharedFuture cb_f) - { - request_in_progress_ = false; - RCLCPP_INFO(get_logger(), "Result of add_two_ints: %ld", cb_f.get()->sum); - } - ); - return; - } - }); - } - -private: - rclcpp::Client::SharedPtr client_; - rclcpp::TimerBase::SharedPtr timer_; - rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr - on_set_parameters_callback_handle_; - rclcpp::node_interfaces::PostSetParametersCallbackHandle::SharedPtr - post_set_parameters_callback_handle_; - bool request_in_progress_{false}; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::IntrospectionClientNode) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/introspection_service.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/introspection_service.cpp deleted file mode 100644 index 16078bc..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/services/introspection_service.cpp +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2023 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "rcl/service_introspection.h" - -#include "rclcpp/qos.hpp" -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "example_interfaces/srv/add_two_ints.hpp" -#include "rcl_interfaces/msg/set_parameters_result.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -// This demo program shows how to configure service introspection on the fly, -// by hooking it up to a parameter. This program consists of a service -// node (IntrospectionServiceNode) that listens on the '/add_two_ints' service -// for clients. When one connects and sends a request, it adds the two integers -// and returns the result. -// -// The above is a fairly common ROS 2 service, but what this program is trying -// to demonstrate is introspection capabilities. The IntrospectionServiceNode -// has a string parameter called 'service_configure_introspection'. If this is -// set to 'disabled' (the default), then no introspection happens. If this is set -// to 'metadata' (see details on how to set the parameters below), then -// essential metadata (timestamps, sequence numbers, etc) is sent to a hidden -// topic called /add_two_ints/_service_event. -// -// To see this in action, run the following: -// -// ros2 launch demo_nodes_cpp introspect_services_launch.py -// Since the default for introspection is 'disabled', this is no different than -// a normal client and server. No additional topics will be made, and -// no introspection data will be sent. However, changing the introspection -// configuration dynamically is fully supported. This can be seen by -// running 'ros2 param set /introspection_service service_configure_introspection metadata' -// which will configure the service to start sending service introspection -// metadata to /add_two_ints/_service_event. -// -// Once the parameter is set, introspection data can be seen by running: -// ros2 topic echo /add_two_ints/_service_event - -namespace demo_nodes_cpp -{ - -class IntrospectionServiceNode : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit IntrospectionServiceNode(const rclcpp::NodeOptions & options) - : Node("introspection_service", options) - { - auto handle_add_two_ints = [this]( - const std::shared_ptr request_header, - const std::shared_ptr request, - std::shared_ptr response) -> void - { - (void)request_header; - RCLCPP_INFO( - this->get_logger(), "Incoming request\na: %" PRId64 " b: %" PRId64, - request->a, request->b); - response->sum = request->a + request->b; - }; - // Create a service that will use the callback function to handle requests. - srv_ = create_service("add_two_ints", handle_add_two_ints); - - auto on_set_parameter_callback = - [](std::vector parameters) { - rcl_interfaces::msg::SetParametersResult result; - result.successful = true; - for (const rclcpp::Parameter & param : parameters) { - if (param.get_name() != "service_configure_introspection") { - continue; - } - - if (param.get_type() != rclcpp::ParameterType::PARAMETER_STRING) { - result.successful = false; - result.reason = "must be a string"; - break; - } - - if (param.as_string() != "disabled" && param.as_string() != "metadata" && - param.as_string() != "contents") - { - result.successful = false; - result.reason = "must be one of 'disabled', 'metadata', or 'contents'"; - break; - } - } - - return result; - }; - - auto post_set_parameter_callback = - [this](const std::vector & parameters) { - for (const rclcpp::Parameter & param : parameters) { - if (param.get_name() != "service_configure_introspection") { - continue; - } - - rcl_service_introspection_state_t introspection_state = RCL_SERVICE_INTROSPECTION_OFF; - - if (param.as_string() == "disabled") { - introspection_state = RCL_SERVICE_INTROSPECTION_OFF; - } else if (param.as_string() == "metadata") { - introspection_state = RCL_SERVICE_INTROSPECTION_METADATA; - } else if (param.as_string() == "contents") { - introspection_state = RCL_SERVICE_INTROSPECTION_CONTENTS; - } - - this->srv_->configure_introspection( - this->get_clock(), rclcpp::SystemDefaultsQoS(), introspection_state); - break; - } - }; - - on_set_parameters_callback_handle_ = this->add_on_set_parameters_callback( - on_set_parameter_callback); - post_set_parameters_callback_handle_ = this->add_post_set_parameters_callback( - post_set_parameter_callback); - - this->declare_parameter("service_configure_introspection", "disabled"); - } - -private: - rclcpp::Service::SharedPtr srv_; - rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr - on_set_parameters_callback_handle_; - rclcpp::node_interfaces::PostSetParametersCallbackHandle::SharedPtr - post_set_parameters_callback_handle_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::IntrospectionServiceNode) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/timers/one_off_timer.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/timers/one_off_timer.cpp deleted file mode 100644 index 02151de..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/timers/one_off_timer.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2017 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -using namespace std::chrono_literals; - -namespace demo_nodes_cpp -{ - -class OneOffTimerNode final : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit OneOffTimerNode(const rclcpp::NodeOptions & options) - : Node("one_off_timer", options), count_(0) - { - periodic_timer_ = this->create_wall_timer( - 2s, - [this]() { - RCLCPP_INFO(this->get_logger(), "in periodic_timer callback"); - if (this->count_++ % 3 == 0) { - RCLCPP_INFO(this->get_logger(), " resetting one off timer"); - this->one_off_timer_ = this->create_wall_timer( - 1s, [this]() { - RCLCPP_INFO(this->get_logger(), "in one_off_timer callback"); - this->one_off_timer_->cancel(); - }); - } else { - RCLCPP_INFO(this->get_logger(), " not resetting one off timer"); - } - }); - } - -private: - rclcpp::TimerBase::SharedPtr periodic_timer_; - rclcpp::TimerBase::SharedPtr one_off_timer_; - size_t count_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::OneOffTimerNode) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/timers/reuse_timer.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/timers/reuse_timer.cpp deleted file mode 100644 index 7806491..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/timers/reuse_timer.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2017 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" -#include "demo_nodes_cpp/visibility_control.h" - -using namespace std::chrono_literals; - -namespace demo_nodes_cpp -{ - -class ReuseTimerNode final : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit ReuseTimerNode(const rclcpp::NodeOptions & options) - : Node("reuse_timer", options), count_(0) - { - one_off_timer_ = this->create_wall_timer( - 1s, - [this]() { - RCLCPP_INFO(this->get_logger(), "in one_off_timer callback"); - this->one_off_timer_->cancel(); - }); - // cancel immediately to prevent it running the first time. - one_off_timer_->cancel(); - - periodic_timer_ = this->create_wall_timer( - 2s, - [this]() { - RCLCPP_INFO(this->get_logger(), "in periodic_timer callback"); - if (this->count_++ % 3 == 0) { - RCLCPP_INFO(this->get_logger(), " resetting one off timer"); - this->one_off_timer_->reset(); - } else { - RCLCPP_INFO(this->get_logger(), " not resetting one off timer"); - } - }); - } - -private: - rclcpp::TimerBase::SharedPtr periodic_timer_; - rclcpp::TimerBase::SharedPtr one_off_timer_; - size_t count_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::ReuseTimerNode) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/allocator_tutorial_custom.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/allocator_tutorial_custom.cpp deleted file mode 100644 index 81aeeed..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/allocator_tutorial_custom.cpp +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright 2015 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp/allocator/allocator_common.hpp" -#include "rclcpp/strategies/allocator_memory_strategy.hpp" -#include "std_msgs/msg/u_int32.hpp" - -using namespace std::chrono_literals; - -// For demonstration purposes only, not necessary for allocator_traits -static uint32_t num_allocs = 0; -static uint32_t num_deallocs = 0; -// A very simple custom allocator. Counts calls to allocate and deallocate. -template -struct MyAllocator -{ -public: - using value_type = T; - using size_type = std::size_t; - using pointer = T *; - using const_pointer = const T *; - using difference_type = typename std::pointer_traits::difference_type; - - MyAllocator() noexcept - { - } - - ~MyAllocator() noexcept {} - - template - MyAllocator(const MyAllocator &) noexcept - { - } - - T * allocate(size_t size, const void * = 0) - { - if (size == 0) { - return nullptr; - } - num_allocs++; - return static_cast(std::malloc(size * sizeof(T))); - } - - void deallocate(T * ptr, size_t size) - { - (void)size; - if (!ptr) { - return; - } - num_deallocs++; - std::free(ptr); - } - - template - struct rebind - { - typedef MyAllocator other; - }; -}; - -template -constexpr bool operator==( - const MyAllocator &, - const MyAllocator &) noexcept -{ - return true; -} - -template -constexpr bool operator!=( - const MyAllocator &, - const MyAllocator &) noexcept -{ - return false; -} - -// Override global new and delete to count calls during execution. - -static bool is_running = false; -static uint32_t global_runtime_allocs = 0; -static uint32_t global_runtime_deallocs = 0; - -void * operator new(std::size_t size) -{ - if (is_running) { - global_runtime_allocs++; - } - return std::malloc(size); -} - -void operator delete(void * ptr, size_t size) noexcept -{ - (void)size; - if (ptr != nullptr) { - if (is_running) { - global_runtime_deallocs++; - } - std::free(ptr); - } -} - -void operator delete(void * ptr) noexcept -{ - if (ptr != nullptr) { - if (is_running) { - global_runtime_deallocs++; - } - std::free(ptr); - } -} - -int main(int argc, char ** argv) -{ - using rclcpp::memory_strategies::allocator_memory_strategy::AllocatorMemoryStrategy; - using Alloc = MyAllocator; - using MessageAllocTraits = - rclcpp::allocator::AllocRebind; - using MessageAlloc = MessageAllocTraits::allocator_type; - using MessageDeleter = rclcpp::allocator::Deleter; - using MessageUniquePtr = std::unique_ptr; - rclcpp::init(argc, argv); - - rclcpp::Node::SharedPtr node; - - std::list keys = {"intra", "intraprocess", "intra-process", "intra_process"}; - bool intra_process = false; - - printf( - "This simple demo shows off a custom memory allocator to count all\n" - "instances of new/delete in the program. It can be run in either regular\n" - "mode (no arguments), or in intra-process mode (by passing 'intra' as a\n" - "command-line argument). It will then publish a message to the\n" - "'/allocator_tutorial' topic every 10 milliseconds until Ctrl-C is pressed.\n" - "At that time it will print a count of the number of allocations and\n" - "deallocations that happened during the program.\n\n"); - - if (argc > 1) { - for (auto & key : keys) { - if (std::string(argv[1]) == key) { - intra_process = true; - break; - } - } - } - - if (intra_process) { - printf("Intra-process pipeline is ON.\n"); - auto context = rclcpp::contexts::get_global_default_context(); - auto options = rclcpp::NodeOptions() - .context(context) - .use_intra_process_comms(true); - - node = rclcpp::Node::make_shared("allocator_tutorial", options); - } else { - auto options = rclcpp::NodeOptions() - .use_intra_process_comms(false); - printf("Intra-process pipeline is OFF.\n"); - node = rclcpp::Node::make_shared("allocator_tutorial", options); - } - - uint32_t counter = 0; - auto callback = [&counter](std_msgs::msg::UInt32::ConstSharedPtr msg) -> void - { - (void)msg; - ++counter; - }; - - // Create a custom allocator and pass the allocator to the publisher and subscriber. - auto alloc = std::make_shared(); - rclcpp::PublisherOptionsWithAllocator publisher_options; - publisher_options.allocator = alloc; - auto publisher = node->create_publisher( - "allocator_tutorial", 10, publisher_options); - - rclcpp::SubscriptionOptionsWithAllocator subscription_options; - subscription_options.allocator = alloc; - auto msg_mem_strat = std::make_shared< - rclcpp::message_memory_strategy::MessageMemoryStrategy< - std_msgs::msg::UInt32, Alloc>>(alloc); - auto subscriber = node->create_subscription( - "allocator_tutorial", 10, callback, subscription_options, msg_mem_strat); - - // Create a MemoryStrategy, which handles the allocations made by the Executor during the - // execution path, and inject the MemoryStrategy into the Executor. - std::shared_ptr memory_strategy = - std::make_shared>(alloc); - - rclcpp::ExecutorOptions options; - options.memory_strategy = memory_strategy; - rclcpp::executors::SingleThreadedExecutor executor(options); - - // Add our node to the executor. - executor.add_node(node); - - MessageDeleter message_deleter; - MessageAlloc message_alloc = *alloc; - rclcpp::allocator::set_allocator_for_deleter(&message_deleter, &message_alloc); - - rclcpp::sleep_for(1ms); - is_running = true; - - uint32_t i = 0; - while (rclcpp::ok()) { - // Create a message with the custom allocator, so that when the Executor deallocates the - // message on the execution path, it will use the custom deallocate. - auto ptr = MessageAllocTraits::allocate(message_alloc, 1); - MessageAllocTraits::construct(message_alloc, ptr); - MessageUniquePtr msg(ptr, message_deleter); - msg->data = i; - ++i; - publisher->publish(std::move(msg)); - rclcpp::sleep_for(10ms); - executor.spin_some(); - } - is_running = false; - - uint32_t final_global_allocs = global_runtime_allocs; - uint32_t final_global_deallocs = global_runtime_deallocs; - printf("Global new was called %u times during spin\n", final_global_allocs); - printf("Global delete was called %u times during spin\n", final_global_deallocs); - - printf("Allocator new was called %u times during spin\n", num_allocs); - printf("Allocator delete was called %u times during spin\n", num_deallocs); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/allocator_tutorial_pmr.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/allocator_tutorial_pmr.cpp deleted file mode 100644 index 000e901..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/allocator_tutorial_pmr.cpp +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright 2015 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp/allocator/allocator_common.hpp" -#include "rclcpp/strategies/allocator_memory_strategy.hpp" -#include "std_msgs/msg/u_int32.hpp" - -using namespace std::chrono_literals; - -// For demonstration purposes only, not necessary for allocator_traits -static uint32_t num_allocs = 0; -static uint32_t num_deallocs = 0; -// A very simple custom memory resource. Counts calls to do_allocate and do_deallocate. -class CustomMemoryResource : public std::pmr::memory_resource -{ -private: - void * do_allocate(std::size_t bytes, std::size_t alignment) override - { - num_allocs++; - (void)alignment; - return std::malloc(bytes); - } - - void do_deallocate( - void * p, std::size_t bytes, - std::size_t alignment) override - { - num_deallocs++; - (void)bytes; - (void)alignment; - std::free(p); - } - - bool do_is_equal( - const std::pmr::memory_resource & other) const noexcept override - { - return this == &other; - } -}; - - -// Override global new and delete to count calls during execution. - -static bool is_running = false; -static uint32_t global_runtime_allocs = 0; -static uint32_t global_runtime_deallocs = 0; - -// Due to GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103993, we -// always inline the overridden new and delete operators. - -#if defined(__GNUC__) || defined(__clang__) -#define NOINLINE __attribute__((noinline)) -#else -#define NOINLINE -#endif - -NOINLINE void * operator new(std::size_t size) -{ - if (size == 0) { - ++size; - } - - if (is_running) { - global_runtime_allocs++; - } - - void * ptr = std::malloc(size); - if (ptr != nullptr) { - return ptr; - } - - throw std::bad_alloc{}; -} - -NOINLINE void operator delete(void * ptr, size_t size) noexcept -{ - (void)size; - if (ptr != nullptr) { - if (is_running) { - global_runtime_deallocs++; - } - std::free(ptr); - } -} - -NOINLINE void operator delete(void * ptr) noexcept -{ - if (ptr != nullptr) { - if (is_running) { - global_runtime_deallocs++; - } - std::free(ptr); - } -} - -int main(int argc, char ** argv) -{ - using rclcpp::memory_strategies::allocator_memory_strategy::AllocatorMemoryStrategy; - using Alloc = std::pmr::polymorphic_allocator; - using MessageAllocTraits = - rclcpp::allocator::AllocRebind; - using MessageAlloc = MessageAllocTraits::allocator_type; - using MessageDeleter = rclcpp::allocator::Deleter; - using MessageUniquePtr = std::unique_ptr; - rclcpp::init(argc, argv); - - rclcpp::Node::SharedPtr node; - - std::list keys = {"intra", "intraprocess", "intra-process", "intra_process"}; - bool intra_process = false; - - printf( - "This simple demo shows off a custom memory allocator to count all\n" - "instances of new/delete in the program. It can be run in either regular\n" - "mode (no arguments), or in intra-process mode (by passing 'intra' as a\n" - "command-line argument). It will then publish a message to the\n" - "'/allocator_tutorial' topic every 10 milliseconds until Ctrl-C is pressed.\n" - "At that time it will print a count of the number of allocations and\n" - "deallocations that happened during the program.\n\n"); - - if (argc > 1) { - for (auto & key : keys) { - if (std::string(argv[1]) == key) { - intra_process = true; - break; - } - } - } - - if (intra_process) { - printf("Intra-process pipeline is ON.\n"); - auto context = rclcpp::contexts::get_global_default_context(); - auto options = rclcpp::NodeOptions() - .context(context) - .use_intra_process_comms(true); - - node = rclcpp::Node::make_shared("allocator_tutorial", options); - } else { - auto options = rclcpp::NodeOptions() - .use_intra_process_comms(false); - printf("Intra-process pipeline is OFF.\n"); - node = rclcpp::Node::make_shared("allocator_tutorial", options); - } - - uint32_t counter = 0; - auto callback = [&counter](std_msgs::msg::UInt32::ConstSharedPtr msg) -> void - { - (void)msg; - ++counter; - }; - - // Create a custom allocator and pass the allocator to the publisher and subscriber. - CustomMemoryResource mem_resource{}; - auto alloc = std::make_shared(&mem_resource); - rclcpp::PublisherOptionsWithAllocator publisher_options; - publisher_options.allocator = alloc; - auto publisher = node->create_publisher( - "allocator_tutorial", 10, publisher_options); - - rclcpp::SubscriptionOptionsWithAllocator subscription_options; - subscription_options.allocator = alloc; - auto msg_mem_strat = std::make_shared< - rclcpp::message_memory_strategy::MessageMemoryStrategy< - std_msgs::msg::UInt32, Alloc>>(alloc); - auto subscriber = node->create_subscription( - "allocator_tutorial", 10, callback, subscription_options, msg_mem_strat); - - // Create a MemoryStrategy, which handles the allocations made by the Executor during the - // execution path, and inject the MemoryStrategy into the Executor. - std::shared_ptr memory_strategy = - std::make_shared>(alloc); - - rclcpp::ExecutorOptions options; - options.memory_strategy = memory_strategy; - rclcpp::executors::SingleThreadedExecutor executor(options); - - // Add our node to the executor. - executor.add_node(node); - - MessageDeleter message_deleter; - MessageAlloc message_alloc = *alloc; - rclcpp::allocator::set_allocator_for_deleter(&message_deleter, &message_alloc); - - rclcpp::sleep_for(1ms); - is_running = true; - - uint32_t i = 0; - while (rclcpp::ok()) { - // Create a message with the custom allocator, so that when the Executor deallocates the - // message on the execution path, it will use the custom deallocate. - auto ptr = MessageAllocTraits::allocate(message_alloc, 1); - MessageAllocTraits::construct(message_alloc, ptr); - MessageUniquePtr msg(ptr, message_deleter); - msg->data = i; - ++i; - publisher->publish(std::move(msg)); - rclcpp::sleep_for(10ms); - executor.spin_some(); - } - is_running = false; - - uint32_t final_global_allocs = global_runtime_allocs; - uint32_t final_global_deallocs = global_runtime_deallocs; - printf("Global new was called %u times during spin\n", final_global_allocs); - printf("Global delete was called %u times during spin\n", final_global_deallocs); - - printf("Allocator new was called %u times during spin\n", num_allocs); - printf("Allocator delete was called %u times during spin\n", num_deallocs); - - return 0; -} diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/content_filtering_publisher.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/content_filtering_publisher.cpp deleted file mode 100644 index 9997c99..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/content_filtering_publisher.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2022 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "std_msgs/msg/float32.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -namespace demo_nodes_cpp -{ -// The simulated temperature data starts from -100.0 and ends at 150.0 with a step size of 10.0 -constexpr std::array TEMPERATURE_SETTING {-100.0f, 150.0f, 10.0f}; - -// Create a ContentFilteringPublisher class that subclasses the generic rclcpp::Node base class. -// The main function below will instantiate the class as a ROS node. -class ContentFilteringPublisher final : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit ContentFilteringPublisher(const rclcpp::NodeOptions & options) - : Node("content_filtering_publisher", options) - { - // Create a function for when messages are to be sent. - auto publish_message = - [this]() -> void - { - msg_ = std::make_unique(); - msg_->data = temperature_; - temperature_ += TEMPERATURE_SETTING[2]; - if (temperature_ > TEMPERATURE_SETTING[1]) { - temperature_ = TEMPERATURE_SETTING[0]; - } - RCLCPP_INFO(this->get_logger(), "Publishing: '%f'", msg_->data); - // Put the message into a queue to be processed by the middleware. - // This call is non-blocking. - pub_->publish(std::move(msg_)); - }; - // Create a publisher with a custom Quality of Service profile. - // Uniform initialization is suggested so it can be trivially changed to - // rclcpp::KeepAll{} if the user wishes. - // (rclcpp::KeepLast(7) -> rclcpp::KeepAll() fails to compile) - rclcpp::QoS qos(rclcpp::KeepLast{7}); - pub_ = this->create_publisher("temperature", qos); - - int64_t publish_ms = this->declare_parameter("publish_ms", 1000); - - // Use a timer to schedule periodic message publishing. - timer_ = this->create_wall_timer(std::chrono::milliseconds(publish_ms), publish_message); - } - -private: - float temperature_ = TEMPERATURE_SETTING[0]; - std::unique_ptr msg_; - rclcpp::Publisher::SharedPtr pub_; - rclcpp::TimerBase::SharedPtr timer_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::ContentFilteringPublisher) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/content_filtering_subscriber.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/content_filtering_subscriber.cpp deleted file mode 100644 index dce89f0..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/content_filtering_subscriber.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2022 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" -#include "rcpputils/join.hpp" - -#include "std_msgs/msg/float32.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -namespace demo_nodes_cpp -{ -// Emergency temperature data less than -30 or greater than 100 -constexpr std::array EMERGENCY_TEMPERATURE {-30.0f, 100.0f}; - -// Create a ContentFilteringSubscriber class that subclasses the generic rclcpp::Node base class. -// The main function below will instantiate the class as a ROS node. -class ContentFilteringSubscriber : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit ContentFilteringSubscriber(const rclcpp::NodeOptions & options) - : Node("content_filtering_subscriber", options) - { - // Create a callback function for when messages are received. - auto callback = - [this](const std_msgs::msg::Float32 & msg) -> void - { - if (msg.data < EMERGENCY_TEMPERATURE[0] || msg.data > EMERGENCY_TEMPERATURE[1]) { - RCLCPP_INFO( - this->get_logger(), - "I receive an emergency temperature data: [%f]", msg.data); - } else { - RCLCPP_INFO(this->get_logger(), "I receive a temperature data: [%f]", msg.data); - } - }; - - // Initialize a subscription with a content filter to receive emergency temperature data that - // are less than -30 or greater than 100. - rclcpp::SubscriptionOptions sub_options; - sub_options.content_filter_options.filter_expression = "data < %0 OR data > %1"; - sub_options.content_filter_options.expression_parameters = { - std::to_string(EMERGENCY_TEMPERATURE[0]), - std::to_string(EMERGENCY_TEMPERATURE[1]) - }; - - sub_ = create_subscription("temperature", 10, callback, sub_options); - - if (!sub_->is_cft_enabled()) { - RCLCPP_WARN( - this->get_logger(), "Content filter is not enabled since it's not supported"); - } else { - RCLCPP_INFO( - this->get_logger(), - "subscribed to topic \"%s\" with content filter options \"%s, {%s}\"", - sub_->get_topic_name(), - sub_options.content_filter_options.filter_expression.c_str(), - rcpputils::join(sub_options.content_filter_options.expression_parameters, ", ").c_str()); - } - } - -private: - rclcpp::Subscription::SharedPtr sub_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::ContentFilteringSubscriber) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/listener.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/listener.cpp deleted file mode 100644 index 5cc61a6..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/listener.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2014 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "std_msgs/msg/string.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -namespace demo_nodes_cpp -{ -// Create a Listener class that subclasses the generic rclcpp::Node base class. -// The main function below will instantiate the class as a ROS node. -class Listener : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit Listener(const rclcpp::NodeOptions & options) - : Node("listener", options) - { - // Create a callback function for when messages are received. - // Variations of this function also exist using, for example UniquePtr for zero-copy transport. - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - auto callback = - [this](std_msgs::msg::String::ConstSharedPtr msg) -> void - { - RCLCPP_INFO(this->get_logger(), "Receiving: [%s]", msg->data.c_str()); - }; - // Create a subscription to the topic which can be matched with one or more compatible ROS - // publishers. - // Note that not all publishers on the same topic with the same type will be compatible: - // they must have compatible Quality of Service policies. - sub_ = create_subscription("chatter", 10, callback); - } - -private: - rclcpp::Subscription::SharedPtr sub_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::Listener) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/listener_best_effort.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/listener_best_effort.cpp deleted file mode 100644 index 5d1954f..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/listener_best_effort.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" -#include "std_msgs/msg/string.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -namespace demo_nodes_cpp -{ -class ListenerBestEffort : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit ListenerBestEffort(const rclcpp::NodeOptions & options) - : Node("listener", options) - { - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - auto callback = - [this](std_msgs::msg::String::ConstSharedPtr msg) -> void - { - RCLCPP_INFO(this->get_logger(), "I heard: [%s]", msg->data.c_str()); - }; - - sub_ = create_subscription("chatter", rclcpp::SensorDataQoS(), callback); - } - -private: - rclcpp::Subscription::SharedPtr sub_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::ListenerBestEffort) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/listener_serialized_message.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/listener_serialized_message.cpp deleted file mode 100644 index 005ea0f..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/listener_serialized_message.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2017 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp/serialization.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "std_msgs/msg/string.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -namespace demo_nodes_cpp -{ -// Create a Listener class that subclasses the generic rclcpp::Node base class. -// The main function below will instantiate the class as a ROS node. -class SerializedMessageListener : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit SerializedMessageListener(const rclcpp::NodeOptions & options) - : Node("serialized_message_listener", options) - { - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - // We create a callback to a rmw_serialized_message_t here. This will pass a serialized - // message to the callback. We can then further deserialize it and convert it into - // a ros2 compliant message. - auto callback = - [](const std::shared_ptr msg) -> void - { - // Print the serialized data message in HEX representation - // This output corresponds to what you would see in e.g. Wireshark - // when tracing the RTPS packets. - std::cout << "I heard data of length: " << msg->size() << std::endl; - for (size_t i = 0; i < msg->size(); ++i) { - printf("%02x ", msg->get_rcl_serialized_message().buffer[i]); - } - printf("\n"); - - // In order to deserialize the message we have to manually create a ROS 2 - // message in which we want to convert the serialized data. - using MessageT = std_msgs::msg::String; - MessageT string_msg; - auto serializer = rclcpp::Serialization(); - serializer.deserialize_message(msg.get(), &string_msg); - // Finally print the ROS 2 message data - std::cout << "serialized data after deserialization: " << string_msg.data << std::endl; - }; - // Create a subscription to the topic which can be matched with one or more compatible ROS - // publishers. - // Note that not all publishers on the same topic with the same type will be compatible: - // they must have compatible Quality of Service policies. - sub_ = create_subscription("chatter", 10, callback); - } - -private: - rclcpp::Subscription::SharedPtr sub_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::SerializedMessageListener) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/talker.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/talker.cpp deleted file mode 100644 index 448bd29..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/talker.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2014 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "std_msgs/msg/string.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -using namespace std::chrono_literals; - -namespace demo_nodes_cpp -{ -// Create a Talker class that subclasses the generic rclcpp::Node base class. -// The main function below will instantiate the class as a ROS node. -class Talker : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit Talker(const rclcpp::NodeOptions & options) - : Node("talker", options) - { - // Create a function for when messages are to be sent. - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - auto publish_message = - [this]() -> void - { - msg_ = std::make_unique(); - msg_->data = "Heartbeat messages: " + std::to_string(count_++); - RCLCPP_INFO(this->get_logger(), "Publishing: '%s'", msg_->data.c_str()); - // Put the message into a queue to be processed by the middleware. - // This call is non-blocking. - pub_->publish(std::move(msg_)); - }; - // Create a publisher with a custom Quality of Service profile. - // Uniform initialization is suggested so it can be trivially changed to - // rclcpp::KeepAll{} if the user wishes. - // (rclcpp::KeepLast(7) -> rclcpp::KeepAll() fails to compile) - rclcpp::QoS qos(rclcpp::KeepLast{7}); - pub_ = this->create_publisher("chatter", qos); - - // Use a timer to schedule periodic message publishing. - timer_ = this->create_wall_timer(1s, publish_message); - } - -private: - size_t count_ = 1; - std::unique_ptr msg_; - rclcpp::Publisher::SharedPtr pub_; - rclcpp::TimerBase::SharedPtr timer_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::Talker) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/talker_loaned_message.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/talker_loaned_message.cpp deleted file mode 100644 index e098741..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/talker_loaned_message.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2019 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "std_msgs/msg/float64.hpp" -#include "std_msgs/msg/string.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -using namespace std::chrono_literals; - -namespace demo_nodes_cpp -{ -// Create a Talker class that subclasses the generic rclcpp::Node base class. -// The main function below will instantiate the class as a ROS node. -class LoanedMessageTalker : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit LoanedMessageTalker(const rclcpp::NodeOptions & options) - : Node("loaned_message_talker", options) - { - // Create a function for when messages are to be sent. - setvbuf(stdout, NULL, _IONBF, BUFSIZ); - - // We differentiate in this demo between two fundamental message types - POD and non-POD - // PODs are plain old data types, meaning all the data of its type is encapsulated within - // the structure and does not require any heap allocation or dynamic resizing. - // non-PODs are essentially the opposite where the data size changes during runtime. - // All containers (including Strings) are such non-PODs. - // Most middlewares won't be able to loan non-POD datatypes. - // We thus feature two publishers in this demo where both, a POD and non-POD message - // will be used to publish data. - // The take-away for this is that the rclcpp API for message loaning can cope with - // either POD and non-POD transparently. - auto publish_message = - [this]() -> void - { - // We loan a message here and don't allocate the memory on the stack. - // For middlewares which support message loaning, this means the middleware - // completely owns the memory for this message. - // This enables a zero-copy message transport for middlewares with shared memory - // capabilities. - // If the middleware doesn't support this, the loaned message will be allocated - // with the allocator instance provided by the publisher. - auto pod_loaned_msg = pod_pub_->borrow_loaned_message(); - auto pod_msg_data = static_cast(count_); - pod_loaned_msg.get().data = pod_msg_data; - RCLCPP_INFO(this->get_logger(), "Publishing: '%f'", pod_msg_data); - // As the middleware might own the memory allocated for this message, - // a call to publish explicitly transfers ownership back to the middleware. - // The loaned message instance is thus no longer valid after a call to publish. - pod_pub_->publish(std::move(pod_loaned_msg)); - - // Similar as in the above case, we ask the middleware to loan a message. - // As most likely the middleware won't be able to loan a message for a non-POD - // data type, the memory for the message will be allocated on the heap within - // the scope of the `LoanedMessage` instance. - // After the call to `publish()`, the message will be correctly allocated. - auto non_pod_loaned_msg = non_pod_pub_->borrow_loaned_message(); - auto non_pod_msg_data = "Hello World: " + std::to_string(count_); - non_pod_loaned_msg.get().data = non_pod_msg_data; - RCLCPP_INFO(this->get_logger(), "Publishing: '%s'", non_pod_msg_data.c_str()); - non_pod_pub_->publish(std::move(non_pod_loaned_msg)); - count_++; - }; - - // Create a publisher with a custom Quality of Service profile. - rclcpp::QoS qos(rclcpp::KeepLast(7)); - pod_pub_ = this->create_publisher("chatter_pod", qos); - non_pod_pub_ = this->create_publisher("chatter", qos); - - // Use a timer to schedule periodic message publishing. - timer_ = this->create_wall_timer(1s, publish_message); - } - -private: - size_t count_ = 1; - rclcpp::Publisher::SharedPtr pod_pub_; - rclcpp::Publisher::SharedPtr non_pod_pub_; - rclcpp::TimerBase::SharedPtr timer_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::LoanedMessageTalker) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/talker_serialized_message.cpp b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/talker_serialized_message.cpp deleted file mode 100644 index 834b203..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/src/topics/talker_serialized_message.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2017 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include - -#include "rclcpp/rclcpp.hpp" -#include "rclcpp_components/register_node_macro.hpp" - -#include "std_msgs/msg/string.hpp" - -#include "rclcpp/serialization.hpp" - -#include "demo_nodes_cpp/visibility_control.h" - -using namespace std::chrono_literals; - -namespace demo_nodes_cpp -{ - -class SerializedMessageTalker : public rclcpp::Node -{ -public: - DEMO_NODES_CPP_PUBLIC - explicit SerializedMessageTalker(const rclcpp::NodeOptions & options) - : Node("serialized_message_talker", options), - serialized_msg_(0u) - { - // Create a function for when messages are to be sent. - auto publish_message = - [this]() -> void - { - // In this example we send a std_msgs/String as serialized data. - // This is the manual CDR serialization of a string message with the content of - // Hello World: equivalent to talker example. - // The serialized data is composed of a 8 Byte header - // plus the length of the actual message payload. - // If we were to compose this serialized message by hand, we would execute the following: - // rcutils_snprintf( - // serialized_msg_.buffer, serialized_msg_.buffer_length, "%c%c%c%c%c%c%c%c%s %zu", - // 0x00, 0x01, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, "Hello World:", count_++); - - // In order to ease things up, we call the rmw_serialize function, - // which can do the above conversion for us. - // For this, we initially fill up a std_msgs/String message and fill up its content - auto string_msg = std::make_shared(); - string_msg->data = "Hello World:" + std::to_string(count_++); - - // We know the size of the data to be sent, and thus can pre-allocate the - // necessary memory to hold all the data. - // This is specifically interesting to do here, because this means - // no dynamic memory allocation has to be done down the stack. - // If we don't allocate enough memory, the serialized message will be - // dynamically allocated before sending it to the wire. - auto message_header_length = 8u; - auto message_payload_length = static_cast(string_msg->data.size()); - serialized_msg_.reserve(message_header_length + message_payload_length); - - static rclcpp::Serialization serializer; - serializer.serialize_message(string_msg.get(), &serialized_msg_); - - // For demonstration we print the ROS 2 message format - printf("ROS message:\n"); - printf("%s\n", string_msg->data.c_str()); - // And after the corresponding binary representation - printf("serialized message:\n"); - for (size_t i = 0; i < serialized_msg_.size(); ++i) { - printf("%02x ", serialized_msg_.get_rcl_serialized_message().buffer[i]); - } - printf("\n"); - - pub_->publish(serialized_msg_); - }; - - rclcpp::QoS qos(rclcpp::KeepLast(7)); - pub_ = this->create_publisher("chatter", qos); - - // Use a timer to schedule periodic message publishing. - timer_ = this->create_wall_timer(1s, publish_message); - } - -private: - size_t count_ = 1; - rclcpp::SerializedMessage serialized_msg_; - rclcpp::Publisher::SharedPtr pub_; - rclcpp::TimerBase::SharedPtr timer_; -}; - -} // namespace demo_nodes_cpp - -RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::SerializedMessageTalker) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/add_two_ints_client.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/add_two_ints_client.txt deleted file mode 100644 index 49e6ad0..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/add_two_ints_client.txt +++ /dev/null @@ -1 +0,0 @@ -Result of add_two_ints: 5 diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/add_two_ints_client_async.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/add_two_ints_client_async.txt deleted file mode 100644 index 49e6ad0..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/add_two_ints_client_async.txt +++ /dev/null @@ -1 +0,0 @@ -Result of add_two_ints: 5 diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/add_two_ints_server.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/add_two_ints_server.txt deleted file mode 100644 index 72ae648..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/add_two_ints_server.txt +++ /dev/null @@ -1,2 +0,0 @@ -Incoming request -a: 2 b: 3 diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_publisher.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_publisher.txt deleted file mode 100644 index 6c302a2..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_publisher.txt +++ /dev/null @@ -1,26 +0,0 @@ -Publishing: '-100.000000' -Publishing: '-90.000000' -Publishing: '-80.000000' -Publishing: '-70.000000' -Publishing: '-60.000000' -Publishing: '-50.000000' -Publishing: '-40.000000' -Publishing: '-30.000000' -Publishing: '-20.000000' -Publishing: '-10.000000' -Publishing: '0.000000' -Publishing: '10.000000' -Publishing: '20.000000' -Publishing: '30.000000' -Publishing: '40.000000' -Publishing: '50.000000' -Publishing: '60.000000' -Publishing: '70.000000' -Publishing: '80.000000' -Publishing: '90.000000' -Publishing: '100.000000' -Publishing: '110.000000' -Publishing: '120.000000' -Publishing: '130.000000' -Publishing: '140.000000' -Publishing: '150.000000' diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_subscriber-rmw_connextdds.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_subscriber-rmw_connextdds.txt deleted file mode 100644 index ff822b2..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_subscriber-rmw_connextdds.txt +++ /dev/null @@ -1,12 +0,0 @@ -I receive an emergency temperature data: [-100.000000] -I receive an emergency temperature data: [-90.000000] -I receive an emergency temperature data: [-80.000000] -I receive an emergency temperature data: [-70.000000] -I receive an emergency temperature data: [-60.000000] -I receive an emergency temperature data: [-50.000000] -I receive an emergency temperature data: [-40.000000] -I receive an emergency temperature data: [110.000000] -I receive an emergency temperature data: [120.000000] -I receive an emergency temperature data: [130.000000] -I receive an emergency temperature data: [140.000000] -I receive an emergency temperature data: [150.000000] diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_subscriber-rmw_fastrtps_cpp.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_subscriber-rmw_fastrtps_cpp.txt deleted file mode 100644 index ff822b2..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_subscriber-rmw_fastrtps_cpp.txt +++ /dev/null @@ -1,12 +0,0 @@ -I receive an emergency temperature data: [-100.000000] -I receive an emergency temperature data: [-90.000000] -I receive an emergency temperature data: [-80.000000] -I receive an emergency temperature data: [-70.000000] -I receive an emergency temperature data: [-60.000000] -I receive an emergency temperature data: [-50.000000] -I receive an emergency temperature data: [-40.000000] -I receive an emergency temperature data: [110.000000] -I receive an emergency temperature data: [120.000000] -I receive an emergency temperature data: [130.000000] -I receive an emergency temperature data: [140.000000] -I receive an emergency temperature data: [150.000000] diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_subscriber.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_subscriber.txt deleted file mode 100644 index 882cf66..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/content_filtering_subscriber.txt +++ /dev/null @@ -1 +0,0 @@ -Content filter is not enabled since it's not supported diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/list_parameters.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/list_parameters.txt deleted file mode 100644 index f7558bc..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/list_parameters.txt +++ /dev/null @@ -1,10 +0,0 @@ -Setting parameters... -Listing parameters... - -Parameter names: - bar - foo - foo.first - foo.second -Parameter prefixes: - foo diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/list_parameters_async.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/list_parameters_async.txt deleted file mode 100644 index f7558bc..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/list_parameters_async.txt +++ /dev/null @@ -1,10 +0,0 @@ -Setting parameters... -Listing parameters... - -Parameter names: - bar - foo - foo.first - foo.second -Parameter prefixes: - foo diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/listener.regex b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/listener.regex deleted file mode 100644 index 9d6aae1..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/listener.regex +++ /dev/null @@ -1 +0,0 @@ -I heard: \[Hello World: \d+\] diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/matched_event_detect.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/matched_event_detect.txt deleted file mode 100644 index 0773339..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/matched_event_detect.txt +++ /dev/null @@ -1,16 +0,0 @@ -Create a new subscription. -First subscription is connected. -Create a new subscription. -The changed number of connected subscription is 1 and current number of connected subscription is 2. -Destroy a subscription. -The changed number of connected subscription is -1 and current number of connected subscription is 1. -Destroy a subscription. -Last subscription is disconnected. -Create a new publisher. -First publisher is connected. -Create a new publisher. -The changed number of connected publisher is 1 and current number of connected publisher is 2. -Destroy a publisher. -The changed number of connected publisher is -1 and current number of connected publisher is 1. -Destroy a publisher. -Last publisher is disconnected. \ No newline at end of file diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/parameter_events.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/parameter_events.txt deleted file mode 100644 index 543cfd9..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/parameter_events.txt +++ /dev/null @@ -1,70 +0,0 @@ - -Parameter event: - new parameters: - foo - changed parameters: - deleted parameters: - - -Parameter event: - new parameters: - bar - changed parameters: - deleted parameters: - - -Parameter event: - new parameters: - baz - changed parameters: - deleted parameters: - - -Parameter event: - new parameters: - foobar - changed parameters: - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - foo - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - bar - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - baz - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - foobar - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - foo - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - bar - deleted parameters: - diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/parameter_events_async.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/parameter_events_async.txt deleted file mode 100644 index 543cfd9..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/parameter_events_async.txt +++ /dev/null @@ -1,70 +0,0 @@ - -Parameter event: - new parameters: - foo - changed parameters: - deleted parameters: - - -Parameter event: - new parameters: - bar - changed parameters: - deleted parameters: - - -Parameter event: - new parameters: - baz - changed parameters: - deleted parameters: - - -Parameter event: - new parameters: - foobar - changed parameters: - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - foo - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - bar - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - baz - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - foobar - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - foo - deleted parameters: - - -Parameter event: - new parameters: - changed parameters: - bar - deleted parameters: - diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/set_and_get_parameters.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/set_and_get_parameters.txt deleted file mode 100644 index ac31bce..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/set_and_get_parameters.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Parameter name: foo -Parameter value (integer): 2 -Parameter name: baz -Parameter value (double): 1.450000 -Parameter name: foobarbaz -Parameter value (bool_array): [true, false] -Parameter name: toto -Parameter value (byte_array): [0xff, 0x7f] diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/set_and_get_parameters_async.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/set_and_get_parameters_async.txt deleted file mode 100644 index ac31bce..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/set_and_get_parameters_async.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Parameter name: foo -Parameter value (integer): 2 -Parameter name: baz -Parameter value (double): 1.450000 -Parameter name: foobarbaz -Parameter value (bool_array): [true, false] -Parameter name: toto -Parameter value (byte_array): [0xff, 0x7f] diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/talker.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/talker.txt deleted file mode 100644 index f1467e3..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/talker.txt +++ /dev/null @@ -1 +0,0 @@ -Publishing: 'Hello World: 1' diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/test_executables_tutorial.py.in b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/test_executables_tutorial.py.in deleted file mode 100644 index 6dc1c1a..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/test_executables_tutorial.py.in +++ /dev/null @@ -1,94 +0,0 @@ -# generated from demo_nodes_cpp/test/test_executables_tutorial.py.in -# generated code does not contain a copyright notice - -import os -import time - -import unittest - -from launch import LaunchDescription -from launch.actions import ExecuteProcess - -import launch_testing -import launch_testing.actions -import launch_testing.asserts -import launch_testing.util -import launch_testing_ros - - -def generate_test_description(): - env = os.environ.copy() - # bare minimum formatting for console output matching - env['RCUTILS_CONSOLE_OUTPUT_FORMAT'] = '{message}' - - launch_description = LaunchDescription() - - processes_under_test = [] - exes_and_params = '@DEMO_NODES_CPP_EXECUTABLE@'.split(';') - for i, exe_and_params in enumerate(exes_and_params): - tmp = exe_and_params.split('@') - cmd = [tmp[0]] - if len(tmp) > 1: - cmd.append('--ros-args') - for p in tmp[1:]: - cmd.append('-p') - cmd.append(p.replace('=', ':=')) - - processes_under_test.append( - ExecuteProcess( - cmd=cmd, - name='test_executable_' + str(i), - output='screen', - env=env, - ) - ) - - for process in processes_under_test: - launch_description.add_action(process) - launch_description.add_action(launch_testing.util.KeepAliveProc()) - launch_description.add_action( - launch_testing.actions.ReadyToTest() - ) - return launch_description, locals() - - -class TestExecutablesTutorial(unittest.TestCase): - - def test_processes_output(self, proc_output, processes_under_test): - """Test all processes output against expectations.""" - from launch_testing.tools.output import get_default_filtered_prefixes - output_filter = launch_testing_ros.tools.basic_output_filter( - filtered_prefixes=get_default_filtered_prefixes() + [ - 'service not available, waiting again...' - ], - filtered_rmw_implementation='@rmw_implementation@' - ) - output_files = '@DEMO_NODES_CPP_EXPECTED_OUTPUT@'.split(';') - for process, output_file in zip(processes_under_test, output_files): - # Some DDS features (e.g content filter) might not be implemented in all DDS, - # the different outputs are expected by different rmw_implementations. - special_output = output_file + '-@rmw_implementation@' - if os.path.isfile(special_output + '.txt'): - output_file = special_output - - proc_output.assertWaitFor( - expected_output=launch_testing.tools.expected_output_from_file( - path=output_file - ), process=process, output_filter=output_filter, timeout=30 - ) - - # Wait up to 5 seconds for the process to quit cleanly - tries = 50 - while process.return_code is None and tries > 0: - time.sleep(0.1) - tries -= 1 - -@launch_testing.post_shutdown_test() -class TestExecutablesTutorialAfterShutdown(unittest.TestCase): - - def test_last_process_exit_code(self, proc_info, processes_under_test): - """Test last process exit code.""" - launch_testing.asserts.assertExitCodes( - proc_info, - process=processes_under_test[-1] - ) diff --git a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/use_logger_service.txt b/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/use_logger_service.txt deleted file mode 100644 index 20be939..0000000 --- a/ubuntu/ros2/iron/heartbeat/cpp/demo_nodes_cpp/test/use_logger_service.txt +++ /dev/null @@ -1,18 +0,0 @@ -Output with default logger level: -Output 1 with INFO logger level. -Output 1 with WARN logger level. -Output 1 with ERROR logger level. -Current logger level: 0 -Output with debug logger level: -Output 2 with DEBUG logger level. -Output 2 with INFO logger level. -Output 2 with WARN logger level. -Output 2 with ERROR logger level. -Current logger level: 10 -Output with warn logger level: -Output 3 with WARN logger level. -Output 3 with ERROR logger level. -Current logger level: 30 -Output with error logger level: -Output 4 with ERROR logger level. -Current logger level: 40 diff --git a/ubuntu/ros2/iron/heartbeat/py/demo_nodes_py/topics/talker.py b/ubuntu/ros2/iron/heartbeat/py/demo_nodes_py/topics/talker.py index afa7f8a..f935049 100755 --- a/ubuntu/ros2/iron/heartbeat/py/demo_nodes_py/topics/talker.py +++ b/ubuntu/ros2/iron/heartbeat/py/demo_nodes_py/topics/talker.py @@ -30,7 +30,7 @@ def __init__(self): def timer_callback(self): msg = String() - msg.data = 'Heartbeat messages: {0}'.format(self.i) + msg.data = 'Heartbeat messages # {0}'.format(self.i) self.i += 1 self.get_logger().info('Publishing: "{0}"'.format(msg.data)) self.pub.publish(msg)