Skip to content

Commit

Permalink
Fix for ros-navigation#3078, fix image path in YAML
Browse files Browse the repository at this point in the history
  • Loading branch information
nakai-omer authored Jul 20, 2022
1 parent dab4ddc commit 3628c01
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nav2_map_server/src/map_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<
Expand Down

0 comments on commit 3628c01

Please sign in to comment.