Nav2 Navigation Stack - humble  humble
ROS 2 Navigation Stack
circle.hpp
1 // Copyright (c) 2022 Samsung R&D Institute Russia
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef NAV2_COLLISION_MONITOR__CIRCLE_HPP_
16 #define NAV2_COLLISION_MONITOR__CIRCLE_HPP_
17 
18 #include <memory>
19 #include <vector>
20 #include <string>
21 
22 #include "nav2_collision_monitor/polygon.hpp"
23 
24 namespace nav2_collision_monitor
25 {
26 
32 class Circle : public Polygon
33 {
34 public:
43  Circle(
44  const nav2_util::LifecycleNode::WeakPtr & node,
45  const std::string & polygon_name,
46  const std::shared_ptr<tf2_ros::Buffer> tf_buffer,
47  const std::string & base_frame_id,
48  const tf2::Duration & transform_tolerance);
52  ~Circle();
53 
59  void getPolygon(std::vector<Point> & poly) const override;
60 
67  int getPointsInside(const std::vector<Point> & points) const override;
68 
69 protected:
77  bool getParameters(std::string & polygon_pub_topic, std::string & footprint_topic) override;
78 
79  // ----- Variables -----
80 
82  double radius_;
85 }; // class Circle
86 
87 } // namespace nav2_collision_monitor
88 
89 #endif // NAV2_COLLISION_MONITOR__CIRCLE_HPP_
Circle shape implementaiton. For STOP/SLOWDOWN model it represents zone around the robot while for AP...
Definition: circle.hpp:33
int getPointsInside(const std::vector< Point > &points) const override
Gets number of points inside circle.
Definition: circle.cpp:61
void getPolygon(std::vector< Point > &poly) const override
Gets polygon points, approximated to the circle. To be used in visualization purposes.
Definition: circle.cpp:42
double radius_squared_
(radius * radius) value. Stored for optimization.
Definition: circle.hpp:84
bool getParameters(std::string &polygon_pub_topic, std::string &footprint_topic) override
Supporting routine obtaining polygon-specific ROS-parameters.
Definition: circle.cpp:73
~Circle()
Circle class destructor.
Definition: circle.cpp:37
double radius_
Radius of the circle.
Definition: circle.hpp:82
Circle(const nav2_util::LifecycleNode::WeakPtr &node, const std::string &polygon_name, const std::shared_ptr< tf2_ros::Buffer > tf_buffer, const std::string &base_frame_id, const tf2::Duration &transform_tolerance)
Circle class constructor.
Definition: circle.cpp:26
Basic polygon shape class. For STOP/SLOWDOWN model it represents zone around the robot while for APPR...
Definition: polygon.hpp:43