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  */
40  {
43  };
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  */
59  struct Properties
60  {
61  std::vector<MemoryValueID> plottedValues;
62  };
63 
64  /**
65  * @brief Required services.
66  */
67  struct Services
68  {
71  };
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 
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
armarx::armem::client::Reader
Reads data from a memory server.
Definition: Reader.h:24
armarx::armem::client::util::MemoryToDebugObserver::MemoryToDebugObserver
MemoryToDebugObserver(const Properties &properties, const Services &services)
Constructor.
Definition: MemoryToDebugObserver.cpp:34
Reader.h
armarx::armem::client::util::MemoryToDebugObserver::Services::memoryNameSystem
MemoryNameSystem & memoryNameSystem
Definition: MemoryToDebugObserver.h:69
armarx::armem::client::util::MemoryToDebugObserver::Properties::plottedValues
std::vector< MemoryValueID > plottedValues
Definition: MemoryToDebugObserver.h:61
armarx::armem::client::util::to_json
void to_json(simox::json::json &j, const MemoryValueID &id)
Definition: MemoryToDebugObserver.cpp:215
armarx::armem::client::util::MemoryValueID
ID of an ARON value in the memory.
Definition: MemoryToDebugObserver.h:39
armarx::aron::Path
The Path class.
Definition: Path.h:36
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::client::util::MemoryToDebugObserver::Services::debugObserver
armarx::DebugObserverHelper & debugObserver
Definition: MemoryToDebugObserver.h:70
armarx::armem::client::util::from_json
void from_json(const simox::json::json &j, MemoryValueID &id)
Definition: MemoryToDebugObserver.cpp:222
armarx::armem::client::util::MemoryToDebugObserver::pollOnce
void pollOnce()
Query values from the memory and send them to the debug observer.
Definition: MemoryToDebugObserver.cpp:103
armarx::armem::client::util::MemoryToDebugObserver::Properties
Configuration.
Definition: MemoryToDebugObserver.h:59
memory_definitions.h
DebugObserverHelper.h
armarx::armem::client::util::MemoryToDebugObserver
Transfers data from memory servers to the DebugObserver.
Definition: MemoryToDebugObserver.h:51
armarx::armem::index::memoryID
const MemoryID memoryID
Definition: memory_ids.cpp:29
armarx::armem::client::util
Definition: MemoryListener.cpp:13
armarx::armem::client::util::MemoryValueID::entityID
armem::MemoryID entityID
Definition: MemoryToDebugObserver.h:41
PluginUser.h
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:69
armarx::armem::client::util::MemoryToDebugObserver::Services
Required services.
Definition: MemoryToDebugObserver.h:67
armarx::DebugObserverHelper
Brief description of class DebugObserverHelper.
Definition: DebugObserverHelper.h:50
armarx::armem::client::util::MemoryValueID::aronPath
aron::Path aronPath
Definition: MemoryToDebugObserver.h:42