Catkin_make skips new package
I am a beginner with ROS, working through chapter 2 of the Learning ROS for Robotics Programming book (2nd ed). When I use catkin_create_pkg it appears to execute normally (my terminal output matches the output shown in the book). I then change directory to my workspace and execute catkin_make. This completes without any errors, but it fails to acknowledge my new package. Using rospack find also fails to find the package. What am I missing? Thanks for your help in advance!
Edit: here's requested data to help diagnose my problem.
#Terminal input/output for catkin_make:
viki@c3po:~$ cd ~/dev/catkin_ws
viki@c3po:~/dev/catkin_ws$ catkin_make
Base path: /home/viki/dev/catkin_ws
Source space:
/home/viki/dev/catkin_ws/src Build
space: /home/viki/dev/catkin_ws/build
Devel space:
/home/viki/dev/catkin_ws/devel Install
space:
/home/viki/dev/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in
"/home/viki/dev/catkin_ws/build"
####
####
#### Running command: "make -j1 -l1" in "/home/viki/dev/catkin_ws/build"
#### viki@c3po:~/dev/catkin_ws$ rospack find chapter2_tutorials
[rospack] Error: stack/package
chapter2_tutorials not found
#CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(chapter2_tutorials)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()
################################################
## Declare ROS messages, services and actions ##
################################################
## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependencies might have been
## pulled in transitively but can be declared for certainty nonetheless:
## * add a build_depend tag for "message_generation"
## * add a run_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
## Generate messages in the 'msg' folder
# add_message_files(
# FILES
# Message1.msg
# Message2.msg
# )
## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )
## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )
## Generate added messages and services with any dependencies listed here
# generate_messages(
# DEPENDENCIES
# std_msgs
# )
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent ...
Is this new package in a catkin workspace? (i.e. did you call
catkin_init_workspace
in thesrc
folder?) In which directory are you callingcatkin_make
?Yes, I can confirm that
catkin_init_workspace
was executed because when I tried it just now, it echoed: ~"/dev/catkin_ws/src/CMakeLists.txt" already exists. I executecatkin_make
in ~/dev/catkin_ws as instructed by the tutorial.did you then
source ~/dev/catkin_ws/devel/setup.bash
? If not, please edit your question with the output ofcatkin_make
(copy-paste, please no screenshot), as well as with the contents ofpackage.xml
andCMakelists.txt
.Following my tutorial, I edited my ~/.bashrc file by
echo "source /opt/ros/hydro/setup.bash" >> ~/.bashrc
. So this step should be taken care of when I restart the terminal. In case it is helpful for you, I added the data you requested. Sorry about the formatting. It was better when previewed.And thanks for your continued support!
@adiadidas15 please reupload this and format it properly ;-) It is so hard to read like this. I.e. just copy-paste directly from the file, mark it, and then hit the button with the 101010 on it. This is code formatting.
Also, we need the
CMakelists.txt
of your package, not the top-level one.You need to source your workspace, i.e. not only
source /opt/ros/hydro/setup.bash
(and I would actually go to a more recent version like indigo or soon kinetic), but source~/dev/catkin_ws/devel/setup.bash
. Otherwise, it will not find anything becauseecho $ROS_PACKAGE_PATH
needs to containthe path to your workspace. Otherwise, it is clear why it does not find your package. It is just not on your path.