Ask Your Question
0

Rosbag Record Until Disk is Almost Full

asked 2021-04-03 12:18:34 -0500

matthew.castleberry gravatar image

I am using ROS1 Noetic on a high altitude balloon payload running Ubuntu Mate 20.04 on a Raspberry Pi 4 collecting camera imagery and other sensor data. During the first flight it worked well but filled up the sd card and prevented future booting of the Pi. I could recover the data but never boot the Pi again. For the second flight, a more elegant solution is to stop the recording of ROS bags right before the disk fills up. The rosbag record command has an argument for max_splits, but it deletes existing files. I am more interested in the data it collects in the air at the beginning of the flight than the data of it sitting on the ground waiting to be recovered. Here is the record command I am using:

rosbag record -o ~/bagfiles/flight --split --size=4096

What is the most reliable way of stopping the rosbag recording just before the storage fills up?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-04-05 09:13:35 -0500

tryan gravatar image

updated 2021-04-05 09:14:21 -0500

It seems the easiest thing would be to predetermine a maximum size or duration then use the --size=SIZE or --duration=DURATION flags without --split. The recording node will stop at the size/duration you set. The documentation mentions the --duration flag on its own, but for some reason only shows the --size flag in conjunction with --split. Note that DURATION defaults to seconds, but you can set it in minutes or hours; and SIZE is in MB.

edit flag offensive delete link more

Comments

Maybe I was complicating it a bit, but based on your suggestion, I can calculate how much space is available on the flash card and use that as the --size argument in MB. Since I have concern the battery has a chance of dying before it runs out of space due to numerous factors, I can just use max_splits as a multiplier of a smaller file size to ensure I do not fill up all the storage.

matthew.castleberry gravatar image matthew.castleberry  ( 2021-04-10 13:46:10 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-04-03 10:05:34 -0500

Seen: 124 times

Last updated: Apr 05 '21