forked from ros-navigation/navigation2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add collision checking for footprint without using subscibers. (ros-n…
…avigation#1703) * Add collision checking for footprint without using subscibers. * Address reviewer's comments - Changed the design if the footprint collision checkers - And propogate the changes to dependencies such as nav2_recoveries and nav2_core * Remove some extra headers * Remove debuging code * Add requested test * Change weird test names. * Remove unorientFootprint function dependency * Imporve tests * Fix commented Varible
- Loading branch information
1 parent
4918067
commit 21e2fec
Showing
14 changed files
with
382 additions
and
109 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
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
53 changes: 53 additions & 0 deletions
53
nav2_costmap_2d/include/nav2_costmap_2d/footprint_collision_checker.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (c) 2019 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. | ||
// | ||
// Modified by: Shivang Patel (shivaang14@gmail.com) | ||
|
||
#ifndef NAV2_COSTMAP_2D__FOOTPRINT_COLLISION_CHECKER_HPP_ | ||
#define NAV2_COSTMAP_2D__FOOTPRINT_COLLISION_CHECKER_HPP_ | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <memory> | ||
#include <algorithm> | ||
|
||
#include "rclcpp/rclcpp.hpp" | ||
#include "geometry_msgs/msg/pose_stamped.hpp" | ||
#include "geometry_msgs/msg/pose2_d.hpp" | ||
#include "nav2_costmap_2d/costmap_2d.hpp" | ||
#include "nav2_util/robot_utils.hpp" | ||
|
||
namespace nav2_costmap_2d | ||
{ | ||
typedef std::vector<geometry_msgs::msg::Point> Footprint; | ||
|
||
class FootprintCollisionChecker | ||
{ | ||
public: | ||
FootprintCollisionChecker(); | ||
explicit FootprintCollisionChecker(std::shared_ptr<nav2_costmap_2d::Costmap2D> costmap); | ||
double footprintCost(const Footprint footprint); | ||
double footprintCostAtPose(double x, double y, double theta, const Footprint footprint); | ||
double lineCost(int x0, int x1, int y0, int y1) const; | ||
bool worldToMap(double wx, double wy, unsigned int & mx, unsigned int & my); | ||
double pointCost(int x, int y) const; | ||
void setCostmap(std::shared_ptr<nav2_costmap_2d::Costmap2D> costmap); | ||
|
||
private: | ||
std::shared_ptr<nav2_costmap_2d::Costmap2D> costmap_; | ||
}; | ||
|
||
} // namespace nav2_costmap_2d | ||
|
||
#endif // NAV2_COSTMAP_2D__FOOTPRINT_COLLISION_CHECKER_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
Oops, something went wrong.