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

Unexpected behavior with actionlib_tutorials

asked 2017-07-01 13:50:29 -0500

achille gravatar image

updated 2017-07-02 09:18:45 -0500

I followed the first actionlib tutorial exactly, first creating a new workspace. I added all dependencies as in the tutorial and building the workspace worked fine. When running the fibonacci_server, the tutorial states:

You will see something similar to:

[ INFO] 1250790662.410962000: Started node [/fibonacci], pid [29267], bound on [aqy], xmlrpc port [39746], tcpros port [49573], logging to [~/ros/ros/log/fibonacci_29267.log], using [real] time

However, this info is not displayed. The server runs without error and rostopic list -v lists the same topics as in the tutorial. Furthermore, running rqt_graph results in a single block fibonacci with two topics color and /fibonacci as opposed to the graph in the tutorial.

I then continued with the client, following the tutorial precisely again. After creating the fibonacci_client.cpp file and editing the CMakeLists.txt, catkin_make fails:

achille@W530:~/Documents/tutorial_ws$ catkin_make
Base path: /home/achille/Documents/tutorial_ws
Source space: /home/achille/Documents/tutorial_ws/src
Build space: /home/achille/Documents/tutorial_ws/build
Devel space: /home/achille/Documents/tutorial_ws/devel
Install space: /home/achille/Documents/tutorial_ws/install
#### Running command: "make cmake_check_build_system" in "/home/achille/Documents/tutorial_ws/build"
-- Using CATKIN_DEVEL_PREFIX: /home/achille/Documents/tutorial_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/achille/Documents/tutorial_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/achille/Documents/tutorial_ws/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/achille/Documents/tutorial_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.6
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:

-- ~~  - actionlib_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'actionlib_tutorials'
-- ==> add_subdirectory(actionlib_tutorials)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
-- Generating .msg files for action actionlib_tutorials/Fibonacci /home/achille/Documents/tutorial_ws/src/actionlib_tutorials/action/Fibonacci.action
-- actionlib_tutorials: 7 messages, 0 services
-- Configuring done
CMake Error at actionlib_tutorials/CMakeLists.txt:138 (add_executable):
  Cannot find source file:


  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx
CMake Warning (dev) at actionlib_tutorials/CMakeLists.txt:151 (add_dependencies):
  Policy CMP0046 is not set: Error on non-existent dependency in
  add_dependencies.  Run "cmake --help-policy CMP0046" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.
  The dependency target "fibonacci_client" of target "fibonacci_server" does
  not exist.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error: CMake can not determine linker language for target: fibonacci_server
CMake Error: Cannot determine link language for target "fibonacci_server".
-- Generating done
-- Build files have been written to: /home/achille/Documents/tutorial_ws/build
Makefile:920: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

The build part of my CMakelists.txt is as follows (dropping comments):

# include

  fibonacci_server src/fibonacci_server.cpp
  fibonacci_client src/fibonacci_client.cpp



I'm not sure ... (more)

edit retag flag offensive close merge delete


Can you make sure that you've actually added add_executable(fibonacci_client src/fibonacci_client.cpp) (note the src/ there), and not just add_executable(fibonacci_client fibonacci_client.cpp), or even add_executable(fibonacci_client)?

gvdhoorn gravatar image gvdhoorn  ( 2017-07-02 06:08:54 -0500 )edit

That's the case. Updated my question with the BUILD part of the CMakeLists.txt file

achille gravatar image achille  ( 2017-07-02 09:16:43 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-07-02 10:16:34 -0500

gvdhoorn gravatar image

updated 2017-07-02 10:20:09 -0500

  fibonacci_server src/fibonacci_server.cpp
  fibonacci_client src/fibonacci_client.cpp

I can't answer the first part of your question, but the above is not how add_executable(..) works.

See the CMake documentation for add_executable(..):

Add an executable to the project using the specified source files.

add_executable(<name> [WIN32] [MACOSX_BUNDLE]
               source1 [source2 ...])

Adds an executable target called <name> to be built from the source files listed in the command invocation. The <name> corresponds to the logical target name and must be globally unique within a project. The actual file name of the executable built is constructed based on conventions of the native platform (such as <name>.exe or just <name>.

The first argument to add_executable(..) is the name of a single executable, with all the following arguments being the source files that together make up the binary.

In your CMake snippet, you seem to have intended to build both executables with a single add_executable(..). As should now be clear, that doesn't work.

The tutorial you linked to also doesn't do that (note the: "Add the following lines to your CMakeLists.txt"), it has the server in its own add_executable(..) (here) and the client as well (here).

Finally: even if this were possible from the CMake side, it still wouldn't work: there can only be a single entry point in any executable binary and both the server and the client have a main(..).

edit flag offensive delete link more


Did this also clear up the problem with the output of the server binary?

gvdhoorn gravatar image gvdhoorn  ( 2017-07-02 15:07:25 -0500 )edit

It did. Graph looks different from the one on the tutorial though and still has this weird 'color' attribute. Bedankt!

achille gravatar image achille  ( 2017-07-02 16:27:28 -0500 )edit

The color that you see is a bug. See #q249553.

gvdhoorn gravatar image gvdhoorn  ( 2017-07-03 00:58:05 -0500 )edit

I got the same problem that achille had. even when I follow the guidelines gvdhoorn provided still there is no output from the binary server. But topics with subs and pubs are present, yet not connected to the node. Any ideas?

count_dueki gravatar image count_dueki  ( 2018-06-17 07:18:02 -0500 )edit

Question Tools



Asked: 2017-07-01 13:50:29 -0500

Seen: 449 times

Last updated: Jul 02 '17