ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

roscd cannot find the package

asked 2015-09-21 12:30:31 -0600

jcolmena gravatar image

updated 2015-09-25 09:01:04 -0600

Everytime I compile a package I'm working on, or try to use a new package, ROS cannot find the package. I've even restarted from scratch. For example, this afternoon I'm trying to run a publisher for an imu. So I started from scratch because nothing is working, again. After 30 minuts of looking for a mistake, googling, etc. it just starts to work. This is what I'm doing:

myuser@mypc:$ cd ros
myuser@mypc:$ rm -rf *
myuser@mypc:$ mkdir src
myuser@mypc:$ cd src
myuser@mypc:$ catkin_init_workspace
myuser@mypc:$ cp -r ~/develeopment/imu .
myuser@mypc:$ cd ..
myuser@mypc:$ catkin_make

Base path: /home/myuser/development/ros
Source space: /home/myuser/development/ros/src
Build space: /home/myuser/development/ros/build
Devel space: /home/myuser/development/ros/devel
Install space: /home/myuser/development/ros/install
####
#### Running command: "cmake /home/myuser/development/ros/src -DCATKIN_DEVEL_PREFIX=/home/myuser/development/ros/devel -DCMAKE_INSTALL_PREFIX=/home/myuser/development/ros/install -G Unix Makefiles" in "/home/myuser/development/ros/build"
####
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Using CATKIN_DEVEL_PREFIX: /home/myuser/development/ros/devel
-- Using CMAKE_PREFIX_PATH: /home/myuser/development/ros/devel;/opt/ros/indigo
-- This workspace overlays: /home/myuser/development/ros/devel;/opt/ros/indigo
-- Found PythonInterp: /usr/bin/python (found version "2.7.6") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/myuser/development/ros/build/test_results
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.14
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - imu_3dm_gx4
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'imu_3dm_gx4'
-- ==> add_subdirectory(imu_3dm_gx4)
-- Using these message generators: gencpp;genlisp;genpy
-- imu_3dm_gx4: 1 messages, 0 services
-- Boost version: 1.54.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/myuser/development/ros/build
####
#### Running command: "make -j4 -l4" in "/home/myuser/development/ros/build"
####
Scanning dependencies of target _imu_3dm_gx4_generate_messages_check_deps_FilterOutput
Scanning dependencies of target geometry_msgs_generate_messages_cpp
Scanning dependencies of target geometry_msgs_generate_messages_py
Scanning dependencies of target std_msgs_generate_messages_cpp
[  0%] [  0%] [  0%] Built target geometry_msgs_generate_messages_cpp
Built target geometry_msgs_generate_messages_py
Built target std_msgs_generate_messages_cpp
Scanning dependencies of target roscpp_generate_messages_cpp
Scanning dependencies of target rosgraph_msgs_generate_messages_py
Scanning dependencies of target std_msgs_generate_messages_lisp
[  0%] Built target roscpp_generate_messages_cpp
[  0%] [  0%] Built target rosgraph_msgs_generate_messages_py
[  0%] Built target std_msgs_generate_messages_lisp
Scanning dependencies of target sensor_msgs_generate_messages_py
Built ...
(more)
edit retag flag offensive close merge delete

Comments

I see you edited your terminal log to use catkin_init_workspace. Did my answer fix your issue?

jarvisschultz gravatar image jarvisschultz  ( 2015-09-25 11:43:13 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-09-21 15:46:20 -0600

First, I assume your fifth line should read catkin_init_workspace instead of catkin_make. I believe your issue is likely related to the cache used by rospack. Quoting from the rospack docs:

rospack re-parses the manifest.xml files and rebuilds the dependency tree on each execution. However, it maintains a cache of package directories in ROS_ROOT/.rospack_cache. This cache is updated whenever there is a cache miss, or when the cache is 60 seconds old. You can change this timeout by setting the environment variable ROS_CACHE_TIMEOUT, in seconds. Set it to 0.0 to force a cache rebuild on every invocation of rospack.

I have encountered exactly the same sort of behaviour that you are reporting in the past, and I've always understood this behavior to simply mean that the rospack cache is out of date. Running the command rospack profile will force rospack to re-crawl your active workspaces and refresh the cache. This page also supports my theory. Hope this info helps.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2015-09-21 12:30:31 -0600

Seen: 2,169 times

Last updated: Sep 25 '15