Catkin Tools
Introduction
Installation:
sudo apt install python-catkin-toolsIt's time to migrate from
catkin_maketocatkin build!
catkin build command
catkin build commandrosbuildwas the very first build tool developed by ROS communityThen comes
catkin_maketo help automate the merged build process at the top levelTo address the numerous drawbacks of the merged build process,
catkin_make_isolatedwas introduced to isolated build process for each packageFinally,
catkin buildis the most recent method to build packages, with improved performanceSee catkin history for more information
catkin devel space
In addition to the
mergedandisolateddevel space layouts provided bycatkin_makeandcatkin_make_isolated, respectively,catkin_toolsprovides a defaultlinkedlayout which enables robust cleaning of individual packages from a workspace.Specifically, catkin packages are built in the
.privatehidden directory at the root of the devel space. Files in devel space are symbolic links to files in.privatefolder.Additionally, to avoid race condition on setup files (e.g.,
setup.bash) and other problems in parallelize building, inlinkedlayout only one package generates these files. A package namedcatkin_tools_prebuildmay be built first (before all other packages) for this purpose.To use
mergedlayout, run commandcatkin config --merge-devel.
example catkin commands
#mkdir -p ~/catkin_ws/src
#cd ~/catkin_ws
catkin init # cf. catkin_init_workspace
catkin config --extend /opt/ros/melodic # extend explicitly
catkin config --merge-devel # linked --> merged
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
#cd src
catkin create pkg example
# cf. catkin_create_pkg example
catkin create pkg example --catkin-deps std_msgs
# cf. catkin_create_pkg example std_msgs
# deps will be added to catkin COMPONENTS
catkin create pkg example --system-deps PCL
# no corresponding command in old style (catkin_make system)
# will generate a new line: find_package(PCL REQUIRED)
catkin list # List the packages in the workspace
catkin build # can run at all levels (~/catkin_ws, ~/catkin_ws/src, within pkg)
catkin build example_pkg # build only this package
cd ~/catkin_ws/src/example_pkg && catkin build --this
#echo 'source ~/catkin_ws/devel/setup.bash' >> ~/.bashrc
catkin clean
catkin clean example_pkg # clean only this packageFAQ & Troubleshooting
WARNING: Your current environment's CMAKE_PREFIX_PATH is different from the
cached CMAKE_PREFIX_PATH used the last time this workspace was built.
If you want to use a different CMAKE_PREFIX_PATH you should call `catkin clean`
to remove all references to the previous CMAKE_PREFIX_PATH.This warning can be ignored and it will continue to use the cached path. It often happens after new workspaces are established and setup files are sourced.
Alternatively, it can be resolved by explicitly extending other workspaces.
catkin config --extend /opt/ros/melodicto revert,
catkin config --no-extend
Last updated
Was this helpful?