Only write pbstream file on success. (#481)

The offline node will now only write the pbstream with the results if the
node finished processing without being interrupted. Partial results are
no longer written.

This also adds logging so that it is clear whether output was written.
master
Wolfgang Hess 2017-08-10 09:18:16 +02:00 committed by Damon Kohler
parent f43e05626e
commit 4173beaf04
1 changed files with 5 additions and 1 deletions

View File

@ -234,7 +234,11 @@ void Run(const std::vector<string>& bag_filenames) {
<< (cpu_timespec.tv_sec + 1e-9 * cpu_timespec.tv_nsec) << " s";
#endif
node.SerializeState(bag_filenames.front() + ".pbstream");
if (::ros::ok()) {
const string output_filename = bag_filenames.front() + ".pbstream";
LOG(INFO) << "Writing state to '" << output_filename << "'...";
node.SerializeState(output_filename);
}
if (FLAGS_keep_running) {
::ros::waitForShutdown();
}