ROS1 bag writer helper.
More...
#include <bagwriter.hpp>
|
bool | Open (const std::string &path, const int compress) |
| Open bag for writing.
|
|
void | Close () |
| Close bag.
|
|
void | WriteMessage (const rosbag::MessageInstance &msg, const std::string &topic="") |
| Write a message to the bag, do nothing if no bag is open.
|
|
template<typename T > |
void | WriteMessage (const T &msg, const std::string &topic, const ros::Time &time={}) |
| Write a message to the bag, do nothing if no bag is open.
|
|
template<typename T > |
void | WriteMessage (const T &msg, const std::string &topic, const RosTime &time={}) |
| Write a message to the bag, do nothing if no bag is open.
|
|
void | AddMsgDef (const std::string &topic, const std::string &msg_name, const std::string &msg_md5, const std::string &msg_def) |
| Add ROS message definition.
|
|
bool | WriteMessage (const std::vector< uint8_t > &data, const std::string &topic, const ros::Time &time={}) |
| Write raw binary (serialised) message.
|
|
bool | WriteMessage (const std::vector< uint8_t > &data, const std::string &topic, const RosTime &time={}) |
| Write raw binary (serialised) message.
|
|
ROS1 bag writer helper.
Definition at line 47 of file bagwriter.hpp.
◆ RosTime
◆ Open()
bool fpsdk::ros1::bagwriter::BagWriter::Open |
( |
const std::string & | path, |
|
|
const int | compress ) |
Open bag for writing.
- Parameters
-
path | Path/filename of the bag file |
compress | Compress bag, 0 = no compression, 1 = LZ4, 2+ = BZ2 |
- Returns
- true if bag was sucessfully opened
◆ WriteMessage() [1/5]
void fpsdk::ros1::bagwriter::BagWriter::WriteMessage |
( |
const rosbag::MessageInstance & | msg, |
|
|
const std::string & | topic = "" ) |
Write a message to the bag, do nothing if no bag is open.
- Parameters
-
[in] | msg | The message |
[in] | topic | Optional topic name, if not given the original topic name is used |
The bag record time of the msg is used in the output bag. This time is stored and used for writing messages that have no time (templated method below).
◆ WriteMessage() [2/5]
template<typename T >
void fpsdk::ros1::bagwriter::BagWriter::WriteMessage |
( |
const T & | msg, |
|
|
const std::string & | topic, |
|
|
const ros::Time & | time = {} ) |
|
inline |
Write a message to the bag, do nothing if no bag is open.
- Template Parameters
-
- Parameters
-
[in] | msg | The message |
[in] | topic | Topic name |
[in] | time | Optional bag record time, if ros::Time() is given the time from the last written message (see method above) is used |
Definition at line 89 of file bagwriter.hpp.
◆ WriteMessage() [3/5]
template<typename T >
void fpsdk::ros1::bagwriter::BagWriter::WriteMessage |
( |
const T & | msg, |
|
|
const std::string & | topic, |
|
|
const RosTime & | time = {} ) |
|
inline |
Write a message to the bag, do nothing if no bag is open.
- Template Parameters
-
- Parameters
-
[in] | msg | The message |
[in] | topic | Topic name |
[in] | time | Optional bag record time, if ros::Time() is given the time from the last written message (see method above) is used |
Definition at line 111 of file bagwriter.hpp.
◆ AddMsgDef()
void fpsdk::ros1::bagwriter::BagWriter::AddMsgDef |
( |
const std::string & | topic, |
|
|
const std::string & | msg_name, |
|
|
const std::string & | msg_md5, |
|
|
const std::string & | msg_def ) |
Add ROS message definition.
- Note
- No checks on the provided data are done!
- Parameters
-
[in] | topic | The topic name |
[in] | msg_name | The message name (a.k.a. data type) |
[in] | msg_md5 | The message MD5 sum |
[in] | msg_def | The message definition |
◆ WriteMessage() [4/5]
bool fpsdk::ros1::bagwriter::BagWriter::WriteMessage |
( |
const std::vector< uint8_t > & | data, |
|
|
const std::string & | topic, |
|
|
const ros::Time & | time = {} ) |
Write raw binary (serialised) message.
- Note
- No checks on the provided data are done!
- Parameters
-
[in] | data | The binary message data |
[in] | topic | The topic name |
[in] | time | Optional bag record time, if not given the time from the last written message is used |
- Returns
- true if message was added, false otherwise (message definition missing)
◆ WriteMessage() [5/5]
bool fpsdk::ros1::bagwriter::BagWriter::WriteMessage |
( |
const std::vector< uint8_t > & | data, |
|
|
const std::string & | topic, |
|
|
const RosTime & | time = {} ) |
Write raw binary (serialised) message.
- Note
- No checks on the provided data are done!
- Parameters
-
[in] | data | The binary message data |
[in] | topic | The topic name |
[in] | time | Optional bag record time, if not given the time from the last written message is used |
- Returns
- true if message was added, false otherwise (message definition missing)
The documentation for this class was generated from the following file: