Rename. Add conga line launch file.

This commit is contained in:
James Pace 2025-11-28 14:57:48 -05:00
parent 878fc973ac
commit 26ab3c534d
8 changed files with 47 additions and 19 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8) cmake_minimum_required(VERSION 3.8)
project(j7s-simple) project(j7s_simple)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic) add_compile_options(-Wall -Wextra -Wpedantic)
@ -11,27 +11,29 @@ find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED) find_package(std_msgs REQUIRED)
find_package(fmt REQUIRED) find_package(fmt REQUIRED)
add_executable(j7s-publisher src/j7s-publisher.cpp) add_executable(j7s_publisher src/j7s_publisher.cpp)
target_include_directories(j7s-publisher PUBLIC target_include_directories(j7s_publisher PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>) $<INSTALL_INTERFACE:include>)
target_compile_features(j7s-publisher PUBLIC c_std_99 cxx_std_17) target_compile_features(j7s_publisher PUBLIC c_std_99 cxx_std_17)
target_link_libraries(j7s-publisher fmt::fmt) target_link_libraries(j7s_publisher fmt::fmt)
ament_target_dependencies(j7s-publisher rclcpp std_msgs) ament_target_dependencies(j7s_publisher rclcpp std_msgs)
add_executable(j7s-parrot src/j7s-parrot.cpp) add_executable(j7s_parrot src/j7s_parrot.cpp)
target_include_directories(j7s-parrot PUBLIC target_include_directories(j7s_parrot PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>) $<INSTALL_INTERFACE:include>)
target_compile_features(j7s-parrot PUBLIC c_std_99 cxx_std_17) target_compile_features(j7s_parrot PUBLIC c_std_99 cxx_std_17)
target_link_libraries(j7s-parrot fmt::fmt) target_link_libraries(j7s_parrot fmt::fmt)
ament_target_dependencies(j7s-parrot rclcpp std_msgs) ament_target_dependencies(j7s_parrot rclcpp std_msgs)
install(DIRECTORY install(DIRECTORY
launch launch
DESTINATION share/${PROJECT_NAME}/ DESTINATION share/${PROJECT_NAME}/
) )
install(TARGETS j7s-publisher j7s-parrot install(TARGETS
j7s_publisher
j7s_parrot
DESTINATION lib/${PROJECT_NAME}) DESTINATION lib/${PROJECT_NAME})
ament_package() ament_package()

View File

@ -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

View File

@ -3,16 +3,16 @@ import launch_ros.actions
def generate_launch_description(): def generate_launch_description():
publisher_node = launch_ros.actions.Node( publisher_node = launch_ros.actions.Node(
package='j7s-simple', package='j7s_simple',
executable='j7s-publisher', executable='j7s_publisher',
name='j7s_publisher', name='j7s_publisher',
parameters=[{ parameters=[{
"message":"Hello" "message":"Hello"
}] }]
) )
parrot_node = launch_ros.actions.Node( parrot_node = launch_ros.actions.Node(
package='j7s-simple', package='j7s_simple',
executable='j7s-parrot', executable='j7s_parrot',
name='j7s_parrot_1', name='j7s_parrot_1',
parameters=[{ parameters=[{
"name":"Polly" "name":"Polly"

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3"> <package format="3">
<name>j7s-simple</name> <name>j7s_simple</name>
<version>0.0.0</version> <version>0.0.0</version>
<description>A set of simple nodes for testing things which package ros2.</description> <description>A set of simple nodes for testing things which package ros2.</description>
<maintainer email="jpace121@gmail.com">James Pace</maintainer> <maintainer email="jpace121@gmail.com">James Pace</maintainer>

View File

@ -14,7 +14,7 @@
#include <fmt/core.h> #include <fmt/core.h>
#include <chrono> #include <chrono>
#include <j7s-simple/j7s-parrot.hpp> #include <j7s_simple/j7s_parrot.hpp>
using namespace std::chrono_literals; using namespace std::chrono_literals;
J7sParrot::J7sParrot() : Node("j7s_parrot"), m_name{declare_parameter<std::string>("name")} J7sParrot::J7sParrot() : Node("j7s_parrot"), m_name{declare_parameter<std::string>("name")}

View File

@ -14,7 +14,7 @@
#include <fmt/core.h> #include <fmt/core.h>
#include <chrono> #include <chrono>
#include <j7s-simple/j7s-publisher.hpp> #include <j7s_simple/j7s_publisher.hpp>
using namespace std::chrono_literals; using namespace std::chrono_literals;
J7sPublisher::J7sPublisher() : J7sPublisher::J7sPublisher() :