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

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 (int server_count=1) const
 Check if the datalogger is enabled (publisher is valid).
void log (const std::string &name, const Eigen::Ref< const MatrixXd > &value)
 Log a matrix (MatrixXd) or vector (VectorXd) 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

Client for publishing log data.

DataloggerClient provides methods 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 ( int server_count = 1) const

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

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

◆ log() [1/4]

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/4]

void sas::DataloggerClient::log ( const std::string & name,
const Eigen::Ref< const MatrixXd > & value )

Log a matrix (MatrixXd) or vector (VectorXd) value under the given name.

Parameters
nameKey/name under which the value will be logged.
valuethe Eigen::Ref<const MatrixXd> value to log.

◆ log() [3/4]

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/4]

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.

◆ 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: