-
record <topic-names>
- Record a bag file with the contents of the specified topics.
$ rosbag record rosout tf cmd_vel
-h, --help
- Show the usage and exit.
$ rosbag record -h
-a, --all
- Record all topics.
$ rosbag record -a
Note that newly published topics are discovered by periodically polling the master. rosbag record -a will likely miss initial messages published on any topic.
-e, --regex
- Match topics using regular expressions.
$ rosbag record -e "/(.*)_stereo/(left|right)/image_rect_color"
Record all topics that contain sensors in their name:
$ rosbag record -e "(.*)sensors(.*)"
-p, --publish New in ROS Melodic
-
Publish a message when the record begin to write a new bag (topic = "begin_write").
$ rosbag record -p
-x EXCLUDE_REGEX, --exclude=EXCLUDE=REGEX
-
Exclude topics matching the given regular expression (subtracts from -a or -e).
$ rosbag record -e "/wide_stereo(.*)" -x "(.*)/points(.*)"
-q, --quiet
- Suppress console output.
$ rosbag record -q /chatter
-d, --duration
- Specify the maximum duration of the recorded bag file.
$ rosbag record --duration=30 /chatter $ rosbag record --duration=5m /chatter $ rosbag record --duration=2h /chatter
-o PREFIX, --output-prefix=PREFIX
- Prepend PREFIX to beginning of bag name before date stamp.
$ rosbag record -o session1 /chatter
-O NAME, --output-name=NAME
- Record to bag with name NAME.bag.
$ rosbag record -O session2_090210.bag /chatter
--split
- Split the bag when maximum size or duration is reached
$ rosbag record --split --size=1024 /chatter $ rosbag record --split --duration=30 /chatter $ rosbag record --split --duration=5m /chatter $ rosbag record --split --duration=2h /chatter
--max-splits=MAX_SPLITS New in ROS Kinetic
- Split bag at most MAX_SPLITS times, then begin deleting the oldest files. This creates a fixed size or duration recording.
$ rosbag record --split --size 1024 --max-splits 3 /chatter $ rosbag record --split --duration 10m --max-splits 6 /chatter
-b SIZE, --buffsize=SIZE
-
Use an internal buffer of SIZE MB (Default: 256, 0 = infinite). This is the message queue of the recorder object, before messages are being passed on to the bag. Lowering this value might result in messages being dropped before they reach the recording process.
$ rosbag record -b 1024 /chatter
--chunksize=SIZE
-
Advanced. Record to chunks of SIZE KB (Default: 768). This is a buffer within the bag file object. Lowering this value will result in more writes to disk.
$ rosbag record --chunksize=1024 /chatter
-l NUM, --limit=NUM
- Only record NUM messages on each topic.
$ rosbag record -l 1000 /chatter
--node=NODE
- Record all topics subscribed to by a specific node
$ rosbag record --node=/joy_teleop
-j, --bz2
-
Use BZ2 compression. See compress for details.
$ rosbag record -j /chatter
- Record a bag file with the contents of the specified topics.
-
--lz4
-
Use LZ4 compression. See compress for details.
$ rosbag record --lz4 /chatter
-
-tcpnodelay
- Use the TCP_NODELAY transport hint when subscribing to topics
--udp