[ros-users] Message introspection in C++

Josh Faust jfaust at willowgarage.com
Sat Nov 6 20:28:53 UTC 2010

There's nothing that allows that currently.  It's something we've talked
about, but haven't actually found a need for (generally if you're doing this
kind of thing Python works fine, with C bindings if some part of it needs to
be faster).

There are a couple options for implementing it, but I think the one I'd go
with is a .msg parser in C++ that could introspect directly on the
serialized data.  The other option is to create a reflection system and have
every message package create a .so that can be dynamically loaded so that
the generated message itself can be created at runtime.  Neither option is a
small amount of work, but as long as you only need read support the first is
probably easier.  The second requires modifying the message generators and
automatically generating that .so for every message package, in addition to
the reflection system itself (which could be pulled from elsewhere).


On Fri, Nov 5, 2010 at 5:32 PM, Tim Niemueller <
niemueller at kbsg.rwth-aachen.de> wrote:

> Hello ROS users.
> For an application I'm writing I need message introspection. This means
> given the name and type of a topic (from a config or user input), I want
> to open it in a generic way, i.e. similar to how rosbag record does it.
> But instead of requiring only the binary blob for storage, I would like
> to be able to iterate over the message in a key/value pair fashion.
> To get a good efficiency out of it, I would like to do this with C++.
> Does someone know a way to achieve this? I looked through the code but I
> couldn't see anything that would allow this, so I hope I'm just missing
> something. Can someone point me into the right direction?
> I know this is easy with Python and Lua, and I'm doing that for now, but
> I would like to have the option to do this in C++ when the need for
> extra performance arises.
> Thanks for your time,
>        Tim
> --
> AllemaniACs RoboCup Team            KBSG - Knowledge-Based Systems Group
> ========================================================================
> http://robocup.rwth-aachen.de                     RWTH Aachen University
> http://www.kbsg.rwth-aachen.de                           Ahornstrasse 55
> http://www.fawkesrobotics.org                             D-52056 Aachen
> Currently at:
> Carnegie Mellon University, Intel Research Pittsburgh, Personal Robotics
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20101106/01daae5b/attachment-0003.html>

More information about the ros-users mailing list