Ask Your Question
1

Hi , I have error during examinig simple publisher & subscriber (c++)

asked 2013-11-30 00:29:37 -0500

Eman gravatar image

updated 2014-04-20 14:09:46 -0500

ngrennan gravatar image

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 catkin

  • I made sure I have sourced my workspace's setup.sh file after calling catkin_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 command rospack 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

  1. typing 1st command cd ~/catkin_ws/src

  2. 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 ...
(more)
edit retag flag offensive close merge delete

Comments

2

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 gravatar imageBennyRe ( 2013-11-30 02:37:46 -0500 )edit

@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 ?

Eman gravatar imageEman ( 2013-11-30 06:08:47 -0500 )edit

@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

Eman gravatar imageEman ( 2013-11-30 06:24:25 -0500 )edit
1

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.

BennyRe gravatar imageBennyRe ( 2013-12-01 04:40:56 -0500 )edit
1

It'll probably help if you can edit your question to include your CMakeLists.txt file.

lindzey gravatar imagelindzey ( 2013-12-02 06:10:59 -0500 )edit

@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 .

Eman gravatar imageEman ( 2013-12-02 14:28:32 -0500 )edit

@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()

Eman gravatar imageEman ( 2013-12-02 14:52:06 -0500 )edit

@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

Eman gravatar imageEman ( 2013-12-02 14:53:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-12-03 13:46:31 -0500

lindzey gravatar image

Based on your most recent update:

typing 1st command cd ~/catkin_ws/src

then typing 2nd command catkin_make

Your problem is that you need to invoke catkin_make in catkin_ws not catkin_ws/src.

However, this is a different mistake than some of the other error messages you've posted would indicate.

edit flag offensive delete link more

Comments

Thanks alot .God bless you amen but when I tried 1-typing 1st command cd ~/catkin_ws 2- then typing 2nd command catkin_make I had error 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! Invoking "cmake" failed

Eman gravatar imageEman ( 2013-12-04 02:52:55 -0500 )edit

please edit your original question to include this information, formatted nicely.

lindzey gravatar imagelindzey ( 2013-12-04 06:44:23 -0500 )edit

Thanks for your help . God bless you amen Ok , I will edit my original question to include this information, formatted nicely.

Eman gravatar imageEman ( 2013-12-05 09:16:20 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2013-11-30 00:29:37 -0500

Seen: 1,706 times

Last updated: Dec 05 '13