ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The best solution to programmatic rosbag recording I've found is to wrap rosbag::Recorder in a C++ node. There isn't a way to shutdown recording in Recorder, but there can be a subscriber which calls ros::shutdown which will cleanly close the current recording bag file, and then the the node can be set to respawn=true. The exclude list can be passed in as a parameter and then useful other parameters set like below, or have params override defaults as desired:
recorder_options_.exclude_regex = some_string_from_ros_param;
ROS_INFO_STREAM("exclude list \"" << recorder_options_.exclude_regex << "\"");
recorder_options_.record_all = true;
recorder_options_.trigger = false;
recorder_options_.regex = false;
recorder_options_.do_exclude = true;
recorder_options_.quiet = false;
recorder_options_.append_date = true;
recorder_options_.verbose = false;
recorder_options_.buffer_size = 1048576 * 512;
recorder_options_.chunk_size = 1024 * 768;
recorder_options_.limit = 0; // 0 is unlimited
recorder_options_.split = true;
recorder_options_.max_size = 1024 * 1024 * 1024;
recorder_options_.min_space = 1024 * 1024 * 1024;
recorder_options_.min_space_str = "Recording space is running out";