EasyNav Plugins
Loading...
Searching...
No Matches
VffController.hpp
Go to the documentation of this file.
1// Copyright 2025 Intelligent Robotics Lab
2//
3// This file is part of the project Easy Navigation (EasyNav in short)
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
18
19#ifndef EASYNAV_CONTROLLER__VFFCONTROLLER_HPP_
20#define EASYNAV_CONTROLLER__VFFCONTROLLER_HPP_
21
22#include "pcl/point_cloud.h"
23
24#include "easynav_core/ControllerMethodBase.hpp"
25
26#include "geometry_msgs/msg/twist_stamped.hpp"
27#include "visualization_msgs/msg/marker.hpp"
28#include "visualization_msgs/msg/marker_array.hpp"
29
30namespace easynav
31{
32
40{
41 std::vector<double> attractive;
42 std::vector<double> repulsive;
43 std::vector<double> result;
44};
45
52typedef enum {RED, GREEN, BLUE} VFFColor;
53
61class VffController : public easynav::ControllerMethodBase
62{
63public:
67 VffController() = default;
68
72 ~VffController() = default;
73
82 virtual void on_initialize() override;
83
92 virtual void update_rt(NavState & nav_state) override;
93
94private:
98 geometry_msgs::msg::TwistStamped cmd_vel_;
99
103 geometry_msgs::msg::Point goal_;
104
111 double normalize_angle(double angle);
112
119 VFFVectors get_vff(
120 double angle_error,
121 const pcl::PointCloud<pcl::PointXYZ> & pointcloud_, std::string frame_id);
122
128 rclcpp::Publisher<visualization_msgs::msg::MarkerArray>::SharedPtr marker_array_pub_;
129
140 visualization_msgs::msg::Marker make_marker(
141 const std::vector<double> & vector,
142 VFFColor vff_color, std::string frame_id);
143
153 visualization_msgs::msg::MarkerArray get_debug_vff(
154 const VFFVectors & vff_vectors,
155 std::string frame_id);
156
163 float distance_obstacle_detection_;
164
170 float obstacle_detection_x_min_;
171 float obstacle_detection_x_max_;
172 float obstacle_detection_y_min_;
173 float obstacle_detection_y_max_;
174 float obstacle_detection_z_min_;
175 float obstacle_detection_z_max_;
176
182 double max_speed_;
183
189 double max_angular_speed_;
190};
191
192} // namespace easynav
193
194#endif // EASYNAV_CONTROLLER__VFFCONTROLLER_HPP_
~VffController()=default
Default destructor.
virtual void update_rt(NavState &nav_state) override
Updates the localization estimate based on the current navigation state.
Definition VffController.cpp:204
VffController()=default
Default constructor.
virtual void on_initialize() override
Initializes the control method plugin.
Definition VffController.cpp:32
Provides a mapping for often used cost values.
Definition cost_values.hpp:41
VFFColor
An enumeration to represent the color of the VFF vectors.
Definition VffController.hpp:52
@ BLUE
Definition VffController.hpp:52
@ GREEN
Definition VffController.hpp:52
@ RED
Definition VffController.hpp:52
A structure to hold the VFF vectors.
Definition VffController.hpp:40
std::vector< double > result
Definition VffController.hpp:43
std::vector< double > attractive
Definition VffController.hpp:41
std::vector< double > repulsive
Definition VffController.hpp:42