[ros-users] Bag file recording / playback asynchronous in RViz

Joel Cartwright J.J.Cartwright at hw.ac.uk
Wed Sep 1 16:46:06 UTC 2010


Just a thought that comes to mind - would you have a problem with out of
order messages with this script (from different publishers), and still
need to sort them somehow?

The bunching up of messages you are experiencing sounds like it could be
TCP-buffer related, and is probably expected with TCP over wifi. If
you're happy to live with lossy message transfer, you might see a
reduction/elimination of bunching by using the UDP transport at the
subscribers instead. Example of subscribing with UDPROS (publisher needs
no change):

ros::TransportHints hints = ros::TransportHints().udp().tcpNoDelay();
ros::Subscriber mySub =
m_rosHandle->subscribe<geometry_msgs::TwistStamped("topicname", 10,
handlerfunction, hints);

There the transport hints sets UDP as a preference, and falls back to
TCP with the 'no delay' option set.

If you need reliable transfer, you could just try the tcpNoDelay option
without the UDP hint. See more at the bottom of this page:

http://www.ros.org/wiki/roscpp/Overview/Publishers%20and%20Subscribers

Joel

Armin Hornung wrote, On 01/09/10 17:31:
> On 09/01/2010 05:49 PM, Tim Field wrote:
>> Sure.  It may be easier to just use rosbag play on a bag in which the
>> message timestamps have been rewritten to their header timestamp (if
>> available), i.e.
>>
>>     import roslib; roslib.load_manifest('rosbag')
>>     import sys, rosbag
>>     outbag = rosbag.Bag(sys.argv[2], 'w')
>>     try:
>>         for topic, msg, t in rosbag.Bag(sys.argv[1]).read_messages():
>>             outbag.write(topic, msg, msg.header.stamp if
>>     msg._has_header else t)
>>     finally:
>>         outbag.close()
>>
> 
> Great, thanks Tim! That's exactly the postprocessing that I was looking
> for (and I wasn't even aware of that nice Python rosbag API)!
> 
> I just had to filter out "rosout" because a few messages from way in the
> past delayed the real messages for too long, but otherwise all looks
> fine at a first glance.
> 
> Is that worth adding as a full script to rosbag, or at least to mention
> it in the wiki somewhere? I will definitely use that more often to get
> better screencaptures in RViz from bagfiles.
> 
> Cheers,
> Armin
> 
> -- 
> Armin Hornung                              Albert-Ludwigs-Universität
> www.informatik.uni-freiburg.de/~hornunga   Dept. of Computer Science
> HornungA at informatik.uni-freiburg.de        Humanoid Robots Lab
> Tel.: +49 (0)761-203-8010                  Georges-Köhler-Allee 79
> Fax : +49 (0)761-203-8007                  D-79110 Freiburg, Germany
> 
> 
> 
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users

-- 
Research Assistant
Ocean Systems Laboratory
Heriot-Watt University, UK



More information about the ros-users mailing list