sas
Modularised monitoring, logging, and control of robots.
Loading...
Searching...
No Matches
sas_datalogger_client.hpp
1#pragma once
2/*
3# Copyright (c) 2012-2020 Murilo Marques Marinho
4#
5# This file is part of sas_datalogger.
6#
7# sas_datalogger is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Lesser General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# sas_datalogger is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Lesser General Public License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public License
18# along with sas_datalogger. If not, see <https://www.gnu.org/licenses/>.
19#
20# ################################################################
21#
22# Author: Murilo M. Marinho, email: murilomarinho@ieee.org
23#
24# ################################################################*/
25
26#include <rclcpp/rclcpp.hpp>
27
28#include <sas_core/sas_object.hpp>
29#include <sas_msgs/msg/log_datum.hpp>
30
31#include <eigen3/Eigen/Dense>
32
33
34namespace sas
35{
36
46{
47private:
48 //ros::ServiceClient sc_save;
49 //sas_datalogger::Save sm_save;
50
51 rclcpp::Publisher<sas_msgs::msg::LogDatum>::SharedPtr publisher_log_;
52public:
59 DataloggerClient(const rclcpp::Node::SharedPtr& node, const size_t &queue_size=100);
60
67 bool is_enabled(int server_count=1) const;
68
75 void log(const std::string& name, const Eigen::Ref<const Eigen::MatrixXd>& value);
76
83 void log(const std::string& name, const std::vector<double>& value);
84
91 void log(const std::string& name, const double& value);
92
99 void log(const std::string& name, const std::string& value);
100
106 void save(const std::string &filename);
107};
108
109}
110
Base class for SAS objects.
Definition sas_object.hpp:40
bool is_enabled(int server_count=1) const
Check if the datalogger is enabled (publisher is valid).
Definition sas_datalogger_client.cpp:36
void save(const std::string &filename)
Request saving the logged data to the specified filename.
DataloggerClient(const rclcpp::Node::SharedPtr &node, const size_t &queue_size=100)
Construct a new DataloggerClient.
Definition sas_datalogger_client.cpp:30
void log(const std::string &name, const Eigen::Ref< const Eigen::MatrixXd > &value)
Log a matrix (Eigen::MatrixXd) or vector (Eigen::VectorXd) value under the given name.
Definition sas_datalogger_client.cpp:41