SimpleEpisodicMemoryImageConnector.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 VisionX::ArmarXObjects::SimpleEpisodicMemoryImageConnector
17 * @author Fabian Peller ( 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#pragma once
23
25
26// STD/STL
27#include <memory>
28#include <mutex>
29#include <string>
30#include <vector>
31
32// IVT
33#include <Image/ByteImage.h>
34
35// Ice
36#include <Ice/Current.h>
37#include <IceUtil/Time.h>
38
39// ArmarX
42
44#include <VisionX/interface/core/ImageProviderInterface.h>
46
48
49namespace visionx
50{
51
54 {
55 public:
58 {
59 defineRequiredProperty<std::string>("ImageProviderName",
60 "Name of the ImageProviderComponent");
62 "ImageProviderChannel", 0, "The image channel to use");
64 "DebugDrawerTopicName",
65 "DebugDrawerUpdates",
66 "Name of the debug drawer topic that should be used");
67 }
68 };
69
73 {
74 public:
75 /**
76 * @see armarx::ManagedIceObject::getDefaultName()
77 */
78 std::string
79 getDefaultName() const override
80 {
81 return "SimpleEpisodicMemoryImageConnector";
82 }
83
84 /**
85 * @see PropertyUser::createPropertyDefinitions()
86 */
88
89 protected:
90 // ImageProcessor interface
91 void onInitImageProcessor() override;
92 void onConnectImageProcessor() override;
93 void onDisconnectImageProcessor() override;
94 void onExitImageProcessor() override;
95 void process() override;
96
97 private:
98 void checkForNewImages();
99
100 // Meta (Properties)
101 std::string m_image_provider_id;
102 unsigned int m_image_provider_channel;
103 visionx::ImageProviderInterface::ProxyType m_image_provider;
104 visionx::ImageProviderInfo m_image_provider_info;
105 armarx::MetaInfoSizeBase::PointerType m_image_meta_info;
106 IceUtil::Time m_timestamp_last_image;
107
108 // ImageBuffer und ImageInformations
109 CByteImage** m_input_image_buf;
110 CByteImage* m_input_image;
111 std::mutex m_input_image_mutex;
112
113 unsigned int num_of_received_images;
114
115 // Threads and program flow information
116 const unsigned int m_periodic_task_interval = 100;
118 m_periodic_task;
119 bool
120 m_image_received; // Is true, if new images are available (when mode is 'FromTopic' this also means that corresponding keypoints are available)
121 };
122} // namespace visionx
IceUtil::Handle< PeriodicTask< T > > pointer_type
Shared pointer type for convenience.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
PropertyDefinition< PropertyType > & defineRequiredProperty(const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
ImageProcessorPropertyDefinitions(std::string prefix)
The ImageProcessor class provides an interface for access to ImageProviders via Ice and shared memory...
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
void onExitImageProcessor() override
Exit the ImapeProcessor component.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void process() override
Process the vision component.
void onInitImageProcessor() override
Setup the vision component.
void onDisconnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component looses network ...
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
ArmarX headers.