ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A
Ask Your Question

How to use Catkin to generate code for your own client library?

asked 2016-09-27 13:43:01 -0600

Adnan gravatar image

updated 2016-09-28 02:58:40 -0600

I'm currently developing a ROS Client Library for the Rust programming language. The development has been done sporadically in my free time for the last several months. The source code being here:

I pretty much followed the Wiki page for implementing client libraries and the "At a minimum, a client library MUST:" part is feature complete (though not error paths are done yet - I've focused on making the code very concurrent, and in some places I just tell a thread to crash without telling what happened).

Anyways, to be usable, I need to make a .msg file compiler. I'm aware of the existence of gendeps for md5 and message definition. The thing that confuses me is what depending on "roslang" does and how to integrate with rosbuild or catkin to generate .msg files for all dependencies too. So could anyone please shed some light on what the right thing to do here is?

Just to stress this - I already have the rosmsg compiler that takes a *.msg and spits out a .rs file. What I want to know is what the general ROS pipeline is - how to tell ROS, when I say catkin_make, to take a hierarchy of .msg files and put them through my compiler?

edit retag flag offensive close merge delete


Quick comment: rosbuild was the old build infrastructure. This has been replaced by Catkin.

gvdhoorn gravatar imagegvdhoorn ( 2016-09-27 15:11:02 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-09-27 15:19:51 -0600

gvdhoorn gravatar image

updated 2016-09-27 15:25:46 -0600

(note: this answer is for Catkin. For rosbuild, I don't know)

Afaik, there are three parts to this (I'll use gencpp as an example):

  1. a CMake 'extras' file that provides two macros that know how to take in a list of msg or srv defs and pass them on to your generator (gencpp/cmake/gencpp-extras.cmake.em)
  2. exporting from your manifest the language that you'll be generating code for (gencpp/package.xml)
  3. a few bits in your CMakeLists.txt that add a required file (gencpp/CMakeLists.txt)

And make sure to depend on the correct package(s) as well (genmsg among others).

edit flag offensive delete link more


This is from memory and as a 'user'. @Dirk Thomas will probably correct me if I forgot something.

gvdhoorn gravatar imagegvdhoorn ( 2016-09-27 15:20:44 -0600 )edit

This has put me nicely on the track for what to do. Thanks!

Adnan gravatar imageAdnan ( 2016-09-27 15:52:31 -0600 )edit

No problem.

May I suggest that you change the question's title if you're not actually interested in rosbuild? That would better describe the actual question.

gvdhoorn gravatar imagegvdhoorn ( 2016-09-28 00:28:43 -0600 )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



Asked: 2016-09-27 13:43:01 -0600

Seen: 71 times

Last updated: Sep 28 '16