sas
Modularised monitoring, logging, and control of robots.
Loading...
Searching...
No Matches
sas::DataloggerClient Class Reference

Lightweight client for publishing log data. More...

#include <sas_datalogger_client.hpp>

Inheritance diagram for sas::DataloggerClient:
sas::Object

Public Member Functions

 DataloggerClient (const rclcpp::Node::SharedPtr &node, const size_t &queue_size=100)
 Construct a new DataloggerClient.
 
bool is_enabled () const
 Check if the datalogger is enabled (publisher is valid).
 
void log (const std::string &name, const MatrixXd &value)
 Log a matrix value under the given name.
 
void log (const std::string &name, const VectorXd &value)
 Log a vector value under the given name.
 
void log (const std::string &name, const std::vector< double > &value)
 Log a std::vector<double> value under the given name.
 
void log (const std::string &name, const double &value)
 Log a scalar double value under the given name.
 
void log (const std::string &name, const std::string &value)
 Log a string value under the given name.
 
void save (const std::string &filename)
 Request saving the logged data to the specified filename.
 

Detailed Description

Lightweight client for publishing log data.

DataloggerClient provides helpers to publish various types (matrices, vectors, scalars and strings) as sas_msgs::msg::LogDatum messages. It is intended for runtime logging and can also request saving logged data to a file via the save method.

Constructor & Destructor Documentation

◆ DataloggerClient()

sas::DataloggerClient::DataloggerClient ( const rclcpp::Node::SharedPtr &  node,
const size_t &  queue_size = 100 
)

Construct a new DataloggerClient.

Parameters
nodeShared pointer to the ROS2 node used for publishing.
queue_sizePublisher queue size (default: 100).

Member Function Documentation

◆ is_enabled()

bool sas::DataloggerClient::is_enabled ( ) const

Check if the datalogger is enabled (publisher is valid).

Returns
true when enabled and ready to publish messages.
false otherwise.

◆ log() [1/5]

void sas::DataloggerClient::log ( const std::string &  name,
const double &  value 
)

Log a scalar double value under the given name.

Parameters
nameKey/name under which the value will be logged.
valueThe double value to log.

◆ log() [2/5]

void sas::DataloggerClient::log ( const std::string &  name,
const MatrixXd &  value 
)

Log a matrix value under the given name.

Parameters
nameKey/name under which the value will be logged.
valueThe Eigen::MatrixXd value to log.

◆ log() [3/5]

void sas::DataloggerClient::log ( const std::string &  name,
const std::string &  value 
)

Log a string value under the given name.

Parameters
nameKey/name under which the value will be logged.
valueThe string value to log.

◆ log() [4/5]

void sas::DataloggerClient::log ( const std::string &  name,
const std::vector< double > &  value 
)

Log a std::vector<double> value under the given name.

Parameters
nameKey/name under which the value will be logged.
valueThe std::vector<double> value to log.

◆ log() [5/5]

void sas::DataloggerClient::log ( const std::string &  name,
const VectorXd &  value 
)

Log a vector value under the given name.

Parameters
nameKey/name under which the value will be logged.
valueThe Eigen::VectorXd value to log.

◆ save()

void sas::DataloggerClient::save ( const std::string &  filename)

Request saving the logged data to the specified filename.

Parameters
filenamePath to the file where data should be saved.

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