MemoryToDebugObserver.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package RobotAPI::ArmarXObjects::MemoryToDebugObserver
17 * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18 * @date 2023
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25#include <SimoxUtility/json/json.h>
26
28
29#include <RobotAPI/interface/armem/mns/MemoryNameSystemInterface.h>
33
35{
36 /**
37 * @brief ID of an ARON value in the memory.
38 */
44
45 /**
46 * @brief Transfers data from memory servers to the DebugObserver.
47 *
48 * Transfers data from the memory system to the \ref Component-DebugObserver "Debug Observer",
49 * allowing to visualize them in the \ref ArmarXGui-GuiPlugins-PlotterPlugin "Live Plotter".
50 */
52 {
53 public:
54 /**
55 * @brief Configuration.
56 *
57 * Can be converted to and from JSON.
58 */
60 {
61 std::vector<MemoryValueID> plottedValues;
62 };
63
64 /**
65 * @brief Required services.
66 */
72
73 /**
74 * @brief Constructor.
75 */
76 MemoryToDebugObserver(const Properties& properties, const Services& services);
77
78 /**
79 * @brief Query values from the memory and send them to the debug observer.
80 */
81 void pollOnce();
82
83 private:
84 static std::string makeChannelName(const armem::MemoryID& memoryID);
85 static std::string makeDatafieldName(const aron::Path& path);
86
87 armem::client::Reader* getReader(const armem::MemoryID& memoryID);
88
89 Properties properties;
90 Services services;
91
92 std::map<armem::MemoryID, armem::client::Reader> memoryReaders;
93 };
94
95 void to_json(simox::json::json& j, const MemoryValueID& id);
96 void from_json(const simox::json::json& j, MemoryValueID& id);
97
98 void to_json(simox::json::json& j, const MemoryToDebugObserver::Properties& p);
99 void from_json(const simox::json::json& j, MemoryToDebugObserver::Properties& p);
100
101} // namespace armarx::armem::client::util
Brief description of class DebugObserverHelper.
The memory name system (MNS) client.
Reads data from a memory server.
Definition Reader.h:25
void pollOnce()
Query values from the memory and send them to the debug observer.
MemoryToDebugObserver(const Properties &properties, const Services &services)
Constructor.
The Path class.
Definition Path.h:36
void from_json(const simox::json::json &j, MemoryValueID &id)
void to_json(simox::json::json &j, const MemoryValueID &id)