[ros-users] ros node protocol
Brian Gerkey
gerkey at willowgarage.com
Mon May 24 14:42:37 UTC 2010
On Sat, May 22, 2010 at 5:59 AM, Andrew Harris <andrew.unit at gmail.com> wrote:
> I'm interested in implementing a client library in language X.
> I've read the below "Implementing Client Libraries" page, and it's
> quite informative. I know that a ros node has to have an XMLRPC
> server running as well as an additional TCP socket to handle incoming
> topic connection requests and that the node also has to support a
> commandline API. The thing I am not so sure about is all of the
> marshalling and demarshalling stuff that is created automatically for,
> for example, the rospy client. I define my new messages in a YAML
> file and there is some magic that creates python functions to do the
> marshalling and demarshalling. That implies that I must also write
> functions in some language (not necessarily language X) that reads
> YAML files and outputs marshalling and demarshalling routines in
> language X? And it has to integrate with cmake? This is the part
> that I am not so sure about.
hi Andrew,
Marshaling code is produced by language-specific code generators.
They parse the .msg and .srv files (the syntax is C-like, not YAML)
and produce bindings for each language. We've recently reorganized
the code used by rospy to make it easier to write new generators. You
can see the first example of this new way of writing generators in
roscpp (in the unstable 1.1.x series), specifically
src/roscpp/msg_gen.py, scripts/genmsg_cpp.py, and
scripts/gensrv_cpp.py. The two scripts are called during the build
with .msg or .srv files as command-line arguments.
As for integration with CMake, each client library should declare a
dependency on `roslang` and export a cmake file to roslang. You can
see this is in, for example, roscpp/manifest.xml. The exported cmake
file will be included automatically by the build system. That
exported file should set up the targets necessary to invoke the code
generators. There is not any documentation on writing that cmake
file, but you should be able to figure it out by looking at the
existing examples (e.g., roscpp/cmake/roscpp.cmake,
rospy/cmake/rospy.cmake, roslisp/cmake/roslisp.cmake).
Other than that, you just need to implement the transport(s) that you
want to support. The first one should be TCPROS.
brian.
More information about the ros-users
mailing list