ROS beginner tutorials building nodes issue
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
)
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 pressctrl+k
. That should format everything correctly.