SimpleEpisodicMemory.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 MemoryX::ArmarXObjects::SimpleEpisodicMemory
17 * @author fabian.peller-konrad@kit.edu ( fabian dot peller-konrad 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// STD/STL
26#include <memory>
27#include <mutex>
28#include <string>
29#include <vector>
30
31// Ice
32#include <Ice/Current.h>
33#include <IceUtil/Time.h>
34
35// ArmarX
37
38#include <MemoryX/interface/components/SimpleEpisodicMemoryInterface.h>
39
40namespace memoryx
41{
42
44 virtual public armarx::Component,
45 virtual public SimpleEpisodicMemoryInterface
46 {
47 public:
48 std::string getDefaultName() const override;
49
50 static std::string GetDefaultName();
51
52 static const std::map<EpisodeStatus, std::string> episode_status_descriptor;
53 static const std::map<ActionStatus, std::string> action_status_descriptor;
54 static const std::map<ObjectPoseEventType, std::string> object_type_descriptor;
55
56
57 protected:
58 void onInitComponent() override;
59
60 void onConnectComponent() override;
61
62 void onDisconnectComponent() override;
63
64 void onExitComponent() override;
65
67
68 void registerEpisodeEvent(const EpisodeEvent&,
69 const Ice::Current& = Ice::emptyCurrent) override;
70 void registerImageEvent(const ImageEvent&,
71 const Ice::Current& = Ice::emptyCurrent) override;
72 void registerObjectPoseEvent(const ObjectPoseEvent&,
73 const Ice::Current& = Ice::emptyCurrent) override;
74 void registerActionEvent(const ActionEvent&,
75 const Ice::Current& = Ice::emptyCurrent) override;
76 void registerHumanPoseEvent(const Body25HumanPoseEvent&,
77 const Ice::Current& = Ice::emptyCurrent) override;
78 void registerSpeechEvent(const SpeechEvent&,
79 const Ice::Current& = Ice::emptyCurrent) override;
80 void registerKinematicUnitEvent(const KinematicUnitEvent&,
81 const Ice::Current& = Ice::emptyCurrent) override;
82 void registerPlatformUnitEvent(const PlatformUnitEvent&,
83 const Ice::Current& = Ice::emptyCurrent) override;
84 void registerPlatformUnitTargetEvent(const PlatformUnitTargetEvent&,
85 const Ice::Current& = Ice::emptyCurrent) override;
86 void notifyKeyframe(const Ice::Current& = Ice::emptyCurrent) override;
87
88
89 private:
90 void export_episode() const;
91 void clearAll();
92
93 static const std::string NO_EPISODE;
94
95 bool m_enable_export;
96 std::string m_export_folder;
97
98 Episode m_current_episode;
99
100 std::mutex episodeEventMutex;
101 std::mutex imageEventMutex;
102 std::mutex objectPoseEventMutex;
103 std::mutex actionEventMutex;
104 std::mutex humanPoseEventMutex;
105 std::mutex speechEventMutex;
106 std::mutex kinematicUnitEventMutex;
107 std::mutex platformUnitEventMutex;
108 std::mutex platformUnitTargetEventMutex;
109 };
110} // namespace memoryx
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
void onInitComponent() override
Pure virtual hook for the subclass.
void onDisconnectComponent() override
Hook for subclass.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void registerHumanPoseEvent(const Body25HumanPoseEvent &, const Ice::Current &=Ice::emptyCurrent) override
static const std::map< ActionStatus, std::string > action_status_descriptor
void registerObjectPoseEvent(const ObjectPoseEvent &, const Ice::Current &=Ice::emptyCurrent) override
void registerKinematicUnitEvent(const KinematicUnitEvent &, const Ice::Current &=Ice::emptyCurrent) override
void registerActionEvent(const ActionEvent &, const Ice::Current &=Ice::emptyCurrent) override
void registerSpeechEvent(const SpeechEvent &, const Ice::Current &=Ice::emptyCurrent) override
void onConnectComponent() override
Pure virtual hook for the subclass.
void registerImageEvent(const ImageEvent &, const Ice::Current &=Ice::emptyCurrent) override
void notifyKeyframe(const Ice::Current &=Ice::emptyCurrent) override
void onExitComponent() override
Hook for subclass.
void registerPlatformUnitEvent(const PlatformUnitEvent &, const Ice::Current &=Ice::emptyCurrent) override
void registerPlatformUnitTargetEvent(const PlatformUnitTargetEvent &, const Ice::Current &=Ice::emptyCurrent) override
std::string getDefaultName() const override
Retrieve default name of component.
static const std::map< EpisodeStatus, std::string > episode_status_descriptor
void registerEpisodeEvent(const EpisodeEvent &, const Ice::Current &=Ice::emptyCurrent) override
static const std::map< ObjectPoseEventType, std::string > object_type_descriptor
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
VirtualRobot headers.