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 
30 #include <RobotAPI/interface/core/RobotLocalization.h>
42 
43 namespace armarx::plugins
44 {
45  class DebugObserverComponentPlugin;
46  class RobotUnitComponentPlugin;
47 } // namespace armarx::plugins
48 
50 {
51 
52  /**
53  * @defgroup Component-RobotSensorMemory RobotSensorMemory
54  * @ingroup RobotAPI-Components
55  * A description of the component RobotSensorMemory.
56  *
57  * @class RobotSensorMemory
58  * @ingroup Component-RobotSensorMemory
59  * @brief Brief description of class RobotSensorMemory.
60  *
61  * Detailed description of class RobotSensorMemory.
62  */
64  virtual public armarx::Component,
66  virtual public armarx::ArVizComponentPluginUser,
67  virtual public armarx::GlobalRobotPoseProvider
68  {
69  public:
71  ~RobotStateMemory() override;
72 
73 
74  std::string getDefaultName() const override;
75 
76 
77  // GlobalRobotPoseProvider interface
78  armarx::PoseBasePtr getGlobalRobotPose(Ice::Long timestamp,
79  const std::string& robotName,
80  const ::Ice::Current& /*unused*/) override;
81 
82 
83  protected:
85 
86  void onInitComponent() override;
87  void onConnectComponent() override;
88  void onDisconnectComponent() override;
89  void onExitComponent() override;
90 
91 
92  private:
93  void startRobotUnitStream();
94  void stopRobotUnitStream();
95 
96 
97  armarx::plugins::DebugObserverComponentPlugin* debugObserver = nullptr;
98 
99 
100  // Core segments
101  // - description
102  description::Segment descriptionSegment;
103 
104  // - proprioception
105  proprioception::Segment proprioceptionSegment;
106  armem::data::MemoryID robotUnitProviderID;
107 
108  // - exteroception
109  exteroception::Segment exteroceptionSegment;
110 
111  // - localization
112  localization::Segment localizationSegment;
113 
114  // Joint visu for all segments => robot pose and configuration
115  Visu commonVisu;
116 
117  struct RobotUnit
118  {
119  // params
120  static constexpr float ROBOT_UNIT_MAXIMUM_FREQUENCY = 100;
121  static constexpr const char* sensorValuePrefix = "RobotUnit.";
122 
123  float pollFrequency = 50;
124 
128 
129  // queue
131  std::unique_ptr<Queue> dataBuffer;
132 
133  bool waitForRobotUnit = false;
134  };
135 
136  RobotUnit robotUnit;
137  };
138 
139 } // namespace armarx::armem::server::robot_state
ArVizComponentPlugin.h
armarx::armem::server::robot_state::proprioception::RobotUnitReader
Definition: RobotUnitReader.h:37
armarx::armem::server::robot_state::RobotStateMemory::~RobotStateMemory
~RobotStateMemory() override
RobotStateWriter.h
armarx::armem::server::robot_state::proprioception::Segment
Definition: Segment.h:47
ReadWritePluginUser.h
armarx::armem::server::robot_state::localization::Segment
Definition: Segment.h:44
armarx::armem::server::robot_state::description::Segment
Definition: Segment.h:43
armarx::armem::server::robot_state::RobotStateMemory::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: RobotStateMemory.cpp:101
armarx::armem::server::robot_state::RobotStateMemory::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: RobotStateMemory.cpp:195
armarx::armem::server::robot_state::RobotStateMemory::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: RobotStateMemory.cpp:107
armarx::armem::server::robot_state::proprioception::Queue
boost::sync_queue< RobotUnitData > Queue
Definition: RobotUnitData.h:21
armarx::armem::server::robot_state
Definition: RobotStateMemory.cpp:40
RobotUnitDataStreamingReceiver.h
armarx::armem::server::robot_state::RobotStateMemory::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: RobotStateMemory.cpp:62
armarx::ArVizComponentPluginUser
Provides a ready-to-use ArViz client arviz as member variable.
Definition: ArVizComponentPlugin.h:36
armarx::armem::server::robot_state::RobotStateMemory::getGlobalRobotPose
armarx::PoseBasePtr getGlobalRobotPose(Ice::Long timestamp, const std::string &robotName, const ::Ice::Current &) override
Definition: RobotStateMemory.cpp:207
armarx::plugins
This file is part of ArmarX.
Definition: DebugObserverComponentPlugin.cpp:28
RobotUnitData.h
RobotUnitReader.h
armarx::armem::server::plugins::ReadWritePluginUser
Base class of memory server components.
Definition: ReadWritePluginUser.h:20
Segment.h
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:917
armarx::armem::server::robot_state::RobotStateMemory::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: RobotStateMemory.cpp:201
armarx::armem::server::robot_state::RobotStateMemory
Definition: RobotStateMemory.h:63
armarx::armem::server::robot_state::RobotStateMemory::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: RobotStateMemory.cpp:143
armarx::plugins::RobotUnitComponentPlugin
Definition: RobotUnitComponentPlugin.h:11
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::armem::server::robot_state::exteroception::Segment
Definition: Segment.h:39
Segment.h
Segment.h
Segment.h
armarx::armem::server::robot_state::RobotStateMemory::RobotStateMemory
RobotStateMemory()
Definition: RobotStateMemory.cpp:43
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::armem::server::robot_state::Visu
Models decay of object localizations by decreasing the confidence the longer the object was not local...
Definition: Visu.h:44
armarx::plugins::DebugObserverComponentPlugin
Brief description of class DebugObserverComponentPlugin.
Definition: DebugObserverComponentPlugin.h:48
Visu.h
armarx::armem::server::robot_state::proprioception::RobotStateWriter
Definition: RobotStateWriter.h:54
armarx::human::MemoryID
const armem::MemoryID MemoryID
Definition: memory_ids.cpp:29