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

source won't change the package path

asked 2017-06-21 12:03:23 -0500

Arnold gravatar image

updated 2017-06-22 07:12:55 -0500

Hi, I'm trying to run the pcl tutorial, since i need it for an university project.

Unfortunately when I try to run the exaple

arnold@arnold-UX31E:~/catkin_ws$ rosrun my_pcl_tutorial example input:=/camera/depth/points

I get the error back:

[rosrun] Couldn't find executable named example below /home/arnold/catkin_ws/src/my_pcl_tutorial

The executable crated with catkin_make is in the build folder, not in src (this seams to be correct). But rosrun trys to run it from the src folder. A little research came to the conclusion that it isn't sourced right. When I run arnold@arnold-UX31E:~/catkin_ws$ source devel/setup.sh I get no response (no error or approval) and nothing changes.

I already deleted the workspace 3 times and just followed the instructions from this Tutorials. http://wiki.ros.org/catkin/Tutorials/... and http://wiki.ros.org/pcl/Tutorials

Running Ros Indigo under Ubuntu 14.04 LTS


Answer to the first Comments, My Input: image description

Return of a fresh catkin_make build:

arnold@arnold-UX31E:~$ printenv | grep ROS
ROS_ROOT=/opt/ros/indigo/share/ros
ROS_PACKAGE_PATH=/opt/ros/indigo/share:/opt/ros/indigo/stacks
ROS_MASTER_URI=http://localhost:11311
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=indigo
ROS_ETC_DIR=/opt/ros/indigo/etc/ros

arnold@arnold-UX31E:~/catkin_ws$ catkin_make
Base path: /home/arnold/catkin_ws
Source space: /home/arnold/catkin_ws/src
Build space: /home/arnold/catkin_ws/build
Devel space: /home/arnold/catkin_ws/devel
Install space: /home/arnold/catkin_ws/install
####
#### Running command: "cmake /home/arnold/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/arnold/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/arnold/catkin_ws/install -G Unix Makefiles" in "/home/arnold/catkin_ws/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/arnold/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/arnold/catkin_ws/devel;/opt/ros/indigo
-- This workspace overlays: /home/arnold/catkin_ws/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/arnold/catkin_ws/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.19
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - my_pcl_tutorial
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'my_pcl_tutorial'
-- ==> add_subdirectory(my_pcl_tutorial)
-- Using these message generators: gencpp;genlisp;genpy
-- Configuring done
-- Generating done
-- Build files have been written to: /home/arnold/catkin_ws/build
####
#### Running command: "make ...
(more)
edit retag flag offensive close merge delete

Comments

When I run arnold@arnold-UX31E:~/catkin_ws$ source devel/setup.sh I get no response (no error or approval) and nothing changes.

That is expected, as it only updates your environment variables.

Please post the output of echo $ROS_PACKAGE_PATH and tell us how you created your workspace.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 04:23:48 -0500 )edit

And the exact order in which you source, catkin_make and rosrun things.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 04:24:15 -0500 )edit

And just noticed this:

if you are using bash as your shell, you should use the setup.bash file, not the setup.sh.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 04:24:51 -0500 )edit

Ok, I'm going to edit the exact order and results into the first post. I created the workspace how it was shown in the catkin create_a_workspace tutorial.

Arnold gravatar image Arnold  ( 2017-06-22 05:03:46 -0500 )edit
2

Can you first try to source devel/setup.bash? It might be that is all you did 'wrong'.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 05:11:11 -0500 )edit

posted my log as picture in the first post.

Arnold gravatar image Arnold  ( 2017-06-22 05:20:19 -0500 )edit

Please don't use images for what is essentially text - you can just copy-paste from a terminal into your question text.

As to the output: I don't see any CMake output indicating that it's building any executable binaries. Can you include the CMakeLists.txt of the pkg you created?

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 06:20:35 -0500 )edit

Thats because the pkg was already build. If i delete the build folder and rerun catkin_make. It returns another text where it build a hack of more stuff. I'm wondering because the last last line Linking CXX executable example is red for me. I can't upload a file because i don't have 5 karma.

Arnold gravatar image Arnold  ( 2017-06-22 07:03:10 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2017-06-22 07:17:04 -0500

gvdhoorn gravatar image
..

add_executable(example src/example.cpp)
target_link_libraries(example ${catkin_LIBRARIES})

...

catkin_package(
   ...
)

Please move the add_executable(..) and target_link_libraries(..) lines below the catkin_package(..) line. Delete your build and devel folders and rebuild your workspace. That should make things work.

This is slightly unintuitive, but it is documented. See wiki/catkin - CMakeLists.txt - Overall Structure and Ordering on the ROS wiki.

edit flag offensive delete link more

Comments

Thanks, this worked.

Now I'm getting another error, when I rosrun my_pcl_tutorial example input:=/camera/depth/points

[ERROR] [1498134195.591725742]: [registerPublisher] Failed to contact master at [localhost:11311].  Retrying...

but this is another error and I'm trying it on my own first.

Arnold gravatar image Arnold  ( 2017-06-22 07:30:18 -0500 )edit
1

Good to hear that resolved it.

As to your next problem: you simply need to start a roscore first.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 07:36:02 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-06-21 12:00:28 -0500

Seen: 1,774 times

Last updated: Jun 22 '17