rawlog_record.cpp
Go to the documentation of this file.
1 /***********************************************************************************
2  * Revised BSD License *
3  * Copyright (c) 2014, Markus Bader <markus.bader@tuwien.ac.at> *
4  * All rights reserved. *
5  * *
6  * Redistribution and use in source and binary forms, with or without *
7  * modification, are permitted provided that the following conditions are met: *
8  * * Redistributions of source code must retain the above copyright *
9  * notice, this list of conditions and the following disclaimer. *
10  * * Redistributions in binary form must reproduce the above copyright *
11  * notice, this list of conditions and the following disclaimer in the *
12  * documentation and/or other materials provided with the distribution. *
13  * * Neither the name of the Vienna University of Technology nor the *
14  * names of its contributors may be used to endorse or promote products *
15  * derived from this software without specific prior written permission. *
16  * *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  *AND *
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  **
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
22  * DISCLAIMED. IN NO EVENT SHALL Markus Bader BE LIABLE FOR ANY *
23  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  **
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
27  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  **
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  ** *
32  ***********************************************************************************/
33 #include <mrpt/system/filesystem.h>
34 #include <mrpt/system/string_utils.h>
37 #include <stdarg.h>
38 #include <stdio.h>
39 
40 #include "ros/console.h"
41 
43 {
44  MRPT_TODO("RawlogRecord writes the rawlog only on exit (Ctrl-C)");
45 
46  ROS_INFO_STREAM("writing dataset to disk...");
47  ROS_INFO_STREAM("pRawLog entries:" << pRawLog.size());
48  ROS_INFO_STREAM("pRawLogASF entries:" << pRawLogASF.size());
49 
50  if (pRawLog.size() > 0)
51  {
52  const std::string filename =
54  ROS_INFO_STREAM("Writing dataset rawlog to: " << filename);
55 
56  if (!pRawLog.saveToRawLogFile(filename))
57  {
58  ROS_ERROR_STREAM("Error writing to " << filename);
59  }
60  }
61  if (pRawLogASF.size() > 0)
62  {
63  const std::string filename =
65 
66  ROS_INFO_STREAM("Writing dataset rawlog to: " << filename);
67 
68  if (!pRawLogASF.saveToRawLogFile(filename))
69  {
70  ROS_ERROR_STREAM("Error writing to " << filename);
71  }
72  }
73 }
74 
75 void RawlogRecord::updateRawLogName(const mrpt::system::TTimeStamp& t)
76 {
77  const auto prefix = mrpt::system::dateTimeLocalToString(t);
78 
79  base_param_.raw_log_name = mrpt::system::fileNameStripInvalidChars(
80  prefix + base_param_.raw_log_name);
81  base_param_.raw_log_name_asf = mrpt::system::fileNameStripInvalidChars(
82  prefix + base_param_.raw_log_name_asf);
83 }
std::string raw_log_name_asf
Definition: rawlog_record.h:66
CRawlog pRawLog
Definition: rawlog_record.h:79
filename
CRawlog pRawLogASF
Definition: rawlog_record.h:80
Parameters base_param_
Definition: rawlog_record.h:77
void updateRawLogName(const mrpt::system::TTimeStamp &t)
#define ROS_INFO_STREAM(args)
#define ROS_ERROR_STREAM(args)


mrpt_rawlog
Author(s):
autogenerated on Thu Jun 1 2023 03:07:08