Hi , I have error during examinig simple publisher & subscriber (c++)
I use groovy distribution & catkin first , I wrote the simple publisher & subscriber example that in beginner tutorials
then I tried to examine it following the following steps
typing command
roscore
in catkinI made sure I have sourced my workspace's
setup.sh
file after callingcatkin_make
but before
trying to my applications:
> In your catkin workspace
> cd ~/catkin_ws
> source ./devel/setup.bash
- run the node talker using command
rosrun beginner_tutorials talker
but, when I typed command rosrun beginner_tutorials talker
I recevied in output:
[rosrun] Couldn't find executable named talker below /home/eman/catkin_ws/src/beginner_tutorials
even though the node talker exists in the src of begibnner_turorials package & my CMakeLists.txt file looks like that:-
cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)
## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs)
## Declare ROS messages and services ##
## 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 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 projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES beginner_tutorials
# CATKIN_DEPENDS roscpp rospy std_msgs
# DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
)
## Declare a cpp library
# add_library(beginner_tutorials
# src/${PROJECT_NAME}/beginner_tutorials.cpp
# )
## Declare a cpp executable
# add_executable(beginner_tutorials_node src/beginner_tutorials_node.cpp)
## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
# add_dependencies(beginner_tutorials_node beginner_tutorials_generate_messages_cpp)
## Specify libraries to link a library or executable target against
# target_link_libraries(beginner_tutorials_node
# ${catkin_LIBRARIES}
# ries(include ${catkin_INCLUDE_DIRS})
add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
add_executable(listener src/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
add_executable(listener src/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
any help,please
I wonder what is the reason for having that error??
- I made sure that Ros can find my
package ( beginner_tutorials ) using commandrospack find beginner_tutorials
& it returns its path
/home/eman/catkin_ws/src/beginner_tutorials
so, that mean ros can see & find my package .
- I also made sure that the code of 2 nodes talker & listener exits in the src folder of my package
- , but when I tried to build the code
using command
catkin_make
typing 1st command
cd ~/catkin_ws/src
then typing 2nd command
catkin_make
I had that error :-
> The specified base path
> "/home/eman/catkin_ws/src" contains a
> CMakeLists.txt but "catkin_make" must
> be invoked in the root of workspace
I tried also
1-typing 1st command
cd ~/catkin_ws
2- then typing 2nd command
catkin_make
but, I had error
CMake Error at /opt/ros/groovy/share/roscpp ...
Do you see build output from your node when executing catkin_make? In your src folder there only should be the source code of your node, because catkin does out-of-source-builds.
@BennyRe firstly, thank you very much for your help & your note.God bless you amen After I had executed catkin_make , I had the following output eman@eman-K52F:~$ catkin_make Base path: /home/eman Source space: /home/eman/src Build space: /home/eman/build Devel space: /home/eman/devel Install space: /home/eman/install #### #### Running command: "make cmake_check_build_system" in "/home/eman/build" #### #### #### Running command: "make -j4 -l4" in "/home/eman/build" #### eman@eman-K52F:~$ you mean by src folder ( the src folder of the package beginner_tutorials ) ??? am I right ?
@BennyRe I made sure that the code of 2 nodes ( talker & listener ) are found in the src folder of the package beginner_tutorials ,but I still having the same error [rosrun] Couldn't find executable named talker below /home/eman/catkin_ws/src/beginner_tutorials I am really sorry for disturbance , but I have the same error & I don't know what to do
The output of catkin_make looks strange. There should be some output of your package. Did you create the package and your workspace correctly. Did you follow the catkin workspace tutorial? I mean, because your src/build/devel folders are located directly in your home folder.
It'll probably help if you can edit your question to include your CMakeLists.txt file.
@BennyRe Thank you very much for your response . God bless you amen. I am sorry for being late to reply , but I had a problem with my internet connection . I suppose I created the package and my workspace correctly . &yes, I followed the catkin workspace tutorial and every thing was going well similar to the outputs of the tutorial at that time .
@BennyRe The output may look strange because I didn't type the command " cd ~/catkin_ws/ before typing command " catkin_make " I am not sure about that ,but may be that was the reason. That output after 1-typing command " cd ~/catkin_ws/ " 2- then typing command " catkin_make " eman@eman-K52F:~/catkin_ws/src$ cd ~/catkin_ws/ eman@eman-K52F:~/catkin_ws$ catkin_make Base path: /home/eman/catkin_ws Source space: /home/eman/catkin_ws/src Build space: /home/eman/catkin_ws/build Devel space: /home/eman/catkin_ws/devel Install space: /home/eman/catkin_ws/install #### #### Running command: "make cmake_check_build_system" in "/home/eman/catkin_ws/build" #### -- Using CATKIN_DEVEL_PREFIX: /home/eman/catkin_ws/devel -- Using CMAKE_PREFIX_PATH: /home/eman/catkin_ws/devel;/opt/ros/groovy -- This workspace overlays: /home/eman/catkin_ws/devel;/opt/ros/groovy -- Using Debian Python package layout -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing()
@BennyRe but there is error at the end of the output -- +++ processing catkin package: 'beginner_tutorials' -- ==> add_subdirectory(beginner_tutorials) CMake Error at /opt/ros/groovy/share/roscpp/cmake/roscppConfig.cmake:130 (message): Project 'beginner_tutorials' tried to find library 'pthread'. The library is neither a target nor built/installed properly. Did you compile project 'roscpp'? Did you find_package() it before the subdirectory containing its code is included? Call Stack (most recent call first): /opt/ros/groovy/share/catkin/cmake/catkinConfig.cmake:72 (find_package) beginner_tutorials/CMakeLists.txt:7 (find_package) -- Configuring incomplete, errors occurred! make: *** [cmake_check_build_system] Error 1 Invoking "make cmake_check_build_system" failed