本文整理汇总了C++中CActionCollectionPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ CActionCollectionPtr::get方法的具体用法?C++ CActionCollectionPtr::get怎么用?C++ CActionCollectionPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActionCollectionPtr
的用法示例。
在下文中一共展示了CActionCollectionPtr::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
/*---------------------------------------------------------------
process
---------------------------------------------------------------*/
void CDetectorDoorCrossing::process(
CActionRobotMovement2D &in_poseChange,
CSensoryFrame &in_sf,
TDoorCrossingOutParams &out_estimation
)
{
// Variables for generic use:
size_t i;
out_estimation.cumulativeTurning = 0;
MRPT_START
// 1) Add new pair to the list:
// -----------------------------------------
lastObs.addAction( in_poseChange );
lastObs.addObservations( in_sf );
// 2) Remove oldest pair:
// -----------------------------------------
ASSERT_( options.windowSize > 1 );
ASSERT_( (lastObs.size() % 2) == 0 ); // Assure even size
while (lastObs.size()>options.windowSize*2)
{
lastObs.remove(0);
lastObs.remove(0);
}
if ( lastObs.size() < options.windowSize * 2 )
{
// Not enought old data yet:
out_estimation.enoughtInformation = false;
return;
}
// 3) Build an occupancy grid map with observations
// -------------------------------------------------
CPose2D p, pos;
TSetOfMetricMapInitializers mapInitializer;
{
CSimplePointsMap::TMapDefinition def;
mapInitializer.push_back( def );
}
{
COccupancyGridMap2D::TMapDefinition def;
def.resolution = options.gridResolution;
mapInitializer.push_back( def );
}
CMultiMetricMap auxMap( &mapInitializer );
for (i=0;i<options.windowSize;i++)
{
CActionCollectionPtr acts = lastObs.getAsAction( i*2+0 );
CActionPtr act = acts->get(0);
ASSERT_( act->GetRuntimeClass()->derivedFrom( CLASS_ID( CActionRobotMovement2D ) ) )
CActionRobotMovement2DPtr action = CActionRobotMovement2DPtr( act );
action->poseChange->getMean(pos);
out_estimation.cumulativeTurning+= fabs(pos.phi());
// Get the cumulative pose for the current observation:
p = p + pos;
// Add SF to the grid map:
CSensoryFramePtr sf = lastObs.getAsObservations( i*2+1 );
CPose3D pose3D(p);
sf->insertObservationsInto( &auxMap, &pose3D );
}
// 4) Compute the information differece between this
// "map patch" and the previous one:
// -------------------------------------------------------
auxMap.m_gridMaps[0]->computeEntropy( entropy );
if (!lastEntropyValid)
{
out_estimation.enoughtInformation = false;
}
else
{
// 5) Fill output data
// ---------------------------------
out_estimation.enoughtInformation = true;
out_estimation.informationGain = entropy.I - lastEntropy.I;
out_estimation.pointsMap.copyFrom( *auxMap.m_pointsMaps[0] );
}
// For next iterations:
//.........这里部分代码省略.........