An opinionated ROS2 C++ node template, optimised for ISC.
- Clone repo inside your workspaces src directory (Ex. phnx_ws/src)
rosdep install --from-paths . --ignore-src -r -y
to install depscolcon build
to make sure the repo builds before you mess with it- Replace the following in both file names and code exactly and consistently.
- 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
- TODO_PACKAGE_NAME: Replace with the package name. Use snake case. Ex.
colcon build
again. If it builds, you are done- Rename outer folder
- Review the optional dependencies, and remove what you do not need
Some common extra dependencies are included. Review them and remove what you don't need. These are marked with TODO_EXTRA.
- 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
.
├── include
│ └── TODO_PACKAGE_NAME
│ └── TODO_NODE_NAME_node.hpp
├── package.xml
├── README.md
├── src
│ ├── TODO_NODE_NAME.cpp
│ └── TODO_NODE_NAME_node.cpp
└── tests
└── unit.cpp
TODO_NODE_NAME_node: Source files for the ROS2 node object itself, and only itself
TODO_NODE_NAME.cpp: Source for the main function of the node, and only the main function
tests/unit.cpp: Example file for unit tests. This is linked to the node and ros, so both can be used