|
Project: bagserver License: BSD Dependencies:
Used by: |
bagserver Documentationbagserver: Random access into the bag filesThis is a convenience tool to access random messages recorded in bag files. The main target is testing and debugging. Potential use includes access of some information from the past.
bagserver allows to play back any intervals of bag files. and playing them back. it doesbagserver uses an index over multiple bag files to play back any part of them in response to the service request. The index is built with history_build_index.py. Usagehistory_build_index.py <index_name> <topic_filter> bag_names Index builder takes the name to store the index, a comma-separated list of topics to include in the index and a list of bag file names. Note that the file names will be stored in the index name and should be available to the history service. bagserver_srv.py <out_namespace> <index_name> bagserver_srv.py takes the output namespace and the index name. All messages will returned will be broadcast in their original topic names relocated to the the output namespace. The index file contains the names of all bag files used in the index. bagserver_query.py fromsec[.from_fraction_sec] tosec[.to_fraction_sec] [svc_name=hist] [topics=*] bagserver_query.py asks the history server to send out everything in the specified interface. You can optionally specify which history service to query and which topics should be listed. The time is specified in the format of secons[.fraction]. The fraction of secons is padded with "0" on the right to have 9 characters and then it's converted to nsec. content and formatThe index contains: a mapping from (time,topic) to file number and file offset list of files a list of all topics in the index with message types and md5sums a list of bag file names To map from (time,topic) to file position, we have a hashtable indexed by a secon (i.e. time.secs). The hastable entry has a mapping from topic name to an ordered list of (nsec,file_offset,file_number). To find the position in the index. we lookup by the second and then linearly search in the entries for the particular topic. ExampleThe example requires some bag files. Use make test to get them: roscd bagserver make test Create an index from bag files: rosrun bagserver history_build_index.py test_images2.tmp.index /stereo/left/image,/stereo/right/image_rect test_images2.bag Launch the stereo processor (note, that is's in the scope /hist) roslaunch test/stereo.launch Launch the history server rosrun bagserver bagserver_srv.py _namespace:=/hist _index:=$(rospack find bagserver)/test_data/test_images2.index Set rviz to listen to /stereo/left/image and run Do this several times: ./src/bagserver_query.py 1244500678 1244500702 You will see the stereo output from that interval. |