From 3628c012feaad8796e58a551fe065d074762e422 Mon Sep 17 00:00:00 2001 From: nakai-omer <108797279+nakai-omer@users.noreply.github.com> Date: Wed, 20 Jul 2022 18:05:31 +0300 Subject: [PATCH 1/5] Fix for #3078, fix image path in YAML --- nav2_map_server/src/map_io.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nav2_map_server/src/map_io.cpp b/nav2_map_server/src/map_io.cpp index b26b09be38b..99b63f1c5e5 100644 --- a/nav2_map_server/src/map_io.cpp +++ b/nav2_map_server/src/map_io.cpp @@ -504,11 +504,14 @@ void tryWriteMapToFile( tf2::Matrix3x3 mat(tf2::Quaternion(orientation.x, orientation.y, orientation.z, orientation.w)); double yaw, pitch, roll; mat.getEulerYPR(yaw, pitch, roll); + + int file_name_index = mapdatafile.find_last_of("/\\"); + string image_name = mapdatafile.substr(file_name_index + 1); YAML::Emitter e; e << YAML::Precision(3); e << YAML::BeginMap; - e << YAML::Key << "image" << YAML::Value << mapdatafile; + e << YAML::Key << "image" << YAML::Value << image_name; e << YAML::Key << "mode" << YAML::Value << map_mode_to_string(save_parameters.mode); e << YAML::Key << "resolution" << YAML::Value << map.info.resolution; e << YAML::Key << "origin" << YAML::Flow << YAML::BeginSeq << map.info.origin.position.x << From 000b462d2db64e200574f83a4c039386ab3af7b2 Mon Sep 17 00:00:00 2001 From: nakai-omer <108797279+nakai-omer@users.noreply.github.com> Date: Wed, 20 Jul 2022 18:20:25 +0300 Subject: [PATCH 2/5] Update map_io.cpp --- nav2_map_server/src/map_io.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nav2_map_server/src/map_io.cpp b/nav2_map_server/src/map_io.cpp index 99b63f1c5e5..760d5bafca4 100644 --- a/nav2_map_server/src/map_io.cpp +++ b/nav2_map_server/src/map_io.cpp @@ -148,7 +148,7 @@ LoadParameters loadMapYaml(const std::string & yaml_filename) load_parameters.mode = MapMode::Trinary; } else { load_parameters.mode = map_mode_from_string(map_mode_node.as()); - } + }f try { load_parameters.negate = yaml_get_value(doc, "negate"); @@ -506,7 +506,7 @@ void tryWriteMapToFile( mat.getEulerYPR(yaw, pitch, roll); int file_name_index = mapdatafile.find_last_of("/\\"); - string image_name = mapdatafile.substr(file_name_index + 1); + std::string image_name = mapdatafile.substr(file_name_index + 1); YAML::Emitter e; e << YAML::Precision(3); From bcff237971ec898f4c0c48f4a00850bb685472d8 Mon Sep 17 00:00:00 2001 From: nakai-omer <108797279+nakai-omer@users.noreply.github.com> Date: Wed, 20 Jul 2022 18:21:13 +0300 Subject: [PATCH 3/5] Update map_io.cpp --- nav2_map_server/src/map_io.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nav2_map_server/src/map_io.cpp b/nav2_map_server/src/map_io.cpp index 760d5bafca4..52beac88ecc 100644 --- a/nav2_map_server/src/map_io.cpp +++ b/nav2_map_server/src/map_io.cpp @@ -8,7 +8,7 @@ * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer.151 * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -148,7 +148,7 @@ LoadParameters loadMapYaml(const std::string & yaml_filename) load_parameters.mode = MapMode::Trinary; } else { load_parameters.mode = map_mode_from_string(map_mode_node.as()); - }f + } try { load_parameters.negate = yaml_get_value(doc, "negate"); From 8e38e8e97918daf67cf8272e3386ef945779b230 Mon Sep 17 00:00:00 2001 From: nakai-omer <108797279+nakai-omer@users.noreply.github.com> Date: Thu, 21 Jul 2022 15:22:58 +0300 Subject: [PATCH 4/5] Update map_io.cpp --- nav2_map_server/src/map_io.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nav2_map_server/src/map_io.cpp b/nav2_map_server/src/map_io.cpp index 52beac88ecc..66031e62a25 100644 --- a/nav2_map_server/src/map_io.cpp +++ b/nav2_map_server/src/map_io.cpp @@ -8,7 +8,7 @@ * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer.151 + * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. From eb63b24e07f34ece72ed7a717d9814fe34753a6e Mon Sep 17 00:00:00 2001 From: nakai-omer <108797279+nakai-omer@users.noreply.github.com> Date: Thu, 21 Jul 2022 15:24:17 +0300 Subject: [PATCH 5/5] Update map_io.cpp --- nav2_map_server/src/map_io.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nav2_map_server/src/map_io.cpp b/nav2_map_server/src/map_io.cpp index 66031e62a25..050fc63d66e 100644 --- a/nav2_map_server/src/map_io.cpp +++ b/nav2_map_server/src/map_io.cpp @@ -505,7 +505,7 @@ void tryWriteMapToFile( double yaw, pitch, roll; mat.getEulerYPR(yaw, pitch, roll); - int file_name_index = mapdatafile.find_last_of("/\\"); + const int file_name_index = mapdatafile.find_last_of("/\\"); std::string image_name = mapdatafile.substr(file_name_index + 1); YAML::Emitter e;