Ask Your Question
0

ROS beginner tutorials building nodes issue

asked 2020-05-08 04:33:02 -0500

jimc91 gravatar image

updated 2020-05-08 04:37:20 -0500

I am working through the ROS begnner tutorials, specifically on this section I am running into an issue:

http://wiki.ros.org/ROS/Tutorials/Wri...

I am using ROS kinetic and Ubuntu16.04 LTS.

I section 3, I have added the extra lines below to the CMakeLists.txt file:

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)

Once these are added, I have saved the .txt file and have then run the following command to add dependencies for the executable targets to message generation targets:

add_dependencies(talker beginner_tutorials_generate_messages_cpp)

Note that the abve command had to be edidet to escape the brackets, it now looks like below:

add_dependencies(talker beginner_tutorials_generate_messages_cpp)

However, when I run this command I get the following error:

add_dependencies(talker: command not found

I am unsure why this is, I have seen similar issues on forums such as here https://answers.ros.org/question/6741..., but could not find a solution for mine, maybe I have missed the solution somewhere.

Has anyone come across this before and has a solution?

Below is my CMakeLists.txt file (Note that I have put a . between the # so as the text does not look so large.

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

message_generation

)

.#.#. 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(

CATKIN_DEPENDS message_runtime

)

.#.# Build talker and listener

${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

)

edit retag flag offensive close merge delete

Comments

Note that I have put a . between the # so as the text does not look so large.

that is because you are using >, which are for quoting ordinary text, not code (or build scripts, or terminal copy-pastes, etc).

If you want to format blocks verbatim (as would be needed for code, console text, etc), then paste the text into your question, select all the lines and press the Preformatted Text button (the one with 101010 on it), or press ctrl+k. That should format everything correctly.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-08 05:46:16 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-05-08 05:43:40 -0500

gvdhoorn gravatar image

I have [..] then run the following command to add dependencies for the executable targets to message generation targets:

add_dependencies(talker beginner_tutorials_generate_messages_cpp)

Similar to your other question (#q351468): what you show is not a command you run in the terminal, but another statement to add to the CMakeLists.txt of the package.

From the CMakeLists.txt you show it would appear it's already there, so things should be OK like this.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-05-08 04:33:02 -0500

Seen: 26 times

Last updated: May 08