ObjectInstance.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::Core
17 * @author ALexey Kozlov ( kozlov at kit dot edu), Kai Welke (welke at kit got edu)
18 * @date 2012
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
26 #include <MemoryX/interface/core/EntityBase.h>
27 #include <MemoryX/interface/memorytypes/MemoryEntities.h>
28 
31 
33 
34 namespace armarx
35 {
36  template <class IceBaseClass, class DerivedClass> class GenericFactory;
37 }
38 
39 namespace memoryx
40 {
41  class ObjectInstance;
43 
44  class AbstractMotionModel;
46 
48  public memoryx::ObjectInstanceBase,
49  public memoryx::Entity
50  {
51  template <class IceBaseClass, class DerivedClass>
52  friend class armarx::GenericFactory;
53  public:
54 
61  ObjectInstance(const std::string& name, const std::string& id = "");
63 
71  float getExistenceCertainty(const ::Ice::Current& = Ice::emptyCurrent) const override;
72 
80  void setExistenceCertainty(float existenceCertainty, const ::Ice::Current& = Ice::emptyCurrent) override;
81 
82 
83  int getLocalizationPriority(const ::Ice::Current& = Ice::emptyCurrent) const override;
84 
85  void setLocalizationPriority(Ice::Int priority, const ::Ice::Current& = Ice::emptyCurrent) override;
86 
87 
88 
94  EntityAttributeBasePtr getPositionAttribute() const;
95 
102 
108  void setPosition(const armarx::FramedPositionBasePtr& position, const ::Ice::Current& = Ice::emptyCurrent) override;
110  void setLocalizationTimestamp(const armarx::TimestampBasePtr& timestamp);
111  bool hasLocalizationTimestamp() const;
113 
119  MultivariateNormalDistributionBasePtr getPositionUncertainty(const ::Ice::Current& = Ice::emptyCurrent) const override;
120 
126  void setPositionUncertainty(const MultivariateNormalDistributionBasePtr& uncertainty, const ::Ice::Current& = Ice::emptyCurrent) override;
127 
133  EntityAttributeBasePtr getOrientationAttribute() const;
134 
141 
147  void setOrientation(const armarx::FramedOrientationBasePtr& orientation, const ::Ice::Current& = Ice::emptyCurrent) override;
148 
154 
159  void setPose(const armarx::FramedPoseBasePtr& newPose);
160 
166  ClassProbabilityMap getClasses(const ::Ice::Current& = Ice::emptyCurrent) const override;
167 
174  void setClass(const std::string& className, float probability, const Ice::Current& = Ice::emptyCurrent) override;
175 
182  void addClass(const std::string& className, float probability, const Ice::Current& = Ice::emptyCurrent) override;
183 
187  void clearClasses(const Ice::Current& = Ice::emptyCurrent) override;
188 
194  ::std::string getMostProbableClass(const ::Ice::Current& = Ice::emptyCurrent) const override;
195 
201  float getClassProbability(const ::std::string& className, const ::Ice::Current& = Ice::emptyCurrent) const override;
202 
210 
211  // TODO: cloning will probabily also not work without the implementation of a copy constructor
212  Ice::ObjectPtr ice_clone() const override;
213  ObjectInstancePtr clone(const Ice::Current& c = Ice::emptyCurrent) const;
214 
215  protected:
216  // ice interface implementation on Base data types. Replaces in c++ by derived instance getters, setters (see above)
217  armarx::FramedPositionBasePtr getPositionBase(const ::Ice::Current& = Ice::emptyCurrent) const override;
218  armarx::FramedOrientationBasePtr getOrientationBase(const ::Ice::Current& = Ice::emptyCurrent) const override;
219 
221 
222  private:
223  ObjectInstance();
224  void output(std::ostream& stream) const;
225 
226  public: // streaming operator
227  friend std::ostream& operator<<(std::ostream& stream, const ObjectInstance& rhs)
228  {
229  rhs.output(stream);
230  return stream;
231  }
232 
233  friend std::ostream& operator<<(std::ostream& stream, const ObjectInstancePtr& rhs)
234  {
235  rhs->output(stream);
236  return stream;
237  }
238 
239  friend std::ostream& operator<<(std::ostream& stream, const ObjectInstanceBasePtr& rhs)
240  {
241  stream << ObjectInstancePtr::dynamicCast(rhs);
242  return stream;
243  }
244 
245 
246 
247  };
248 
249 }
250 
memoryx::ObjectInstance::hasLocalizationTimestamp
bool hasLocalizationTimestamp() const
Definition: ObjectInstance.cpp:125
memoryx::ObjectInstance::setLocalizationPriority
void setLocalizationPriority(Ice::Int priority, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: ObjectInstance.cpp:147
memoryx::ObjectInstance::getOrientation
armarx::FramedOrientationPtr getOrientation() const
Retrieve orientation of the instance.
Definition: ObjectInstance.cpp:172
memoryx::ObjectInstance::getExistenceCertainty
float getExistenceCertainty(const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve existence certainty for this instance.
Definition: ObjectInstance.cpp:69
Pose.h
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
memoryx::ObjectInstance::getPositionAttribute
EntityAttributeBasePtr getPositionAttribute() const
Retrieve attribute which holds instance position.
Definition: ObjectInstance.cpp:81
memoryx::ObjectInstance
Definition: ObjectInstance.h:47
memoryx::ObjectInstance::setLocalizationTimestamp
void setLocalizationTimestamp(const IceUtil::Time &timestamp)
Definition: ObjectInstance.cpp:115
memoryx::ObjectInstance::setPose
void setPose(const armarx::FramedPoseBasePtr &newPose)
Convenience function to set position and orientation attributes at once.
Definition: ObjectInstance.cpp:190
memoryx::ObjectInstance::setMotionModel
void setMotionModel(AbstractMotionModelPtr motionModel)
Set the motion model for this object.
Definition: ObjectInstance.cpp:289
memoryx::ObjectInstance::operator<<
friend std::ostream & operator<<(std::ostream &stream, const ObjectInstance &rhs)
Definition: ObjectInstance.h:227
memoryx::ObjectInstance::getPositionUncertainty
MultivariateNormalDistributionBasePtr getPositionUncertainty(const ::Ice::Current &=Ice::emptyCurrent) const override
Get uncertainty of position estimate.
Definition: ObjectInstance.cpp:153
memoryx::ObjectInstance::operator<<
friend std::ostream & operator<<(std::ostream &stream, const ObjectInstanceBasePtr &rhs)
Definition: ObjectInstance.h:239
memoryx::ObjectInstance::getClasses
ClassProbabilityMap getClasses(const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve classes and associated class membership probability for this instance.
Definition: ObjectInstance.cpp:198
memoryx::ObjectInstance::getMotionModel
AbstractMotionModelPtr getMotionModel() const
Definition: ObjectInstance.cpp:296
memoryx::ObjectInstance::getLocalizationPriority
int getLocalizationPriority(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: ObjectInstance.cpp:138
IceInternal::Handle< ObjectInstance >
memoryx::ObjectInstance::addClass
void addClass(const std::string &className, float probability, const Ice::Current &=Ice::emptyCurrent) override
Adds new class membership to the class attribute.
Definition: ObjectInstance.cpp:238
memoryx::ObjectInstance::setPositionUncertainty
void setPositionUncertainty(const MultivariateNormalDistributionBasePtr &uncertainty, const ::Ice::Current &=Ice::emptyCurrent) override
Set uncertainty of position estimate.
Definition: ObjectInstance.cpp:159
memoryx::ObjectInstance::getPosition
armarx::FramedPositionPtr getPosition() const
Retrieve position of the instance.
Definition: ObjectInstance.cpp:87
FramedPose.h
memoryx::ObjectInstance::operator<<
friend std::ostream & operator<<(std::ostream &stream, const ObjectInstancePtr &rhs)
Definition: ObjectInstance.h:233
memoryx::ObjectInstance::setClass
void setClass(const std::string &className, float probability, const Ice::Current &=Ice::emptyCurrent) override
Set the class attribute of the ObjectInstance.
Definition: ObjectInstance.cpp:219
memoryx::ObjectInstance::getLocalizationTimestamp
IceUtil::Time getLocalizationTimestamp() const
Definition: ObjectInstance.cpp:130
memoryx::AbstractMotionModel
Definition: AbstractMotionModel.h:39
timestamp
std::string timestamp()
Definition: CartographerAdapter.cpp:85
memoryx::ObjectInstance::clearClasses
void clearClasses(const Ice::Current &=Ice::emptyCurrent) override
Clear class membership.
Definition: ObjectInstance.cpp:247
memoryx::ObjectInstance::motionModel
AbstractMotionModelPtr motionModel
Definition: ObjectInstance.h:220
memoryx::ObjectInstance::setPosition
void setPosition(const armarx::FramedPositionBasePtr &position, const ::Ice::Current &=Ice::emptyCurrent) override
Set position of the instance.
Definition: ObjectInstance.cpp:93
memoryx::ObjectInstance::getMostProbableClass
::std::string getMostProbableClass(const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve the class with highest membership probability.
Definition: ObjectInstance.cpp:257
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:681
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
memoryx::ObjectInstance::getPose
armarx::FramedPosePtr getPose() const
Convenience function to get position and orientation attributes at once.
Definition: ObjectInstance.cpp:183
memoryx::ObjectInstance::getOrientationBase
armarx::FramedOrientationBasePtr getOrientationBase(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: ObjectInstance.cpp:339
memoryx::ObjectInstance::getOrientationAttribute
EntityAttributeBasePtr getOrientationAttribute() const
Retrieve attribute which holds instance position.
Definition: ObjectInstance.cpp:166
Entity.h
memoryx::ObjectInstance::setExistenceCertainty
void setExistenceCertainty(float existenceCertainty, const ::Ice::Current &=Ice::emptyCurrent) override
Set existence certainty for this instance.
Definition: ObjectInstance.cpp:75
memoryx::ObjectInstance::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: ObjectInstance.cpp:302
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:916
memoryx::ObjectInstance::clone
ObjectInstancePtr clone(const Ice::Current &c=Ice::emptyCurrent) const
Definition: ObjectInstance.cpp:307
armarx::GenericFactory
Definition: FactoryCollectionBase.h:51
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:37
memoryx::ObjectInstance::getPositionBase
armarx::FramedPositionBasePtr getPositionBase(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: ObjectInstance.cpp:334
memoryx::Entity
Definition: Entity.h:246
Variant.h
memoryx::ObjectInstance::setOrientation
void setOrientation(const armarx::FramedOrientationBasePtr &orientation, const ::Ice::Current &=Ice::emptyCurrent) override
Set orientation of the instance.
Definition: ObjectInstance.cpp:178
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
memoryx::ObjectInstance::getClassProbability
float getClassProbability(const ::std::string &className, const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve membership probability for a given class.
Definition: ObjectInstance.cpp:273