ROS Catkin Package Maker
21 Sep 2019 Antoni RosinolUsage details in repo
Tired of creating catkin packages from scratch?
Just run:
bash -c "$(curl -sLf https://raw.githubusercontent.com/ToniRV/catkin_package_maker/master/make_catkin_pkg.sh)"
You will then be prompted to type the name of your catkin package, similar to this:
Type project name:
test
This will generate a fresh catkin simple package, including filesystem, and even README.md!
Creating new project at: ./test
Created file test/package.xml
Created file test/CMakeLists.txt
Created file test/src/test.cpp
Created file test/launch/test.launch
Created file test/README.md
If you have executed this inside a catkin workspace, just build and run:
catkin build
# Source your catkin workspace before!
rosrun test test
You should see something like:
[ INFO] [1569099086.150568624]: Hello World
If the command above is too long, just create a bash function in your ~/.bashrc
:
make_catkin_pkg() {
bash -c "$(curl -sLf https://raw.githubusercontent.com/ToniRV/catkin_package_maker/master/make_catkin_pkg.sh)"
}
Long story:
How many times have you made a ROS package?
If you name yourself a roboticist, probably more than one.
Yet if you use the ROS built-in command to automatically create a catkin package (which I strongly discourage once you know a bit of ROS) you will find yourself with extremely long CMakeLists.txt
file cluttered with comments, and a package.xml
that merely duplicates the information that is already present in CMakeLists.txt
.
Thanks to catkin_simple one can simplify by several hundreds of lines the catkin package. Unfortunately, that is not the official approach of ROS (yet).
Also, catkin_create_pkg
will only generate a mere CMakeLists.txt
and package.xml
, leaving you with the hassle of building a proper filesystem yourself (w. include
, src
, launch
, install
, rviz
folders etc).
Using catkin package maker, you can get a ready to compile and run catkin package for half of the hassle and the time to build it.
It works like this:
# Call catkin_package_maker from the web, no need to clone yourself
bash -c "$(curl -sLf https://raw.githubusercontent.com/ToniRV/catkin_package_maker/master/make_catkin_pkg.sh)"
Provide the name of your project:
Type project name:
test
You should see something similar to this:
Creating new project at: ./test
Created file test/package.xml
Created file test/CMakeLists.txt
Created file test/src/test.cpp
Created file test/launch/test.launch
Created file test/README.md
The README even includes instructions on how to install and run the package!
Checkout the actual code in here.