LocalizationQuery.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::Observers
17 * @author Kai Welke (welke at kit dot edu), David Schiebener (david dot schiebener at kit dot edu)
18 * @copyright 2012 Humanoids Group, HIS, KIT
19 * @license http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 #pragma once
23 
24 // memoryx types
25 #include <MemoryX/interface/memorytypes/MemorySegments.h>
26 #include <MemoryX/interface/workingmemory/WorkingMemoryUpdaterBase.h>
29 
30 // std
31 #include <map>
32 #include <set>
33 #include <string>
34 
35 namespace armarx::VariantType
36 {
38  armarx::Variant::addTypeName("::armarx::LocalizationQueryBase");
39 }
40 
41 namespace memoryx
42 {
43  class LocalizationQuery;
45 
46  /**
47  * @brief The LocalizationQuery class is used to create LocalizationJob instances and provide an interface to query if the jobs have finished running
48  */
49  class LocalizationQuery : virtual public LocalizationQueryBase
50  {
51  friend class LocalizationJob;
53  friend class armarx::GenericFactory<LocalizationQueryBase, LocalizationQuery>;
54 
55  public:
56  LocalizationQuery(const std::string& queryName,
57  const std::string& objectClassName,
58  int cycleTimeMS,
59  int priority);
60 
61  /**
62  * @brief getFinished indicates if there are localization jobs in the queue which have not finished yet
63  * @return true if all localization jobs have finished running, false otherwise
64  */
65  bool getFinished();
66 
67  public:
68  // inherited from VariantDataClass
70  ice_clone() const override
71  {
72  return this->clone();
73  }
74 
75  // inherited from variantdataclass
76  armarx::VariantDataClassPtr
77  clone(const Ice::Current& c = Ice::emptyCurrent) const override
78  {
79  LocalizationQueryPtr query =
80  new LocalizationQuery(queryName, className, cycleTimeMS, priority);
81  query->jobsFinished = jobsFinished;
82  return query;
83  }
84 
85  std::string
86  output(const Ice::Current& c = Ice::emptyCurrent) const override
87  {
88  return "";
89  }
90 
91  int
92  getType(const Ice::Current& c = Ice::emptyCurrent) const override
93  {
95  }
96 
97  bool
98  validate(const Ice::Current& c = Ice::emptyCurrent) override
99  {
100  return true;
101  }
102 
103  void
104  serialize(const ::armarx::ObjectSerializerBasePtr&,
105  const Ice::Current& = Ice::emptyCurrent) const override
106  {
107  }
108 
109  void
110  deserialize(const ::armarx::ObjectSerializerBasePtr&,
111  const Ice::Current& = Ice::emptyCurrent) override
112  {
113  }
114 
115  private:
117  {
118  }
119 
120  std::vector<LocalizationJobPtr>
121  createJobs(const memoryx::ObjectClassMemorySegmentBasePtr& objectClassSegment);
122  void setJobFinished(std::string recognitionMethod);
123  ObjectClassPtr getLocalizableObjectClass(const EntityBasePtr& entity);
124 
125  std::mutex jobsMutex;
126  };
127 } // namespace memoryx
memoryx::LocalizationQuery::validate
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Definition: LocalizationQuery.h:98
memoryx::LocalizationJob
The LocalizationJob class is the description of the basic workload executed by ObjectLocalizationMemo...
Definition: LocalizationJob.h:44
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
memoryx::LocalizationQueryPtr
IceInternal::Handle< LocalizationQuery > LocalizationQueryPtr
Definition: LocalizationJobContainer.h:39
ObjectClass.h
memoryx::LocalizationQuery::output
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LocalizationQuery.h:86
IceInternal::Handle
Definition: forward_declarations.h:8
memoryx::LocalizationQuery::getType
int getType(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LocalizationQuery.h:92
memoryx::LocalizationQuery
The LocalizationQuery class is used to create LocalizationJob instances and provide an interface to q...
Definition: LocalizationQuery.h:49
LocalizationJob.h
memoryx::ObjectLocalizationMemoryUpdater
Definition: ObjectLocalizationMemoryUpdater.h:134
memoryx::LocalizationQuery::serialize
void serialize(const ::armarx::ObjectSerializerBasePtr &, const Ice::Current &=Ice::emptyCurrent) const override
Definition: LocalizationQuery.h:104
armarx::VariantType
Definition: ChannelRef.h:167
armarx::VariantType::LocalizationQuery
const armarx::VariantTypeId LocalizationQuery
Definition: LocalizationQuery.h:37
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:43
armarx::GenericFactory
Definition: FactoryCollectionBase.h:51
memoryx::ObjectClassPtr
IceInternal::Handle< ObjectClass > ObjectClassPtr
Definition: ObjectClass.h:35
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
memoryx::LocalizationQuery::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: LocalizationQuery.h:70
memoryx::LocalizationQuery::clone
armarx::VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LocalizationQuery.h:77
memoryx::LocalizationQuery::getFinished
bool getFinished()
getFinished indicates if there are localization jobs in the queue which have not finished yet
Definition: LocalizationQuery.cpp:118
memoryx::LocalizationQuery::deserialize
void deserialize(const ::armarx::ObjectSerializerBasePtr &, const Ice::Current &=Ice::emptyCurrent) override
Definition: LocalizationQuery.h:110
armarx::Variant::addTypeName
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition: Variant.cpp:869