Ask Your Question
1

Msg Dependencies in Catkin

asked 2013-07-03 14:50:20 -0500

asriraman93 gravatar image

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 http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29 (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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-07-03 15:56:40 -0500

joq gravatar image

updated 2013-07-03 15:57:36 -0500

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.

edit flag offensive delete link more

Comments

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'?

asriraman93 gravatar imageasriraman93 ( 2013-07-03 16:07:02 -0500 )edit

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.

joq gravatar imagejoq ( 2013-07-03 16:17:47 -0500 )edit

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.

asriraman93 gravatar imageasriraman93 ( 2013-07-03 17:00:24 -0500 )edit

Apparently you have some dependency on beginner_tutorials, which is not being resolved. Can you roscd beginner_tutorials?

joq gravatar imagejoq ( 2013-07-03 17:11:23 -0500 )edit

if I do source ./devel/setup.bash, yes.

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

asriraman93 gravatar imageasriraman93 ( 2013-07-03 17:17:47 -0500 )edit

You HAVE TO source ./devel/setup.bash ;) After you do that, you should be able to catkinise your package.

Lucile gravatar imageLucile ( 2013-07-03 22:20:58 -0500 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2013-07-03 14:50:20 -0500

Seen: 3,904 times

Last updated: Jul 03 '13