From Aaron Schiffman via @ros-users
Dear ROS-Users,
I've created a rosbag writer implementation for Java, and posted it to a new BitBucket repository. It should be functional for writing a rosbag format 2.0 none compression rosbag in Android or Java ROS implementations (Client or Server). If your interested the source repository is located at:
How to use the Bag class:
- Initialize the org.happy.artist.rmdmia.
utilities.ros.bag.Bag class. - Call bag.start(OutputStream os, Bag.CHUNK_COMPRESSION_NONE)); // Where os is the OutputStream you intend to write the file. Examples could be a FileOutputStream, or a network output stream that writes the file to Google Drive, or Dropbox (just examples).
- Call bag.addConnectionHeader(char[] topic, int conn, char[] connection_header_hex); for each new connection header on connection handshake. int conn is a unique int connection id chosen for the connection (might be a good idea to iterate through topic ids to create an int array, or other mechanism to chose a unique int. connection_header_hex will be the ROS Serialized Message in the connection header.
- Call bag.addMessage(long time, int conn, char[] message_data_hex); Pass in the long time, associated connection header int conn id, and the ROS serialized message to add to the rosbag file.
This Java code is poorly documented, however, I wanted to share it with ROS Community for Java/Android ROS clients that want to record rosbag files. Good luck using it. Releasing under Apache 2.0 license.
I wish I had more time to clean up the code better, and if you have questions or want to contribute send me a message.
Thanks,
Aaron
Aaron
Leave a comment