• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ optimizablegraph::Vertex类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中optimizablegraph::Vertex的典型用法代码示例。如果您正苦于以下问题:C++ Vertex类的具体用法?C++ Vertex怎么用?C++ Vertex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Vertex类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: push

void OptimizableGraph::push()
{
  for (OptimizableGraph::VertexIDMap::iterator it=_vertices.begin(); it!=_vertices.end(); ++it) {
    OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(it->second);
    v->push();
  }
}
开发者ID:Crusty82,项目名称:g2o_tutorial,代码行数:7,代码来源:optimizable_graph.cpp


示例2: discardTop

void OptimizableGraph::discardTop(HyperGraph::VertexSet& vset)
{
  for (HyperGraph::VertexSet::iterator it=vset.begin(); it!=vset.end(); ++it) {
    OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(*it);
    v->discardTop();
  }
}
开发者ID:Crusty82,项目名称:g2o_tutorial,代码行数:7,代码来源:optimizable_graph.cpp


示例3: push

void OptimizableGraph::push(HyperGraph::VertexSet& vset) {
  for (HyperGraph::VertexSet::iterator it = vset.begin(); it != vset.end();
      it++) {
    OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(*it);
    v->push();
  }
}
开发者ID:AIRLab-POLIMI,项目名称:ROAMFREE,代码行数:7,代码来源:optimizable_graph.cpp


示例4:

  bool SparseOptimizer::buildIndexMapping
     (SparseOptimizer::VertexContainer& vlist)
  {
    if (! vlist.size())
    {
      _ivMap.clear();
      return false;
    }

    _ivMap.resize(vlist.size());
    size_t i = 0;
    // Recorre todos los vertices dandoles un indice.
    // Si el vertice es fijo, su indice sera -1
    // Para los vertices no fijos, les da un indice incremental.
    // Primero se les da a los vertices no marginalizables y luego a los que si.
    // Al final _ivMap contendra todos los vertices no fijos con los vertices
    // no marginalizables en las primeras posiciones de _ivMap
    for (int k=0; k<2; k++)
      for (VertexContainer::iterator it=vlist.begin(); it!=vlist.end(); it++)
      {
         OptimizableGraph::Vertex* v = *it;
         if (! v->fixed())
         {
            if (static_cast<int>(v->marginalized()) == k)
            {
               v->setTempIndex(i);
               _ivMap[i]=v;
               i++;
            }
         }else   v->setTempIndex(-1);
      }

    _ivMap.resize(i);
    return true;
  }
开发者ID:RoboWGT,项目名称:robo_groovy,代码行数:35,代码来源:graph_optimizer_sparse.cpp


示例5: findGauge

  OptimizableGraph::Vertex* SparseOptimizer::findGauge(){
    if (vertices().empty())
      return 0;

    int maxDim=0;
    for (HyperGraph::VertexIDMap::iterator
         it  = vertices().begin();
         it != vertices().end();
         it++)
    {
      OptimizableGraph::Vertex* v =
         static_cast<OptimizableGraph::Vertex*>(it->second);
      maxDim = std::max(maxDim,v->dimension());
    }

    OptimizableGraph::Vertex* rut=0;
    for (HyperGraph::VertexIDMap::iterator
         it  = vertices().begin();
         it != vertices().end();
         it++)
    {
      OptimizableGraph::Vertex* v =
         static_cast<OptimizableGraph::Vertex*>(it->second);
      if (v->dimension()==maxDim)
      {
        rut=v;
        break;
      }
    }
    return rut;
  }
开发者ID:RoboWGT,项目名称:robo_groovy,代码行数:31,代码来源:graph_optimizer_sparse.cpp


示例6: setFixed

  void OptimizableGraph::setFixed(HyperGraph::VertexSet& vset, bool fixed)
{
  for (HyperGraph::VertexSet::iterator it=vset.begin(); it!=vset.end(); ++it) {
    OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(*it);
    v->setFixed(fixed);
  }
}
开发者ID:Crusty82,项目名称:g2o_tutorial,代码行数:7,代码来源:optimizable_graph.cpp


示例7: buildIndexMapping

  bool SparseOptimizer::buildIndexMapping(SparseOptimizer::VertexContainer& vlist){
    if (! vlist.size()){
      _ivMap.clear();
      return false;
    }

    _ivMap.resize(vlist.size());
    size_t i = 0;
    for (int k=0; k<2; k++)
      for (VertexContainer::iterator it=vlist.begin(); it!=vlist.end(); ++it){
      OptimizableGraph::Vertex* v = *it;
      if (! v->fixed()){
        if (static_cast<int>(v->marginalized()) == k){
          v->setHessianIndex(i);
          _ivMap[i]=v;
          i++;
        }
      }
      else {
        v->setHessianIndex(-1);
      }
    }
    _ivMap.resize(i);
    return true;
  }
开发者ID:skarlsson,项目名称:tmp-android,代码行数:25,代码来源:sparse_optimizer.cpp


示例8: discardTop

void OptimizableGraph::discardTop() {
  for (OptimizableGraph::VertexIDMap::iterator it = _vertices.begin();
      it != _vertices.end(); it++) {
    OptimizableGraph::Vertex* v =
        static_cast<OptimizableGraph::Vertex*>(it->second);
    v->discardTop();
  }
}
开发者ID:AIRLab-POLIMI,项目名称:ROAMFREE,代码行数:8,代码来源:optimizable_graph.cpp


示例9: edgeAllVertsSameDim

bool edgeAllVertsSameDim(OptimizableGraph::Edge* e, int dim)
{
  for (size_t i = 0; i < e->vertices().size(); ++i) {
    OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(e->vertices()[i]);
    if (v->dimension() != dim)
      return false;
  }
  return true;
}
开发者ID:2maz,项目名称:g2o,代码行数:9,代码来源:output_helper.cpp


示例10:

bool G2oSlamInterface::fixNode(const std::vector<int>& nodes)
{
  for (size_t i = 0; i < nodes.size(); ++i) {
    OptimizableGraph::Vertex* v = _optimizer->vertex(nodes[i]);
    if (v)
      v->setFixed(true);
  }
  return true;
}
开发者ID:CreativeCimmons,项目名称:ORB-SLAM-Android-app,代码行数:9,代码来源:g2o_slam_interface.cpp


示例11: removeVertex

 bool SparseOptimizer::removeVertex(HyperGraph::Vertex* v)
 {
   OptimizableGraph::Vertex* vv = static_cast<OptimizableGraph::Vertex*>(v);
   if (vv->hessianIndex() >= 0) {
     clearIndexMapping();
     _ivMap.clear();
   }
   return HyperGraph::removeVertex(v);
 }
开发者ID:skarlsson,项目名称:tmp-android,代码行数:9,代码来源:sparse_optimizer.cpp


示例12: assert

void BaseMultiEdge<D, E>::linearizeOplus(JacobianWorkspace& jacobianWorkspace)
{
  for (size_t i = 0; i < _vertices.size(); ++i) {
    OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(_vertices[i]);
    assert(v->dimension() >= 0);
    new (&_jacobianOplus[i]) JacobianType(jacobianWorkspace.workspaceForVertex(i), D, v->dimension());
  }
  linearizeOplus();
}
开发者ID:EricLYang,项目名称:ORB_SLAM2_Android,代码行数:9,代码来源:base_multi_edge.hpp


示例13: pop

  void SparseOptimizer::pop(HyperGraph::VertexSet& vlist)
  {
    for (HyperGraph::VertexSet::iterator it = vlist.begin(); it != vlist.end(); ++it){
      OptimizableGraph::Vertex* v = dynamic_cast<OptimizableGraph::Vertex*> (*it);
      if (v)
	v->pop();
      else
	cerr << "FATAL POP SET" << endl;
    }
  }
开发者ID:RoboWGT,项目名称:robo_groovy,代码行数:10,代码来源:graph_optimizer_sparse.cpp


示例14: update

 void SparseOptimizer::update(double* update)
 {
   // update the graph by calling oplus on the vertices
   for (size_t i=0; i < _ivMap.size(); ++i)
   {
     OptimizableGraph::Vertex* v = _ivMap[i];
     v->oplus(update);
     update += v->dimension();
   }
 }
开发者ID:RoboWGT,项目名称:robo_groovy,代码行数:10,代码来源:graph_optimizer_sparse.cpp


示例15: push

  void SparseOptimizer::push(HyperGraph::VertexSet& vlist)
  {
    for (HyperGraph::VertexSet::iterator it = vlist.begin(); it != vlist.end(); ++it) {
      OptimizableGraph::Vertex* v = dynamic_cast<OptimizableGraph::Vertex*>(*it);
      if (v)
	v->push();
      else 
	cerr << __FUNCTION__ << ": FATAL PUSH SET" << endl;
    }
  }
开发者ID:skarlsson,项目名称:tmp-android,代码行数:10,代码来源:sparse_optimizer.cpp


示例16: operator

 double EstimatePropagatorCostOdometry::operator()(OptimizableGraph::Edge* edge, const OptimizableGraph::VertexSet& from_, OptimizableGraph::Vertex* to_) const
 {
   OptimizableGraph::Edge* e = dynamic_cast<OptimizableGraph::Edge*>(edge);
   OptimizableGraph::Vertex* from = dynamic_cast<OptimizableGraph::Vertex*>(*from_.begin());
   OptimizableGraph::Vertex* to = dynamic_cast<OptimizableGraph::Vertex*>(to_);
   if (std::abs(from->id() - to->id()) != 1) // simple method to identify odometry edges in a pose graph
     return std::numeric_limits<double>::max();
   SparseOptimizer::EdgeContainer::const_iterator it = _graph->findActiveEdge(e);
   if (it == _graph->activeEdges().end()) // it has to be an active edge
     return std::numeric_limits<double>::max();
   return e->initialEstimatePossible(from_, to);
 }
开发者ID:Aand1,项目名称:Autoware,代码行数:12,代码来源:estimate_propagator.cpp


示例17: computeLambdaInit

 double OptimizationAlgorithmLevenberg::computeLambdaInit() const
 {
   if (_userLambdaInit->value() > 0)
     return _userLambdaInit->value();
   double maxDiagonal=0.;
   for (size_t k = 0; k < _optimizer->indexMapping().size(); k++) {
     OptimizableGraph::Vertex* v = _optimizer->indexMapping()[k];
     assert(v);
     int dim = v->dimension();
     for (int j = 0; j < dim; ++j){
       maxDiagonal = std::max(fabs(v->hessian(j,j)),maxDiagonal);
     }
   }
   return _tau*maxDiagonal;
 }
开发者ID:Aerobota,项目名称:c2tam,代码行数:15,代码来源:optimization_algorithm_levenberg.cpp


示例18: addNeighboringVertices

void GraphSLAM::addNeighboringVertices(OptimizableGraph::VertexSet& vset, int gap){
  OptimizableGraph::VertexSet temp = vset;
  for (OptimizableGraph::VertexSet::iterator it = temp.begin(); it!=temp.end(); it++){
    OptimizableGraph::Vertex* vertex = (OptimizableGraph::Vertex*) *it;
    for (int i = 1; i <= gap; i++){
      OptimizableGraph::Vertex *v = (OptimizableGraph::Vertex *) _graph->vertex(vertex->id()+i);
      if (v && v->id() != _lastVertex->id()){
	OptimizableGraph::VertexSet::iterator itv = vset.find(v);
	if (itv == vset.end())
	  vset.insert(v);
	else
	  break;
      }
    }

    for (int i = 1; i <= gap; i++){
      OptimizableGraph::Vertex* v = (OptimizableGraph::Vertex*) _graph->vertex(vertex->id()-i);
      if (v && v->id() != _lastVertex->id()){
	OptimizableGraph::VertexSet::iterator itv = vset.find(v);
	if (itv == vset.end())
	  vset.insert(v);
	else
	  break;
      }
    }
  }
}
开发者ID:droter,项目名称:cg_mrslam,代码行数:27,代码来源:graph_slam.cpp


示例19: prepare

bool MainWindow::prepare()
{
  SparseOptimizer* optimizer = viewer->graph;
  if (_currentOptimizationAlgorithmProperty.requiresMarginalize) {
    cerr << "Marginalizing Landmarks" << endl;
    for (SparseOptimizer::VertexIDMap::const_iterator it = optimizer->vertices().begin(); it != optimizer->vertices().end(); ++it) {
      OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(it->second);
      int vdim = v->dimension();
      v->setMarginalized((vdim == _currentOptimizationAlgorithmProperty.landmarkDim));
    }
  }
  else {
    cerr << "Preparing (no marginalization of Landmarks)" << endl;
    for (SparseOptimizer::VertexIDMap::const_iterator it = optimizer->vertices().begin(); it != optimizer->vertices().end(); ++it) {
      OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(it->second);
      v->setMarginalized(false);
    }
  }
  viewer->graph->initializeOptimization();
  return true;
}
开发者ID:2maz,项目名称:g2o,代码行数:21,代码来源:main_window.cpp


示例20: abort

bool BlockSolver<Traits>::updateStructure(const std::vector<HyperGraph::Vertex*>& vset, const HyperGraph::EdgeSet& edges)
{
  for (std::vector<HyperGraph::Vertex*>::const_iterator vit = vset.begin(); vit != vset.end(); ++vit) {
    OptimizableGraph::Vertex* v = static_cast<OptimizableGraph::Vertex*>(*vit);
    int dim = v->dimension();
    if (! v->marginalized()){
      v->setColInHessian(_sizePoses);
      _sizePoses+=dim;
      _Hpp->rowBlockIndices().push_back(_sizePoses);
      _Hpp->colBlockIndices().push_back(_sizePoses);
      _Hpp->blockCols().push_back(typename SparseBlockMatrix<PoseMatrixType>::IntBlockMap());
      ++_numPoses;
      int ind = v->hessianIndex();
      PoseMatrixType* m = _Hpp->block(ind, ind, true);
      v->mapHessianMemory(m->data());
    } else {
      std::cerr << "updateStructure(): Schur not supported" << std::endl;
      abort();
    }
  }
  resizeVector(_sizePoses + _sizeLandmarks);

  for (HyperGraph::EdgeSet::const_iterator it = edges.begin(); it != edges.end(); ++it) {
    OptimizableGraph::Edge* e = static_cast<OptimizableGraph::Edge*>(*it);

    for (size_t viIdx = 0; viIdx < e->vertices().size(); ++viIdx) {
      OptimizableGraph::Vertex* v1 = (OptimizableGraph::Vertex*) e->vertex(viIdx);
      int ind1 = v1->hessianIndex();
      int indexV1Bak = ind1;
      if (ind1 == -1)
        continue;
      for (size_t vjIdx = viIdx + 1; vjIdx < e->vertices().size(); ++vjIdx) {
        OptimizableGraph::Vertex* v2 = (OptimizableGraph::Vertex*) e->vertex(vjIdx);
        int ind2 = v2->hessianIndex();
        if (ind2 == -1)
          continue;
        ind1 = indexV1Bak;
        bool transposedBlock = ind1 > ind2;
        if (transposedBlock) // make sure, we allocate the upper triangular block
          std::swap(ind1, ind2);

        if (! v1->marginalized() && !v2->marginalized()) {
          PoseMatrixType* m = _Hpp->block(ind1, ind2, true);
          e->mapHessianMemory(m->data(), viIdx, vjIdx, transposedBlock);
        } else { 
          std::cerr << __PRETTY_FUNCTION__ << ": not supported" << std::endl;
        }
      }
    }

  }

  return true;
}
开发者ID:Aerobota,项目名称:g2o,代码行数:54,代码来源:block_solver.hpp



注:本文中的optimizablegraph::Vertex类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ optimizablegraph::VertexSet类代码示例发布时间:2022-05-31
下一篇:
C++ optimizablegraph::Edge类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap