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 const std::map<EpisodeStatus, std::string> episode_status_descriptor;
51 static const std::map<ActionStatus, std::string> action_status_descriptor;
52 static const std::map<ObjectPoseEventType, std::string> object_type_descriptor;
53
54
55 protected:
56 void onInitComponent() override;
57
58 void onConnectComponent() override;
59
60 void onDisconnectComponent() override;
61
62 void onExitComponent() override;
63
65
66 void registerEpisodeEvent(const EpisodeEvent&,
67 const Ice::Current& = Ice::emptyCurrent) override;
68 void registerImageEvent(const ImageEvent&,
69 const Ice::Current& = Ice::emptyCurrent) override;
70 void registerObjectPoseEvent(const ObjectPoseEvent&,
71 const Ice::Current& = Ice::emptyCurrent) override;
72 void registerActionEvent(const ActionEvent&,
73 const Ice::Current& = Ice::emptyCurrent) override;
74 void registerHumanPoseEvent(const Body25HumanPoseEvent&,
75 const Ice::Current& = Ice::emptyCurrent) override;
76 void registerSpeechEvent(const SpeechEvent&,
77 const Ice::Current& = Ice::emptyCurrent) override;
78 void registerKinematicUnitEvent(const KinematicUnitEvent&,
79 const Ice::Current& = Ice::emptyCurrent) override;
80 void registerPlatformUnitEvent(const PlatformUnitEvent&,
81 const Ice::Current& = Ice::emptyCurrent) override;
82 void registerPlatformUnitTargetEvent(const PlatformUnitTargetEvent&,
83 const Ice::Current& = Ice::emptyCurrent) override;
84 void notifyKeyframe(const Ice::Current& = Ice::emptyCurrent) override;
85
86
87 private:
88 void export_episode() const;
89 void clearAll();
90
91 static const std::string NO_EPISODE;
92
93 bool m_enable_export;
94 std::string m_export_folder;
95
96 Episode m_current_episode;
97
98 std::mutex episodeEventMutex;
99 std::mutex imageEventMutex;
100 std::mutex objectPoseEventMutex;
101 std::mutex actionEventMutex;
102 std::mutex humanPoseEventMutex;
103 std::mutex speechEventMutex;
104 std::mutex kinematicUnitEventMutex;
105 std::mutex platformUnitEventMutex;
106 std::mutex platformUnitTargetEventMutex;
107 };
108} // 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.