Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
__pycache__
*/.tmuxinator.yml

# Editor folders and OS metadata
.cache
.vscode

compile_commands.json
compile_commands.json
.idea/
.DS_Store
Thumbs.db
34 changes: 17 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
cmake_minimum_required(VERSION 3.28)
project(f4f_ros2_template)
project(ros2_pkg_template)

# --- Export & Symlink compile_commands.json ---
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(SOURCE_JSON "${CMAKE_SOURCE_DIR}/compile_commands.json")
set(BINARY_JSON "${CMAKE_BINARY_DIR}/compile_commands.json")

if(EXISTS ${BINARY_JSON} AND NOT EXISTS ${SOURCE_JSON})
message(STATUS "Symlinking compile_commands.json to source directory")
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${BINARY_JSON} ${SOURCE_JSON})
message(STATUS "Symlinking compile_commands.json to source directory")
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${BINARY_JSON} ${SOURCE_JSON})
endif()

# set the correct standards
Expand All @@ -21,7 +21,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(USE_ROS_TIMER 0)

if(${USE_ROS_TIMER})
MESSAGE(WARNING "[f4f_ros2_template]: Compiling with ROS Timers. This can cause high CPU load in runtime.")
message(WARNING "[ros2_pkg_template]: Compiling with ROS Timers. This can cause high CPU load in runtime.")
endif()

# set the compile options to show code warnings
Expand Down Expand Up @@ -51,7 +51,7 @@ find_package(std_srvs REQUIRED)
## --------------------------------------------------------------

# Define the shared library created by this package
add_library(F4FROS2Template_ROS2TemplateComponent SHARED)
add_library(ROS2PKGTemplate_ROS2TemplateComponent SHARED)

# Add sources to the shared library
# - Source files should be listed in private section.
Expand All @@ -60,9 +60,9 @@ add_library(F4FROS2Template_ROS2TemplateComponent SHARED)
# handle them:
# - public headers: `example_plugin_manager`
# - private headers: `example_waypoint_flier_native`
target_sources(F4FROS2Template_ROS2TemplateComponent
target_sources(ROS2PKGTemplate_ROS2TemplateComponent
PRIVATE
"src/ros2_template.cpp"
"src/ros2_template.cpp"
)

# Link to the dependencies used by the library
Expand All @@ -72,19 +72,19 @@ target_sources(F4FROS2Template_ROS2TemplateComponent
# `<package>::<package>` that include the whole library.
# Message libraries unfortunately do not provide this target and users must link
# against: `${<package>_TARGETS}`.
target_link_libraries(F4FROS2Template_ROS2TemplateComponent
target_link_libraries(ROS2PKGTemplate_ROS2TemplateComponent
PRIVATE
rclcpp::rclcpp
rclcpp_components::component
mrs_lib::mrs_lib
${mrs_msgs_TARGETS}
${std_srvs_TARGETS}
rclcpp::rclcpp
rclcpp_components::component
mrs_lib::mrs_lib
${mrs_msgs_TARGETS}
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target_link_libraries() links ${mrs_msgs_TARGETS}, but this CMakeLists does not find_package(mrs_msgs ...) and the sources in this repo don’t appear to use mrs_msgs. Either add the missing find_package(mrs_msgs REQUIRED) or drop ${mrs_msgs_TARGETS} to avoid confusing/fragile link configuration.

Suggested change
${mrs_msgs_TARGETS}

Copilot uses AI. Check for mistakes.
${std_srvs_TARGETS}
)

Comment on lines +80 to 83
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target_link_libraries() links against ${mrs_msgs_TARGETS}, but this CMakeLists.txt never calls find_package(mrs_msgs REQUIRED) (and the code in this package doesn’t appear to use mrs_msgs). As written, CMake configuration will fail due to an undefined variable/target list. Either add the missing find_package(mrs_msgs REQUIRED) + proper linking/export, or remove ${mrs_msgs_TARGETS} from the link list.

Suggested change
${mrs_msgs_TARGETS}
${std_srvs_TARGETS}
)
${std_srvs_TARGETS}
)

Copilot uses AI. Check for mistakes.
# Register components defined in this library.
# rclcpp_components_register_nodes(<library> <names of components>...)
rclcpp_components_register_nodes(F4FROS2Template_ROS2TemplateComponent
"f4f_ros2_template::ROS2Template"
rclcpp_components_register_nodes(ROS2PKGTemplate_ROS2TemplateComponent
"ros2_pkg_template::ROS2Template"
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rclcpp_components_register_nodes() registers the component as ros2_pkg_template::ROS2Template, but the actual component in src/ros2_template.cpp is still declared/registered under the f4f_ros2_template namespace. This mismatch will prevent ros2 launch / component loading from finding the plugin. Align the fully-qualified class name here with the C++ namespace (and update the launch files’ plugin= accordingly if the rename is intentional).

Suggested change
"ros2_pkg_template::ROS2Template"
"f4f_ros2_template::ROS2Template"

Copilot uses AI. Check for mistakes.
)

## --------------------------------------------------------------
Expand All @@ -95,7 +95,7 @@ if(ENABLE_TESTS)

message(WARNING "TODO")
find_package(ament_cmake_clang_format REQUIRED)
ament_clang_format(CONFIG_FILE "${PROJECT_SOURCE_DIR}/.clang-formatt")
ament_clang_format(CONFIG_FILE "${PROJECT_SOURCE_DIR}/.clang-format")
find_package(ament_cmake_xmllint REQUIRED)
ament_xmllint()

Expand All @@ -106,7 +106,7 @@ endif()
## --------------------------------------------------------------

install(
TARGETS F4FROS2Template_ROS2TemplateComponent
TARGETS ROS2PKGTemplate_ROS2TemplateComponent
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
Loading