How to create new ROS C++ package

The following command will initialize a new ROS2 package named my_ros_package in the my_ros_package directory based on C++:

ros2_pkg_create.sh
ros2 pkg create --build-type ament_cmake my_ros_package

With ROS2 Jazzy, the generated file structure will be as follows

example.txt
my_ros_package/
├── CMakeLists.txt
├── include
│   └── my_ros_package
├── package.xml
└── src

Check out similar posts by category: ROS, C/C++