Go to the documentation of this file.
27 #include <MemoryX/interface/observers/ObjectMemoryObserverInterface.h>
36 ObjectInstance::ObjectInstance(
const std::string& name,
const std::string&
id)
60 ObjectInstanceBase(
source),
99 MultivariateNormalDistributionBasePtr uncertainty = MultivariateNormalDistributionBasePtr::dynamicCast(
getPositionAttribute()->getUncertainty());
135 return timestamp->
toTime();
142 return armarx::DEFAULT_VIEWTARGET_PRIORITY;
155 return MultivariateNormalDistributionBasePtr::dynamicCast(
getPositionAttribute()->getUncertainty());
200 ClassProbabilityMap classes;
203 int numberValues = attr->size();
205 std::pair<std::string, float> element;
207 for (
int v = 0 ;
v < numberValues ;
v++)
209 element.first = attr->getValueAt(
v)->getString();
210 element.second = DiscreteProbabilityBasePtr::dynamicCast(attr->getUncertaintyAt(
v))->getProbability();
212 classes.insert(element);
261 ClassProbabilityMap::const_iterator itMax = classes.end();
263 for (ClassProbabilityMap::const_iterator it = classes.begin(); it != classes.end(); ++it)
264 if (itMax == classes.end() || it->second > itMax->second)
269 return (itMax != classes.end()) ? itMax->first :
"";
274 const Ice::Current&)
const
277 ClassProbabilityMap::const_iterator it = classes.find(className);
279 if (it != classes.end())
292 ARMARX_DEBUG_S <<
"New motion model is being set for " << this->
getName() <<
": " << motionModel->getMotionModelName();
304 return this->
clone();
325 void ObjectInstance::output(std::ostream& stream)
const
336 return armarx::VariantPtr::dynamicCast(
getPositionAttribute()->getValue())->getClass<armarx::FramedPositionBase>();
341 return armarx::VariantPtr::dynamicCast(
getOrientationAttribute()->getValue())->getClass<armarx::FramedOrientationBase>();
344 ObjectInstance::ObjectInstance() {}
bool hasLocalizationTimestamp() const
The Variant class is described here: Variants.
void setLocalizationPriority(Ice::Int priority, const ::Ice::Current &=Ice::emptyCurrent) override
ReaderT::InputType T & ret
armarx::FramedOrientationPtr getOrientation() const
Retrieve orientation of the instance.
void putAttribute(const ::memoryx::EntityAttributeBasePtr &attr, const ::Ice::Current &=Ice::emptyCurrent) override
Store attribute in entity.
::std::string getName(const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve name of this entity.
const VariantTypeId FramedPose
EntityAttributeBasePtr getAttribute(const ::std::string &attrName, const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve attribute from entity.
float getExistenceCertainty(const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve existence certainty for this instance.
EntityAttributeBasePtr getPositionAttribute() const
Retrieve attribute which holds instance position.
void setLocalizationTimestamp(const IceUtil::Time ×tamp)
void setPose(const armarx::FramedPoseBasePtr &newPose)
Convenience function to set position and orientation attributes at once.
void setMotionModel(AbstractMotionModelPtr motionModel)
Set the motion model for this object.
MultivariateNormalDistributionBasePtr getPositionUncertainty(const ::Ice::Current &=Ice::emptyCurrent) const override
Get uncertainty of position estimate.
void output(std::ostream &stream) const
virtual armarx::VariantPtr getAttributeValue(const ::std::string &attrName) const
Retrieve value of an attribute from entity.
ClassProbabilityMap getClasses(const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve classes and associated class membership probability for this instance.
AbstractMotionModelPtr getMotionModel() const
int getLocalizationPriority(const ::Ice::Current &=Ice::emptyCurrent) const override
void addClass(const std::string &className, float probability, const Ice::Current &=Ice::emptyCurrent) override
Adds new class membership to the class attribute.
void setPositionUncertainty(const MultivariateNormalDistributionBasePtr &uncertainty, const ::Ice::Current &=Ice::emptyCurrent) override
Set uncertainty of position estimate.
armarx::FramedPositionPtr getPosition() const
Retrieve position of the instance.
std::mutex attributesMutex
The FramedPosition class.
void setClass(const std::string &className, float probability, const Ice::Current &=Ice::emptyCurrent) override
Set the class attribute of the ObjectInstance.
IceUtil::Time getLocalizationTimestamp() const
void clearClasses(const Ice::Current &=Ice::emptyCurrent) override
Clear class membership.
AbstractMotionModelPtr motionModel
The FramedOrientation class.
void setPosition(const armarx::FramedPositionBasePtr &position, const ::Ice::Current &=Ice::emptyCurrent) override
Set position of the instance.
::std::string getMostProbableClass(const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve the class with highest membership probability.
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
void setId(const ::std::string &id, const ::Ice::Current &=Ice::emptyCurrent) override
Set id of this entity.
armarx::core::time::DateTime Time
armarx::FramedPosePtr getPose() const
Convenience function to get position and orientation attributes at once.
armarx::FramedOrientationBasePtr getOrientationBase(const ::Ice::Current &=Ice::emptyCurrent) const override
double v(double t, double v0, double a0, double j)
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
EntityAttributeBasePtr getOrientationAttribute() const
Retrieve attribute which holds instance position.
std::shared_mutex entityMutex
bool hasAttribute(const ::std::string &attrName, const ::Ice::Current &=Ice::emptyCurrent) const override
Check whether this entity has an attribute with the given name.
void setExistenceCertainty(float existenceCertainty, const ::Ice::Current &=Ice::emptyCurrent) override
Set existence certainty for this instance.
Ice::ObjectPtr ice_clone() const override
Attribute of MemoryX entities.
ObjectInstancePtr clone(const Ice::Current &c=Ice::emptyCurrent) const
std::shared_ptr< Object > ObjectPtr
armarx::FramedPositionBasePtr getPositionBase(const ::Ice::Current &=Ice::emptyCurrent) const override
const armarx::VariantTypeId DiscreteProbability
void setOrientation(const armarx::FramedOrientationBasePtr &orientation, const ::Ice::Current &=Ice::emptyCurrent) override
Set orientation of the instance.
void setName(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
Set name of this entity.
std::recursive_mutex wrappersMutex
This file offers overloads of toIce() and fromIce() functions for STL container types.
float getClassProbability(const ::std::string &className, const ::Ice::Current &=Ice::emptyCurrent) const override
Retrieve membership probability for a given class.