0
$\begingroup$

Rosanswers logo

I have some questions when I go through this tutorial. When I finished 1.1 and 1.2, then in the 1.3 I try to change the content in the CMakeLists.txt, then it's supposed to create two executables, talker and listener, which by default will go into package directory of your devel space, located by default at ~/catkin_ws/devel/lib/share/, however there isn't share in lib and there are no executables.

Hello everyone, after I asked for some people's help finally I solved this problem, first of all, something was wrong in the tutorial that is there does not exist ~/catkin_ws/devel/lib/share/, instead we have devel/lib/beginner_tutorials (which is my package name). But before we get two executable in beginner_tutorials, the last thing we should do is to change some content in Cmakelists.txt, the Cmakelists.txt in the tutorial also has something wrong.
In the tutorial:

# %Tag(FULLTEXT)%
cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)

## Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg)

## Declare ROS messages and services
add_message_files(FILES Num.msg)
add_service_files(FILES AddTwoInts.srv)

## Generate added messages and services
generate_messages(DEPENDENCIES std_msgs)

## Declare a catkin package
catkin_package()

## Build talker and listener
include_directories(include ${catkin_INCLUDE_DIRS})

add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
add_dependencies(talker beginner_tutorials_generate_messages_cpp)

add_executable(listener src/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
add_dependencies(listener beginner_tutorials_generate_messages_cpp)

# %EndTag(FULLTEXT)%

we should comment out

add_message_files(FILES Num.msg)
add_service_files(FILES AddTwoInts.srv)

this two line, which means it should be like this: #add.......

if you don't do this, you will find something wrong when you try to use catkin_make


Originally posted by YunfeiLu on ROS Answers with karma: 21 on 2015-02-03

Post score: 0


Original comments

Comment by kokirits on 2015-02-04:
Could you add the CMakeLists.txt and the console output from catkin_make in your post?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Without the actual console output from your catkin_make invocation (and the error message), the below is just a guess, but:

[..] we should comment out

add_message_files(FILES Num.msg)
add_service_files(FILES AddTwoInts.srv)

this two line, which means it should be like this: #add.......

if you don't do this, you will find something wrong when you try to use catkin_make

I don't think your suggested changes are needed.

Do you still have the Num.msg and AddTwoInts.srv files in the msg and srv subdirectories of your package from the Creating a ROS msg and srv tutorial? If you don't, then catkin_make will probably fail, as it cannot find those files.

The Writing a Simple Publisher and Subscriber (C++) tutorial explicitly states (under 1.3 Building your nodes) (emphasis mine):

The generated CMakeLists.txt should look like this (with modifications from the Creating Msgs and Srvs tutorial and unused comments and examples removed)

And then shows the lines you added to your OP.

If msg/Num.msg and srv/AddTwoInts.srv are no longer in your package, then you should comment the lines you suggested. But in general they should be there, as the next tutorials (Writing a Simple Service and Client (C++) fi) depend on them.


Originally posted by gvdhoorn with karma: 86574 on 2015-02-05

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.