-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Costmap Filters #1882
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 32 commits into
ros-navigation:main
from
AlexeyMerzlyakov:costmap_filters
Sep 29, 2020
Merged
Costmap Filters #1882
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
5e02773
Add costmap filters with KeepoutFilter realization
AlexeyMerzlyakov fcde94f
Cover preferred lanes in industries by KeepoutFilter (#1522)
AlexeyMerzlyakov fc2ed26
* Resolve review questions
AlexeyMerzlyakov 6851158
Resolve 2nd review questions
AlexeyMerzlyakov e184945
Code clean-up
AlexeyMerzlyakov c681364
Resolve 3rd review questions (partially)
AlexeyMerzlyakov 9c23476
Fix hidden problems during the shared handling of copstmap_ resource
AlexeyMerzlyakov b355574
Cast into double during the linear conversion of OccupancyGrid data
AlexeyMerzlyakov 9328b59
Add keepout_filter system test
AlexeyMerzlyakov 938a93e
Add error message when base or multiplier is not set in ConstmapFilte…
AlexeyMerzlyakov fb5fe13
Add comment to dummy info publisher launch-file
AlexeyMerzlyakov c711166
Add costmap_conversion unit test
AlexeyMerzlyakov 879e714
Add declareParameter() unit test
AlexeyMerzlyakov 6cc1130
Add keepout zone entering check in FiltersTester
AlexeyMerzlyakov 4668c98
Fix upper window boundary calculation in KeepoutFilter
AlexeyMerzlyakov 7bf7645
Correct mutex header in costmap_filters
AlexeyMerzlyakov eee3635
Added KeepoutFilter::isActive() method for filter readiness check
AlexeyMerzlyakov 7e1ecf1
Add KeepoutFilter unit test
AlexeyMerzlyakov 12ed8fc
Correct the code to consider node_ as a weak pointer
AlexeyMerzlyakov 04169b3
Enhance KeepoutFilter unit test coverage by adding different surfaces
AlexeyMerzlyakov 610e118
Made CostmapFilters and minor documentation updates
AlexeyMerzlyakov 690b50b
Fixed typo
AlexeyMerzlyakov 1dd6fac
Move CostmapFilterInfo publisher to Map Server
AlexeyMerzlyakov 1a317ff
Add costmap_filter_info.launch.py into tb3_simulation_launch.py
AlexeyMerzlyakov af5214d
Remove hard-coded bar areas from test_keepout_filter
AlexeyMerzlyakov a55ce93
Add CostmapFilters HLD
AlexeyMerzlyakov d04e05b
Fix doc after review
AlexeyMerzlyakov da0fcda
Fix mask parameter initialization in bringup_launch.py
AlexeyMerzlyakov 49d9292
Improve tests and remove costmap-filters from nav2_bringup
AlexeyMerzlyakov 87fa61b
Update map mask to filter mask in HLD
AlexeyMerzlyakov 1e3ed29
Small fix-ups
AlexeyMerzlyakov 19b3e11
Fix error message
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
Binary file not shown.
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
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
141 changes: 141 additions & 0 deletions
141
nav2_costmap_2d/include/nav2_costmap_2d/costmap_filters/costmap_filter.hpp
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,141 @@ | ||
| /********************************************************************* | ||
| * | ||
| * Software License Agreement (BSD License) | ||
| * | ||
| * Copyright (c) 2020 Samsung Research Russia | ||
| * All rights reserved. | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * 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. | ||
| * * 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. | ||
| * * Neither the name of the <ORGANIZATION> nor the names of its | ||
| * contributors may be used to endorse or promote products derived | ||
| * from this software without specific prior written permission. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
| * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| * POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * Author: Alexey Merzlyakov | ||
| *********************************************************************/ | ||
|
|
||
| #ifndef NAV2_COSTMAP_2D__COSTMAP_FILTER_HPP_ | ||
| #define NAV2_COSTMAP_2D__COSTMAP_FILTER_HPP_ | ||
|
|
||
| #include <string> | ||
| #include <mutex> | ||
|
|
||
| #include "geometry_msgs/msg/pose2_d.hpp" | ||
| #include "nav2_costmap_2d/layer.hpp" | ||
|
|
||
| namespace nav2_costmap_2d | ||
| { | ||
|
|
||
| static constexpr double BASE_DEFAULT = 0.0; | ||
| static constexpr double MULTIPLIER_DEFAULT = 1.0; | ||
|
|
||
| /** | ||
| * @brief: CostmapFilter basic class. It is inherited from Layer in order to avoid | ||
| * hidden problems when the shared handling of costmap_ resource (PR #1936) | ||
| */ | ||
| class CostmapFilter : public Layer | ||
| { | ||
| public: | ||
| CostmapFilter(); | ||
| ~CostmapFilter(); | ||
|
|
||
| /** | ||
| * @brief: Provide a typedef to ease future code maintenance | ||
| */ | ||
| typedef std::recursive_mutex mutex_t; | ||
| /** | ||
| * @brief: returns pointer to a mutex | ||
| */ | ||
| mutex_t * getMutex() | ||
| { | ||
| return access_; | ||
| } | ||
|
|
||
| /** Layer API **/ | ||
| virtual void onInitialize() final; | ||
| virtual void updateBounds( | ||
|
SteveMacenski marked this conversation as resolved.
|
||
| double robot_x, double robot_y, double robot_yaw, | ||
| double * min_x, double * min_y, double * max_x, double * max_y) final; | ||
| virtual void updateCosts( | ||
| nav2_costmap_2d::Costmap2D & master_grid, | ||
| int min_i, int min_j, int max_i, int max_j) final; | ||
|
|
||
| virtual void activate() final; | ||
| virtual void deactivate() final; | ||
| virtual void reset() final; | ||
|
|
||
| /** CostmapFilter API **/ | ||
| /** | ||
| * @brief: Initializes costmap filter. Creates subscriptions to filter-related topics | ||
| * @param: Name of costmap filter info topic | ||
| */ | ||
| virtual void initializeFilter( | ||
| const std::string & filter_info_topic) = 0; | ||
|
|
||
| /** | ||
| * @brief: An algorithm for how to use that map's information. Fills the Costmap2D with | ||
| * calculated data and makes an action based on processed data | ||
| * @param: Reference to a master costmap2d | ||
| * @param: Low window map boundary OX | ||
| * @param: Low window map boundary OY | ||
| * @param: High window map boundary OX | ||
| * @param: High window map boundary OY | ||
| * @param: Robot 2D-pose | ||
| */ | ||
| virtual void process( | ||
| nav2_costmap_2d::Costmap2D & master_grid, | ||
| int min_i, int min_j, int max_i, int max_j, | ||
| const geometry_msgs::msg::Pose2D & pose) = 0; | ||
|
|
||
| /** | ||
| * @brief: Resets costmap filter. Stops all subscriptions | ||
| */ | ||
| virtual void resetFilter() = 0; | ||
|
|
||
| protected: | ||
| /** | ||
| * @brief: Name of costmap filter info topic | ||
| */ | ||
| std::string filter_info_topic_; | ||
|
|
||
| /** | ||
| * @brief: Name of filter mask topic | ||
| */ | ||
| std::string mask_topic_; | ||
|
|
||
| private: | ||
| /** | ||
| * @brief: Latest robot position | ||
| */ | ||
| geometry_msgs::msg::Pose2D latest_pose_; | ||
|
|
||
| /** | ||
| * @brief: Mutex for locking filter's resources | ||
| */ | ||
| mutex_t * access_; | ||
| }; | ||
|
|
||
| } // namespace nav2_costmap_2d | ||
|
|
||
| #endif // NAV2_COSTMAP_2D__COSTMAP_FILTER_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.