0
$\begingroup$

Rosanswers logo

I'm new to writing packages in ROS and am confused about message dependencies in catkin.

If I'm going to use the turtlesim/Velocity.msg, what do I have to include in my CMakeLists.txt and my package.xml files? I am not writing my own msg - I simply want to publish turtlesim/Velocity messages to a topic.

In Section 1.3 in the Writing a Simple Publisher and Subscriber tutorial, it says you are supposed to add this to the CMakeLists.txt file:

generate_messages(DEPENDENCIES std_msgs)

When I did that tutorial, I was able to run my talker and listener without adding that line; in fact, when I DID add that line and ran catkin_make, I got an error saying

Unknown CMake command "generate_messages"

Please let me know how I can fix my dependencies, and also if I should worry about "generate_messages" creating an error.

Thanks for your help!


Originally posted by asriraman93 on ROS Answers with karma: 75 on 2013-07-03

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Generate_messages is only needed when you define your own custom messages.

Assuming you are accessing messages defined in some other package using C++, this how-to page should help.

If you access the messages via Python, see this page, too.


Originally posted by joq with karma: 25443 on 2013-07-03

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by asriraman93 on 2013-07-03:
It says there to add the following:

add_dependencies(your_program ${catkin_EXPORTED_TARGETS}) add_dependencies(your_library ${catkin_EXPORTED_TARGETS})

What exactly is "your_program" and "your_library", do they mean 'Package name' and 'Executable'?

Comment by joq on 2013-07-03:
They stand for whichever of your build targets depend on the message headers. A C++ build target is usually either an executable or a library.

Comment by asriraman93 on 2013-07-03:
Now I'm getting the error "Adding dependency to non-existent target: beginner_tutorials"

Am I supposed to be adding something else? I already included "target_link_libraries" the same way it is done for talker and listener in the tutorials.

Comment by joq on 2013-07-03:
Apparently you have some dependency on beginner_tutorials, which is not being resolved. Can you roscd beginner_tutorials?

Comment by asriraman93 on 2013-07-03:
if I do source ./devel/setup.bash, yes.

BUT, if I do "rosmsg package beginner_tutorials" nothing shows up - not even std_msgs/String

Comment by Lucile on 2013-07-03:
You HAVE TO source ./devel/setup.bash ;) After you do that, you should be able to catkinise your package.

$\endgroup$

Your Answer

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