-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GraphicsMagick API and use it to implement map_saver, map_loader Removes dependency on SDL, creates installation dependency on libgraphicsmagick++; apt package libgraphicsmagick++1-dev Allows saving in trinary, raw, or scale mode. Added configurable image format pgm, png, etc. Add warning when using scale mode with opaque format. Remove SDL from map server Extract repeated MapMode to shared enum class Switch writing YAML to same library that reads it (yaml-cpp) Add --help alias to map saver -h Extract map yaml loading to its own function, with better error messages. Also fixed crash due to misuse of std::string constructor.
- Loading branch information
Showing
13 changed files
with
682 additions
and
437 deletions.
There are no files selected for viewing
This file contains 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 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,34 @@ | ||
# Copyright 2019 Rover Robotics | ||
# | ||
# 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. | ||
|
||
# CMake script for finding Magick++, the C++ interface for the | ||
# GraphicsMagick library | ||
# | ||
# Output variables: | ||
# GRAPHICSMAGICKCPP_FOUND - system has GraphicsMagick Magick++ | ||
# GRAPHICSMAGICKCPP_INCLUDE_DIRS - include directories for Magick++ | ||
# GRAPHICSMAGICKCPP_LIBRARIES - libraries you need to link to | ||
include(FindPackageHandleStandardArgs) | ||
|
||
find_path(GRAPHICSMAGICKCPP_INCLUDE_DIRS | ||
NAMES "Magick++.h" | ||
PATH_SUFFIXES GraphicsMagick) | ||
|
||
find_library(GRAPHICSMAGICKCPP_LIBRARIES | ||
NAMES "GraphicsMagick++") | ||
|
||
find_package_handle_standard_args( | ||
GRAPHICSMAGICKCPP | ||
GRAPHICSMAGICKCPP__LIBRARIES | ||
GRAPHICSMAGICKCPP_INCLUDE_DIRS) |
This file contains 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,55 @@ | ||
// Copyright 2019 Rover Robotics | ||
// | ||
// 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. | ||
|
||
#ifndef NAV2_MAP_SERVER__MAP_MODE_HPP_ | ||
#define NAV2_MAP_SERVER__MAP_MODE_HPP_ | ||
|
||
#include <string> | ||
#include <vector> | ||
namespace nav2_map_server | ||
{ | ||
/// Describes the relation between image pixel values and map occupancy status (0-100; -1) | ||
/// Lightness refers to the mean of a given pixel's RGB channels on a scale from 0 to 255. | ||
enum class MapMode | ||
{ | ||
/// Together with associated threshold values (occupied and free): | ||
/// lightness >= occupied threshold - Occupied (100) | ||
/// ... (anything in between) - Unknown (-1) | ||
/// lightness <= free threshold - Free (0) | ||
Trinary, | ||
/// Together with associated threshold values (occupied and free): | ||
/// alpha < 1.0 - Unknown (-1) | ||
/// lightness >= occ_th - Occupied (100) | ||
/// ... (linearly interpolate to) | ||
/// lightness <= free_th - Free (0) | ||
Scale, | ||
/// Lightness = 0 - Free (0) | ||
/// ... (linearly interpolate to) | ||
/// Lightness = 100 - Occupied (100) | ||
/// Lightness >= 101 - Unknown | ||
Raw, | ||
}; | ||
|
||
/// Convert a MapMode enum to the name of the map mode | ||
/// @throw std::invalid_argument if the given value is not a defined map mode | ||
/// @return String identifier of the given map mode | ||
const char * map_mode_to_string(MapMode map_mode); | ||
|
||
/// Convert the name of a map mode to a MapMode enum | ||
/// @throw std::invalid_argument if the name does not name a map mode | ||
/// @return map mode corresponding to the string | ||
MapMode map_mode_from_string(std::string map_mode_name); | ||
} // namespace nav2_map_server | ||
|
||
#endif // NAV2_MAP_SERVER__MAP_MODE_HPP_ |
This file contains 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 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 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
Oops, something went wrong.