-
Notifications
You must be signed in to change notification settings - Fork 1.7k
map_server refactor and cleanup #1624
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
Merged
SteveMacenski
merged 5 commits into
ros-navigation:master
from
AlexeyMerzlyakov:map_server_cleanup
Apr 23, 2020
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
84cff7d
[WIP] map_server refactor and cleanup
AlexeyMerzlyakov 8256121
Fixes for cpplint, uncrustify, flake8 and test_occ_grid_node failures
AlexeyMerzlyakov 89ece96
Fixing review comments
AlexeyMerzlyakov 0db44c7
Increase test coverage
AlexeyMerzlyakov 85cba42
Fixing review comments
AlexeyMerzlyakov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| /* OccupancyGrid map input-output library */ | ||
|
|
||
| #ifndef NAV2_MAP_SERVER__MAP_IO_HPP_ | ||
| #define NAV2_MAP_SERVER__MAP_IO_HPP_ | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include "nav2_map_server/map_mode.hpp" | ||
| #include "nav_msgs/msg/occupancy_grid.hpp" | ||
|
|
||
| /* Map input part */ | ||
|
|
||
| namespace nav2_map_server | ||
| { | ||
|
|
||
| struct LoadParameters | ||
| { | ||
| std::string image_file_name; | ||
| double resolution{0}; | ||
| std::vector<double> origin{0, 0, 0}; | ||
| double free_thresh; | ||
| double occupied_thresh; | ||
| MapMode mode; | ||
| bool negate; | ||
| }; | ||
|
|
||
| typedef enum | ||
| { | ||
| LOAD_MAP_SUCCESS, | ||
| MAP_DOES_NOT_EXIST, | ||
| INVALID_MAP_METADATA, | ||
| INVALID_MAP_DATA | ||
| } LOAD_MAP_STATUS; | ||
|
|
||
| /** | ||
| * @brief Load and parse the given YAML file | ||
| * @param yaml_filename Name of the map file passed though parameter | ||
| * @return Map loading parameters obtained from YAML file | ||
| * @throw YAML::Exception | ||
| */ | ||
| LoadParameters loadMapYaml(const std::string & yaml_filename); | ||
|
|
||
| /** | ||
| * @brief Load the image from map file and generate an OccupancyGrid | ||
| * @param load_parameters Parameters of loading map | ||
| * @param map Output loaded map | ||
| * @throw std::exception | ||
| */ | ||
| void loadMapFromFile( | ||
| const LoadParameters & load_parameters, | ||
| nav_msgs::msg::OccupancyGrid & map); | ||
|
|
||
| /** | ||
| * @brief Load the map YAML, image from map file and | ||
| * generate an OccupancyGrid | ||
| * @param yaml_file Name of input YAML file | ||
| * @param map Output loaded map | ||
| * @return status of map loaded | ||
| */ | ||
| LOAD_MAP_STATUS loadMapFromYaml( | ||
| const std::string & yaml_file, | ||
| nav_msgs::msg::OccupancyGrid & map); | ||
|
|
||
|
|
||
| /* Map output part */ | ||
|
|
||
| struct SaveParameters | ||
| { | ||
| std::string map_file_name{""}; | ||
| std::string image_format{""}; | ||
| double free_thresh{0.0}; | ||
| double occupied_thresh{0.0}; | ||
| MapMode mode{MapMode::Trinary}; | ||
| }; | ||
|
|
||
| /** | ||
| * @brief Write OccupancyGrid map to file | ||
| * @param map OccupancyGrid map data | ||
| * @param save_parameters Map saving parameters. | ||
| * @return true or false | ||
| */ | ||
| bool saveMapToFile( | ||
| const nav_msgs::msg::OccupancyGrid & map, | ||
| const SaveParameters & save_parameters); | ||
|
|
||
| } // namespace nav2_map_server | ||
|
|
||
| #endif // NAV2_MAP_SERVER__MAP_IO_HPP_ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.