Fixposition SDK 0.0.0-heads/main-0-g97f6014
Collection of c++ libraries and apps for use with Fixposition products on Linux
Loading...
Searching...
No Matches
fpsdk::ros2::bagwriter::BagWriter Class Reference

ROS2 bag writer helper. More...

#include <bagwriter.hpp>

Public Member Functions

bool Open (const std::string &path, const int compress=0)
 Open bag for writing.
void Close ()
 Close bag.
template<typename T>
bool WriteMessage (const T &msg, const std::string &topic, const rclcpp::Time &time)
 Write a message to the bag.
template<typename T>
bool WriteMessage (const T &msg, const std::string &topic, const common::time::RosTime &time)
 Write a message to the bag.
void AddMsgDef (const common::fpl::RosMsgDef &rosmsgdef)
 Add ROS message definition from .fpl.
bool WriteMessage (const common::fpl::RosMsgBin &rosmsgbin)
 Write message from .fpl.

Detailed Description

ROS2 bag writer helper.

Definition at line 43 of file bagwriter.hpp.

Member Function Documentation

◆ Open()

bool fpsdk::ros2::bagwriter::BagWriter::Open ( const std::string & path,
const int compress = 0 )

Open bag for writing.

Parameters
[in]pathPath of the bag directory
[in]compressCompress bag, 0 = no compression, 1 = ... Note: not fully implemented
Returns
true if bag was sucessfully opened

◆ WriteMessage() [1/3]

template<typename T>
bool fpsdk::ros2::bagwriter::BagWriter::WriteMessage ( const T & msg,
const std::string & topic,
const rclcpp::Time & time )
inline

Write a message to the bag.

Template Parameters
TROS message type
Parameters
[in]msgThe message
[in]topicTopic name
[in]timeBag record time
Returns
true if message was added, false otherwise (message definition missing)

Definition at line 76 of file bagwriter.hpp.

References WARNING.

Referenced by WriteMessage().

◆ WriteMessage() [2/3]

template<typename T>
bool fpsdk::ros2::bagwriter::BagWriter::WriteMessage ( const T & msg,
const std::string & topic,
const common::time::RosTime & time )
inline

Write a message to the bag.

Template Parameters
TROS message type
Parameters
[in]msgThe message
[in]topicTopic name
[in]timeBag record time

Definition at line 99 of file bagwriter.hpp.

References fpsdk::common::time::RosTime::nsec_, fpsdk::common::time::RosTime::sec_, and WriteMessage().

◆ AddMsgDef()

void fpsdk::ros2::bagwriter::BagWriter::AddMsgDef ( const common::fpl::RosMsgDef & rosmsgdef)

Add ROS message definition from .fpl.

Note
No checks on the provided data are done!
Parameters
[in]rosmsgdefThe message definition

◆ WriteMessage() [3/3]

bool fpsdk::ros2::bagwriter::BagWriter::WriteMessage ( const common::fpl::RosMsgBin & rosmsgbin)

Write message from .fpl.

Note
No checks on the provided data are done!
Parameters
[in]rosmsgbinThe recorded message
Returns
true if message was added, false otherwise (e.g. ROS1->ROS2 conversion not implemented)

The documentation for this class was generated from the following file: