From 26ab3c534d8d3b3cb630e491c86cfb3c04450b8e Mon Sep 17 00:00:00 2001 From: James Pace Date: Fri, 28 Nov 2025 14:57:48 -0500 Subject: [PATCH] Rename. Add conga line launch file. --- CMakeLists.txt | 26 ++++++++++--------- .../j7s_parrot.hpp} | 0 .../j7s_publisher.hpp} | 0 launch/conga_line.launch.py | 26 +++++++++++++++++++ launch/j7s_publisher_launch.py | 8 +++--- package.xml | 2 +- src/{j7s-parrot.cpp => j7s_parrot.cpp} | 2 +- src/{j7s-publisher.cpp => j7s_publisher.cpp} | 2 +- 8 files changed, 47 insertions(+), 19 deletions(-) rename include/{j7s-simple/j7s-parrot.hpp => j7s_simple/j7s_parrot.hpp} (100%) rename include/{j7s-simple/j7s-publisher.hpp => j7s_simple/j7s_publisher.hpp} (100%) create mode 100644 launch/conga_line.launch.py rename src/{j7s-parrot.cpp => j7s_parrot.cpp} (97%) rename src/{j7s-publisher.cpp => j7s_publisher.cpp} (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index d300289..09adb7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(j7s-simple) +project(j7s_simple) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) @@ -11,27 +11,29 @@ find_package(rclcpp REQUIRED) find_package(std_msgs REQUIRED) find_package(fmt REQUIRED) -add_executable(j7s-publisher src/j7s-publisher.cpp) -target_include_directories(j7s-publisher PUBLIC +add_executable(j7s_publisher src/j7s_publisher.cpp) +target_include_directories(j7s_publisher PUBLIC $ $) -target_compile_features(j7s-publisher PUBLIC c_std_99 cxx_std_17) -target_link_libraries(j7s-publisher fmt::fmt) -ament_target_dependencies(j7s-publisher rclcpp std_msgs) +target_compile_features(j7s_publisher PUBLIC c_std_99 cxx_std_17) +target_link_libraries(j7s_publisher fmt::fmt) +ament_target_dependencies(j7s_publisher rclcpp std_msgs) -add_executable(j7s-parrot src/j7s-parrot.cpp) -target_include_directories(j7s-parrot PUBLIC +add_executable(j7s_parrot src/j7s_parrot.cpp) +target_include_directories(j7s_parrot PUBLIC $ $) -target_compile_features(j7s-parrot PUBLIC c_std_99 cxx_std_17) -target_link_libraries(j7s-parrot fmt::fmt) -ament_target_dependencies(j7s-parrot rclcpp std_msgs) +target_compile_features(j7s_parrot PUBLIC c_std_99 cxx_std_17) +target_link_libraries(j7s_parrot fmt::fmt) +ament_target_dependencies(j7s_parrot rclcpp std_msgs) install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}/ ) -install(TARGETS j7s-publisher j7s-parrot +install(TARGETS + j7s_publisher + j7s_parrot DESTINATION lib/${PROJECT_NAME}) ament_package() diff --git a/include/j7s-simple/j7s-parrot.hpp b/include/j7s_simple/j7s_parrot.hpp similarity index 100% rename from include/j7s-simple/j7s-parrot.hpp rename to include/j7s_simple/j7s_parrot.hpp diff --git a/include/j7s-simple/j7s-publisher.hpp b/include/j7s_simple/j7s_publisher.hpp similarity index 100% rename from include/j7s-simple/j7s-publisher.hpp rename to include/j7s_simple/j7s_publisher.hpp diff --git a/launch/conga_line.launch.py b/launch/conga_line.launch.py new file mode 100644 index 0000000..5cc589f --- /dev/null +++ b/launch/conga_line.launch.py @@ -0,0 +1,26 @@ +import launch +import launch_ros.actions + +def generate_launch_description(): + parrots = [] + for i in range(1, 10): + parrots.append(make_parrot(i)) + + return launch.LaunchDescription(parrots) + + +def make_parrot(index): + index_before = index - 1 + parrot = launch_ros.actions.Node( + package='j7s_simple', + executable='j7s_parrot', + name='j7s_parrot_{}'.format(index), + parameters=[{ + "name":"{}".format(index) + }], + remappings=[ + ("~/parrot_in", "parrot_{}".format(index_before)), + ("~/parrot_out", "parrot_{}".format(index)) + ] + ) + return parrot diff --git a/launch/j7s_publisher_launch.py b/launch/j7s_publisher_launch.py index 4120491..04b05bc 100644 --- a/launch/j7s_publisher_launch.py +++ b/launch/j7s_publisher_launch.py @@ -3,16 +3,16 @@ import launch_ros.actions def generate_launch_description(): publisher_node = launch_ros.actions.Node( - package='j7s-simple', - executable='j7s-publisher', + package='j7s_simple', + executable='j7s_publisher', name='j7s_publisher', parameters=[{ "message":"Hello" }] ) parrot_node = launch_ros.actions.Node( - package='j7s-simple', - executable='j7s-parrot', + package='j7s_simple', + executable='j7s_parrot', name='j7s_parrot_1', parameters=[{ "name":"Polly" diff --git a/package.xml b/package.xml index 7ade5a7..913b329 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ - j7s-simple + j7s_simple 0.0.0 A set of simple nodes for testing things which package ros2. James Pace diff --git a/src/j7s-parrot.cpp b/src/j7s_parrot.cpp similarity index 97% rename from src/j7s-parrot.cpp rename to src/j7s_parrot.cpp index ba026dc..ff20712 100644 --- a/src/j7s-parrot.cpp +++ b/src/j7s_parrot.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include using namespace std::chrono_literals; J7sParrot::J7sParrot() : Node("j7s_parrot"), m_name{declare_parameter("name")} diff --git a/src/j7s-publisher.cpp b/src/j7s_publisher.cpp similarity index 97% rename from src/j7s-publisher.cpp rename to src/j7s_publisher.cpp index aaf08a8..e50d8c2 100644 --- a/src/j7s-publisher.cpp +++ b/src/j7s_publisher.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include using namespace std::chrono_literals; J7sPublisher::J7sPublisher() :