| 357 | } |
| 358 | |
| 359 | bool 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 |
nothing calls this directly
no outgoing calls
no test coverage detected