diff --git a/nav2_costmap_2d/src/costmap_2d.cpp b/nav2_costmap_2d/src/costmap_2d.cpp index bfa29e66e3..0302801297 100644 --- a/nav2_costmap_2d/src/costmap_2d.cpp +++ b/nav2_costmap_2d/src/costmap_2d.cpp @@ -555,9 +555,9 @@ bool Costmap2D::saveMap(std::string file_name) } fprintf(fp, "P2\n%u\n%u\n%u\n", size_x_, size_y_, 0xff); - for (unsigned int it = 0; it < size_y_; iy++) { + for (unsigned int iy = 0; iy < size_y_; iy++) { for (unsigned int ix = 0; ix < size_x_; ix++) { - unsigned char cost = getCost(ix, it); + unsigned char cost = getCost(ix, iy); fprintf(fp, "%d ", cost); } fprintf(fp, "\n");