Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #3078, fix image path in YAML #3082

Merged
merged 5 commits into from
Jul 21, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions nav2_map_server/src/map_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
nakai-omer marked this conversation as resolved.
Show resolved Hide resolved
* * 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.
Expand Down 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("/\\");
nakai-omer marked this conversation as resolved.
Show resolved Hide resolved
std::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