Skip to content

Commit

Permalink
Update instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
andyblarblar committed Oct 1, 2023
1 parent 32053b8 commit 864cd1d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ find_package(std_msgs REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(OpenCV 4.2.0 REQUIRED)

# Add source for node executable (link non-ros dependencies here)
add_executable(TODO_PACKAGE_NAME src/TODO_NODE_NAME.cpp src/TODO_NODE_NAME_node.cpp)
target_include_directories(TODO_PACKAGE_NAME PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(TODO_PACKAGE_NAME PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17

# Make deps a variable so they get linked to tests as well
# Make ros deps a variable so they get linked to tests as well
set(dependencies
rclcpp
# Messages TODO_EXTRA
Expand All @@ -35,6 +36,7 @@ set(dependencies
OpenCV
)

# Link ros dependencies
ament_target_dependencies(
TODO_PACKAGE_NAME
${dependencies}
Expand All @@ -43,6 +45,12 @@ ament_target_dependencies(
install(TARGETS TODO_PACKAGE_NAME
DESTINATION lib/${PROJECT_NAME})

# Uncomment below to make launch files available if created
#install(
# DIRECTORY launch config
# DESTINATION share/${PROJECT_NAME}/
#)

if (BUILD_TESTING)
# Manually invoke clang format so it actually uses our file
find_package(ament_cmake_clang_format REQUIRED)
Expand All @@ -53,6 +61,7 @@ if (BUILD_TESTING)
# Add unit tests
ament_add_gtest(${PROJECT_NAME}-test
tests/unit.cpp
# Remember to add node source files
src/TODO_NODE_NAME_node.cpp
)
ament_target_dependencies(${PROJECT_NAME}-test ${dependencies})
Expand Down
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
A ROS2 template node.
An opinionated ROS2 C++ node template, optimised for ISC.

# Replace
Replace the following in both file names and code exactly and consistently.
# Instructions

- TODO_PACKAGE_NAME: Replace with the package name. Use snake case. Ex. `data_logger`
- TODO_NODE_NAME: Replace with the node name. Use Pascal case. Ex. `DataLogger`
1. Clone repo inside your workspaces src directory (Ex. phnx_ws/src)
2. `rosdep install --from-paths . --ignore-src -r -y` to install deps
3. `colcon build` to make sure the repo builds before you mess with it
4. Replace the following in both file names and code exactly and consistently.
1. TODO_PACKAGE_NAME: Replace with the package name. Use snake case. Ex. `data_logger`
2. TODO_NODE_NAME: Replace with the node name. Use Pascal case. Ex. `DataLogger`
5. `colcon build` again. If it builds, you are done
6. Rename outer folder
7. Review the optional dependencies, and remove what you do not need

# Dependencies
Some common extra dependencies are included. Review them and remove what you don't need.
These are marked with TODO_EXTRA.

# Features

TODO cover tests, lints, CI, go over files
- Unit tests
- ROS-Industrial github CI (will test units and lints)
- C++ formatting via clangformat
- A selection of sane lints
- A single node setup in a multithreaded executor

0 comments on commit 864cd1d

Please sign in to comment.