RobotStateMemory.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::RobotSensorMemory
17 * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18 * @date 2020
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25#include <mutex>
26#include <queue>
27
29
33
34#include <RobotAPI/interface/core/RobotLocalization.h>
46
47namespace armarx::plugins
48{
51} // namespace armarx::plugins
52
54{
55
56 /**
57 * @defgroup Component-RobotSensorMemory RobotSensorMemory
58 * @ingroup RobotAPI-Components
59 * A description of the component RobotSensorMemory.
60 *
61 * @class RobotSensorMemory
62 * @ingroup Component-RobotSensorMemory
63 * @brief Brief description of class RobotSensorMemory.
64 *
65 * Detailed description of class RobotSensorMemory.
66 */
68 virtual public armarx::Component,
72 virtual public armarx::GlobalRobotPoseProvider
73 {
74 public:
77
78
79 std::string getDefaultName() const override;
80
81
82 // GlobalRobotPoseProvider interface
83 armarx::PoseBasePtr getGlobalRobotPose(Ice::Long timestamp,
84 const std::string& robotName,
85 const ::Ice::Current& /*unused*/) override;
86
87
88 protected:
90
91 void onInitComponent() override;
92 void onConnectComponent() override;
93 void onDisconnectComponent() override;
94 void onExitComponent() override;
95
96
97 private:
98 void startRobotUnitStream();
99 void stopRobotUnitStream();
100
101 // RemoteGUI
102 void RemoteGui_update() override;
103 void createRemoteGuiTab();
104 void clearRobotStateWriterQueue();
105
106 struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
107 {
108 armarx::RemoteGui::Client::Button clearRobotStateWriterQueueButton;
109 };
110 RemoteGuiTab tab;
111
112
113 armarx::plugins::DebugObserverComponentPlugin* debugObserver = nullptr;
114
115
116 // Core segments
117 // - description
118 description::Segment descriptionSegment;
119
120 // - proprioception
121 proprioception::Segment proprioceptionSegment;
122 armem::data::MemoryID robotUnitProviderID;
123
124 // - exteroception
125 exteroception::Segment exteroceptionSegment;
126
127 // - localization
128 localization::Segment localizationSegment;
129
130 // Joint visu for all segments => robot pose and configuration
131 Visu commonVisu;
132
133 struct RobotUnit
134 {
135 // params
136 static constexpr float ROBOT_UNIT_MAXIMUM_FREQUENCY = 100;
137 static constexpr const char* sensorValuePrefix = "RobotUnit.";
138
139 float pollFrequency = 50;
140
144
145 // queue
147 std::unique_ptr<Queue> dataBuffer;
148
149 bool waitForRobotUnit = false;
150 };
151
152 RobotUnit robotUnit;
153 };
154
155} // namespace armarx::armem::server::robot_state
std::string timestamp()
Provides a ready-to-use ArViz client arviz as member variable.
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
The RobotUnit class manages a robot and its controllers.
Definition RobotUnit.h:192
Base class of memory server components.
void onInitComponent() override
Pure virtual hook for the subclass.
void onDisconnectComponent() override
Hook for subclass.
armarx::PoseBasePtr getGlobalRobotPose(Ice::Long timestamp, const std::string &robotName, const ::Ice::Current &) override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Creates the property definition container.
void onConnectComponent() override
Pure virtual hook for the subclass.
std::string getDefaultName() const override
Retrieve default name of component.
Models decay of object localizations by decreasing the confidence the longer the object was not local...
Definition Visu.h:45
Brief description of class DebugObserverComponentPlugin.
boost::sync_queue< RobotUnitData > Queue
This file is part of ArmarX.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.