MCPcopy Create free account
hub / github.com/RoboMaster/RoboRTS / SaveMap

Method SaveMap

roborts_costmap/src/costmap_2d.cpp:359–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359bool Costmap2D::SaveMap(std::string file_name) {
360 FILE *fp = fopen(file_name.c_str(), "w");
361
362 if (!fp) {
363 return false;
364 }
365 fprintf(fp, "P2\n%u\n%u\n%u\n", size_x_, size_y_, 0xff);
366 for (unsigned int iy = 0; iy < size_y_; iy++) {
367 for (unsigned int ix = 0; ix < size_x_; ix++) {
368 unsigned char cost = GetCost(ix, iy);
369 fprintf(fp, "%d ", cost);
370 }
371 fprintf(fp, "\n");
372 }
373 fclose(fp);
374 return true;
375}
376
377} //namespace roborts_costmap

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected