本文整理汇总了C++中Agent::asBottle方法的典型用法代码示例。如果您正苦于以下问题:C++ Agent::asBottle方法的具体用法?C++ Agent::asBottle怎么用?C++ Agent::asBottle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::asBottle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateModule
bool PasarModule::updateModule()
{
opc->update();
list<Entity*> entities = opc->EntitiesCache();
presentObjects.clear();
presentLastSpeed = presentCurrentSpeed;
presentCurrentSpeed.clear();
for(list<Entity*>::iterator it=entities.begin(); it !=entities.end(); it++)
{
if ((*it)->name() != "icub")
{
//!!! ONLY RT_OBJECT and AGENTS ARE TRACKED !!!
if ( ( (*it)->isType(EFAA_OPC_ENTITY_OBJECT) ))
{
if ((*it)->isType(EFAA_OPC_ENTITY_RTOBJECT))
{
RTObject * rto = opc->addRTObject((*it)->name());
presentObjects[ (*it)->name() ].o.fromBottle( rto->asBottle() );
presentObjects[ (*it)->name() ].o.m_saliency = rto->m_saliency;
presentObjects[ (*it)->name() ].speed = 0.0;
presentObjects[ (*it)->name() ].acceleration = 0.0;
presentObjects[ (*it)->name() ].restingSteps = 0;
}
if ((*it)->isType(EFAA_OPC_ENTITY_AGENT))
{
Agent *ag = opc->addAgent((*it)->name());
presentObjects[ (*it)->name() ].o.fromBottle( ag->asBottle() );
presentObjects[ (*it)->name() ].o.m_saliency = ag->m_saliency;
presentObjects[ (*it)->name() ].speed = 0.0;
presentObjects[ (*it)->name() ].acceleration = 0.0;
presentObjects[ (*it)->name() ].restingSteps = 0;
}/*
presentObjects[ (*it)->name() ].o.fromBottle( (*it)->asBottle() );
presentObjects[ (*it)->name() ].o.m_saliency = 0.0;
presentObjects[ (*it)->name() ].speed = 0.0;
presentObjects[ (*it)->name() ].acceleration = 0.0;
presentObjects[ (*it)->name() ].restingSteps = 0;*/
}
}
//if (presentObjects[ (*it)->name() ].o.m_saliency > 0)
// cout<<" salience : " << (*it)->name() << " " << presentObjects[ (*it)->name() ].o.m_saliency << endl;
}
if (presentObjectsLastStep.size() > 0)
{
//Retrieve the bottom-up saliency (vision based) and attribute it to objects
//saliencyBottomUp();
//Compute top down saliency (concept based)
saliencyTopDown();
//Normalize
//saliencyNormalize();
//Inhinbition of return
// if(trackedObject!= "")
// presentObjects[trackedObject].o.m_saliency = max(0.0, presentObjects[trackedObject].o.m_saliency - pTopDownInhibitionReturn);
//Leaky integrate
saliencyLeakyIntegration();
//Get the most salient object and track it
map< string, ObjectModel >::iterator mostSalientObject = presentObjects.begin();
for(map< string, ObjectModel >::iterator it=presentObjects.begin(); it!=presentObjects.end();it++)
{
// cout<<"Saliency ("<<it->second.o.name()<<") = "<<it->second.o.m_saliency<<endl;
if (it->second.o.m_saliency > mostSalientObject->second.o.m_saliency)
mostSalientObject = it;
}
trackedObject = mostSalientObject->first;
if (presentObjects[trackedObject].o.m_saliency >0.0)
{
cout << "Tracking : " << trackedObject << " Salience : " << presentObjects[trackedObject].o.m_saliency << endl;
}
if (isControllingMotors && isFixationPointSafe(presentObjects[trackedObject].o.m_ego_position))
igaze->lookAtFixationPoint(presentObjects[trackedObject].o.m_ego_position);
//Prepare the output img
ImageOf<PixelRgb> &img=saliencyOutput.prepare();
img.copy(imageOut);
saliencyOutput.write();
//Update the OPC values
for(list<Entity*>::iterator it=entities.begin(); it !=entities.end(); it++)
{
if (presentObjects.find( (*it)->name()) != presentObjects.end())
{
((Object*)(*it))->m_saliency = presentObjects[(*it)->name()].o.m_saliency;
}
}
//.........这里部分代码省略.........
示例2: updateModule
bool PasarModule::updateModule()
{
opc->update();
entities = opc->EntitiesCache();
presentObjects.clear();
presentLastSpeed = presentCurrentSpeed;
presentCurrentSpeed.clear();
for (list<Entity*>::iterator it = entities.begin(); it != entities.end(); it++)
{
if ((*it)->name() != "icub")
{
//!!! ONLY OBJECTS, RT_OBJECT and AGENTS ARE TRACKED !!!
if ((*it)->isType(EFAA_OPC_ENTITY_RTOBJECT) || (*it)->isType(EFAA_OPC_ENTITY_AGENT) || (*it)->isType(EFAA_OPC_ENTITY_OBJECT))
{
if ((*it)->isType(EFAA_OPC_ENTITY_RTOBJECT))
{
RTObject * rto = dynamic_cast<RTObject*>(*it);
presentObjects[(*it)->name()].o.fromBottle(rto->asBottle());
presentObjects[(*it)->name()].o.m_saliency = rto->m_saliency;
}
if ((*it)->isType(EFAA_OPC_ENTITY_OBJECT))
{
Object * ob = dynamic_cast<Object*>(*it);
presentObjects[(*it)->name()].o.fromBottle(ob->asBottle());
presentObjects[(*it)->name()].o.m_saliency = ob->m_saliency;
}
if ((*it)->isType(EFAA_OPC_ENTITY_AGENT))
{
Agent *ag = dynamic_cast<Agent*>(*it);
presentObjects[(*it)->name()].o.fromBottle(ag->asBottle());
presentObjects[(*it)->name()].o.m_saliency = ag->m_saliency;
}
}
}
}
//if (presentObjects[ (*it)->name() ].o.m_saliency > 0)
// cout<<" salience : " << (*it)->name() << " " << presentObjects[ (*it)->name() ].o.m_saliency << endl;
if (presentObjectsLastStep.size() > 0)
{
//Compute top down saliency (concept based)
saliencyTopDown();
if (isPointing) saliencyPointing();
if (isWaving) saliencyWaving();
//Normalize
//saliencyNormalize();
//Inhinbition of return
// if(trackedObject!= "")
// presentObjects[trackedObject].o.m_saliency = max(0.0, presentObjects[trackedObject].o.m_saliency - pTopDownInhibitionReturn);
//Leaky integrate
saliencyLeakyIntegration();
//Get the most salient object and track it
map< string, ObjectModel >::iterator mostSalientObject = presentObjects.begin();
for (map< string, ObjectModel >::iterator it = presentObjects.begin(); it != presentObjects.end(); it++)
{
// cout<<"Saliency ("<<it->second.o.name()<<") = "<<it->second.o.m_saliency<<endl;
if (it->second.o.m_saliency > mostSalientObject->second.o.m_saliency)
mostSalientObject = it;
}
trackedObject = mostSalientObject->first;
if (presentObjects[trackedObject].o.m_saliency > 0.0)
{
cout << "Tracking : " << trackedObject << " Salience : " << presentObjects[trackedObject].o.m_saliency << endl;
}
//Update the OPC values
for (list<Entity*>::iterator it = entities.begin(); it != entities.end(); it++)
{
if (presentObjects.find((*it)->name()) != presentObjects.end())
{
(dynamic_cast<Object*>(*it))->m_saliency = presentObjects[(*it)->name()].o.m_saliency;
}
}
opc->commit();
}
presentObjectsLastStep = presentObjects;
return true;
}