Fix catkin workspace, can't launch newly compiled nodes
Hello I'm having issues running new modules, the compilation goes right but rosrun can't find the new nodes, i guess it's en environment issue, but as I'm a noob, it's just a guess :)
I have the catkin ws under ~/ros_ws/
, in this folder i have my package pcltest, that have a single source file src/pcltest_node.cpp
When i run catkin_make i can see the compilation having success:
...
[100%] Building CXX object pcltest/CMakeFiles/pcltest_node.dir/src/pcltest_node.cpp.o
Linking CXX executable pcltest_node
[100%] Built target pcltest_node
...
And I can find my binary compiled in ~/ros_ws/build/pcltest/pcltest_node
This is the output of catkin_make install
-- Install configuration: ""
-- Up-to-date: /home/cesare/ros_ws/install/_setup_util.py
-- Up-to-date: /home/cesare/ros_ws/install/env.sh
-- Up-to-date: /home/cesare/ros_ws/install/setup.bash
-- Up-to-date: /home/cesare/ros_ws/install/setup.sh
-- Up-to-date: /home/cesare/ros_ws/install/setup.zsh
-- Up-to-date: /home/cesare/ros_ws/install/.rosinstall
-- Up-to-date: /home/cesare/ros_ws/install/lib/pkgconfig/pcltest.pc
-- Up-to-date: /home/cesare/ros_ws/install/share/pcltest/cmake/pcltestConfig.cmake
-- Up-to-date: /home/cesare/ros_ws/install/share/pcltest/cmake/pcltestConfig-version.cmake
-- Up-to-date: /home/cesare/ros_ws/install/share/pcltest/package.xml
then usually I source /home/cesare/ros_ws/install/setup.bash
but when i try to run the node with rosrun pcltest xxx
i have an error, it looks like it's not copying the binary from the build to the install folder... what am I doing wrong ?
----- ----- ----- EDIT ----- ----- -----
I've tried to source /home/cesare/ros_ws/devel/setup.bash
but it doesn't change much.
In both the cases rosrun is able to find (and autocoplete) the package but it can't find che binary :(
This is how it looks my 'devel/share' dir
.
└── pcltest
└── cmake
├── pcltestConfig.cmake
└── pcltestConfig-version.cmake
This is the install/share dir
.
└── pcltest
├── cmake
│ ├── pcltestConfig.cmake
│ └── pcltestConfig-version.cmake
└── package.xml
This is the package in the build dir
drwxrwxr-x 4 cesare cesare 4096 giu 18 10:46 .
drwxrwxr-x 8 cesare cesare 4096 giu 18 10:47 ..
drwxrwxr-x 4 cesare cesare 4096 giu 18 10:46 catkin_generated
drwxrwxr-x 47 cesare cesare 4096 giu 18 10:46 CMakeFiles
-rw-rw-r-- 1 cesare cesare 2280 giu 18 10:46 cmake_install.cmake
-rw-rw-r-- 1 cesare cesare 277 giu 18 10:46 CTestTestfile.cmake
-rw-rw-r-- 1 cesare cesare 41872 giu 18 10:46 Makefile
-rwxrwxr-x 1 cesare cesare 466725 giu 18 10:46 pcltest_node
CMakeList.txt
cmake_minimum_required(VERSION 2.8.3)
project(pcltest)
find_package(catkin REQUIRED COMPONENTS
pcl_ros
roscpp
rospy
std_msgs
)
#add_executable(pcltest src/pcltest.cpp) #in this position doesn't work :(
catkin_package(
)
include_directories(
${catkin_INCLUDE_DIRS}
)
add_executable(pcltest src/pcltest.cpp)
target_link_libraries(pcltest
${catkin_LIBRARIES}
)
Thank you :)
Does it work if you source devel/ ? What is your cmake file?
You still haven't shown us your
CMakeLists.txt
, as @dornhege asked. Binary targets need to beinstall(..)
-ed, they will not automagically appear in your install space.Sorry, I didn't understood you wanted the CMakeList.txt, posted :)
Now works, I found the problem (but I don't understand), apparently it was caused by
add_executable
being called to early in the CMakeList (see comment in file)... however I like to know more about theinstall(..)
^_^Reading http://wiki.ros.org/catkin/CMakeLists.txt :)
Binaries end up in devel/lib/<pkg>. They should have been built there.