0
$\begingroup$

Rosanswers logo

Hey everybody,

I am trying to build a ROS node that receives all the messages published by all the other nodes present in my software architecture. This new node should be able to receive any message (with different contents), extract all the data and log it (so it's important for me to be able to know all the contained data types and their values). Is there any good way to:

  • Convert any .msg to some "common" format, like XML (so I can treat all the messages as just one string and then do my parsing)?
  • If not, how do I to easily parse each contained data inside any message ( type and value )?. I want to treat all the messages as if they were generic; I don't want to manually extract all the data one variable at a time, this would force me to make one hardcoded callback for each topic.
  • Also, is there any better way to receive all the messages from any node with any topic without having to create a new subscriber and a callback for each new topic in my "listener" node?

Thanks!


Originally posted by pparescasellas on ROS Answers with karma: 95 on 2011-06-15

Post score: 0

$\endgroup$

4 Answers 4

0
$\begingroup$

Rosanswers logo

The rosbag tool already does basically what you ask, e.g.

rosbag record --all

It records topic data efficiently to disk, which allows you to do offline processing (using the rosbag library). Efficiency is important as it's generally not a good idea to subscribe to all topics (it creates a huge performance drain).


Originally posted by kwc with karma: 12244 on 2011-06-15

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by pparescasellas on 2011-06-19:
This is an offline solution which I already use (check my answer below) but that's not what I'm looking for; I need the logging to be on runtime and in a matlab-friendly format. I also need to know whether it is possible to deserialize every message of any topic to name-type-value for each attribute

$\endgroup$
0
$\begingroup$

Rosanswers logo

Take a look at the internals of rostopic. It likely does much of what you want.


Originally posted by Dan Lazewatsky with karma: 9115 on 2011-06-15

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by pparescasellas on 2011-06-19:
If I could get the output of "rostopic echo" for all topics inside my logging node on runtime that would really make my day! Is this even possible? :)

$\endgroup$
0
$\begingroup$

Rosanswers logo

Thanks for the answers guys. Let's see, I already knew about rosbag but I only use it from the command line; are you suggesting me to call to rosbag / rostopic from within my logger node?

What I need is a node that receives all topics and is able to log them at runtime in a matlab-friendly format. What I do now to achieve that (offline) is:

first of all, record a bag file:

rosbag record -a

Once this is done, I can play this rosbag at any time and log the topics I need:

rosbag play 2011-06-19-17-19-56.bag
rostopic echo -p /any_topic/bleh > log.txt

This is exactly what I need for the logging part. Is this possible to achieve from within a node subscribed to all the topics? If so, do I really need to subscribe manually to all the topics or there's a way to subscribe to all of them?

Also, it would be nice for me to be able to convert any ROS message to an xml-like notation (something like <name="age" type="integer" value"30"/> if the message contains an uint32 age = 30 ).

Thanks for your patience!


Originally posted by pparescasellas with karma: 95 on 2011-06-19

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by felix k on 2013-07-24:
This is no answer.

$\endgroup$
0
$\begingroup$

Rosanswers logo

For conversion, the python API for rosbag might help. Have a look here. Python should support introspection for (recorded) ROS messages which should make it possible to convert them to XML.


Originally posted by Lorenz with karma: 22731 on 2011-06-19

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Lorenz on 2011-06-19:
Not necessarily :) With rospy you should be able to import the correct messages at runtime and subscribe to topics. You also should be able to introspect messages, i.e. you should be able to get a list of slots and to access the slots.

Comment by pparescasellas on 2011-06-19:
Are you suggesting that I record a rosbag for every message received, store it, open it and parse it using python? :P

Comment by pparescasellas on 2011-06-19:
I really need the xml-like conversion at runtime (it does not need to be XML, I just need to be able to know all the attribute names, types and values of all messages received at runtime in a somewhat dynamic way). That's what the HTTP server is going to respond to any petition.

$\endgroup$

Your Answer

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