当前位置: 首页>>代码示例>>C++>>正文


C++ OccupancyGrid::empty方法代码示例

本文整理汇总了C++中OccupancyGrid::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ OccupancyGrid::empty方法的具体用法?C++ OccupancyGrid::empty怎么用?C++ OccupancyGrid::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OccupancyGrid的用法示例。


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

示例1: main

int main(int argc, char** argv) {

  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGB);
  glutInitWindowSize(640, 480);

  if (argc < 2) { usage(1); }

  grid.load(argv[1]);
  if (grid.empty()) { 
    std::cerr << "Error loading grid: " << argv[1] << "\n";
    exit(1);
  }

  glutCreateWindow("Biped plan demo");
  glutDisplayFunc(display);
  glutReshapeFunc(reshape);
  glutKeyboardFunc(keyboard);
  glutMouseFunc(mouse);
  glutMotionFunc(motion);
  
  glClearColor(1,1,1,1);

  glGenTextures(1, &grid_texture);
  glBindTexture(GL_TEXTURE_2D, grid_texture);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

  std::vector<unsigned char> rgbbuf(grid.nx() * grid.ny() * 4);
  int offs = 0;
  for (size_t y=0; y<grid.ny(); ++y) {
    for (size_t x=0; x<grid.nx(); ++x) {
      rgbbuf[offs++] = grid(x,y);
      rgbbuf[offs++] = grid(x,y);
      rgbbuf[offs++] = grid(x,y);
      rgbbuf[offs++] = 255;
    }
  }
    
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
               grid.nx(), grid.ny(), 0, GL_RGBA,
               GL_UNSIGNED_BYTE, &(rgbbuf[0]));

  quadric = gluNewQuadric();

  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

  glutMainLoop();

  return 0;

}
开发者ID:jacquelinekay,项目名称:biped-footstep-planner,代码行数:52,代码来源:bipedDemo.cpp

示例2: main

int main(int argc, char** argv) {

    std::string inputfile;
    float radius;
    float initx, inity, initTheta, goalx, goaly, goalr, goalTheta;
    int depth;
    bool heuristic;
    float inflate;

    goalTheta = 0;

    parseArgs(argc, argv, inputfile, radius, initx, inity, initTheta, goalx, goaly, goalr, goalTheta, depth, heuristic, inflate);

    // Load grid
    OccupancyGrid grid;
    grid.load(inputfile);

    if (grid.empty()) {
        std::cerr << "error loading grid!\n";
        return 1;
    }

    // expand obstacles
    if (radius > 0) {
        OccupancyGrid tmp;
        expandObstacles(grid, radius, tmp, false);
        grid = tmp;
    }

    // Run search
    DubinSearch helper;
    GridChecker* checker = new GridChecker(&grid);
    Dubin* goal = helper.search(initx, inity, initTheta, goalx, goaly, goalr, goalTheta, checker, depth, heuristic, inflate);
    if (goal==NULL) {
        cout<<"Search failed"<<endl;
        std::string filename = "DebugImage.svg";
        helper.makeSVG(NULL,filename,grid,goalx,goaly,goalr);

        return -1;
    }
    else {
        cout<<"Search successful after "<<helper.getCount()<<" expansions"<<endl;
        std::string filename = "DebugImage.svg";
        helper.makeSVG(goal,filename,grid,goalx,goaly,goalr);
    }

    return 0;
}
开发者ID:swatbotics,项目名称:e91-final,代码行数:48,代码来源:main.cpp


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