SMACC2
Loading...
Searching...
No Matches
pure_spinning_local_planner.hpp
Go to the documentation of this file.
1// Copyright 2025 Robosoft Inc.
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/*****************************************************************************************************************
16 *
17 * Authors: Pablo Inigo Blasco, Brett Aldrich
18 *
19 ******************************************************************************************************************/
20#pragma once
21
22#include <tf2/transform_datatypes.h>
23#include <tf2_ros/buffer.h>
24
25#include <Eigen/Eigen>
26#include <geometry_msgs/msg/pose_stamped.hpp>
27#include <geometry_msgs/msg/quaternion.hpp>
28#include <nav2_core/controller.hpp>
29#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
30#include <visualization_msgs/msg/marker_array.hpp>
31
32typedef double meter;
33typedef double rad;
34typedef double rad_s;
35
36namespace cl_nav2z
37{
38namespace pure_spinning_local_planner
39{
40class PureSpinningLocalPlanner : public nav2_core::Controller
41{
42public:
44
46
47 void configure(
48 const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent, std::string name,
49 const std::shared_ptr<tf2_ros::Buffer> tf,
50 const std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros) override;
51
52 void activate() override;
53 void deactivate() override;
54 void cleanup() override;
55
60 void setPlan(const nav_msgs::msg::Path & path) override;
61
74 virtual geometry_msgs::msg::TwistStamped computeVelocityCommands(
75 const geometry_msgs::msg::PoseStamped & pose, const geometry_msgs::msg::Twist & velocity,
76 nav2_core::GoalChecker * goal_checker) override;
77
78 /*deprecated in navigation2*/
79 bool isGoalReached();
80
81 virtual void setSpeedLimit(const double & speed_limit, const bool & percentage) override;
82
83private:
84 void updateParameters();
85 nav2_util::LifecycleNode::SharedPtr nh_;
86 std::string name_;
87 void publishGoalMarker(double x, double y, double phi);
88
89 std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmapRos_;
90
91 std::shared_ptr<rclcpp_lifecycle::LifecyclePublisher<visualization_msgs::msg::MarkerArray>>
93
94 std::vector<geometry_msgs::msg::PoseStamped> plan_;
95
96 std::shared_ptr<tf2_ros::Buffer> tf_;
97
98 double k_betta_;
106};
107} // namespace pure_spinning_local_planner
108} // namespace cl_nav2z
double meter
std::shared_ptr< rclcpp_lifecycle::LifecyclePublisher< visualization_msgs::msg::MarkerArray > > goalMarkerPublisher_
virtual void setSpeedLimit(const double &speed_limit, const bool &percentage) override
void configure(const rclcpp_lifecycle::LifecycleNode::WeakPtr &parent, std::string name, const std::shared_ptr< tf2_ros::Buffer > tf, const std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap_ros) override
virtual geometry_msgs::msg::TwistStamped computeVelocityCommands(const geometry_msgs::msg::PoseStamped &pose, const geometry_msgs::msg::Twist &velocity, nav2_core::GoalChecker *goal_checker) override
nav2_core computeVelocityCommands - calculates the best command given the current pose and velocity
void setPlan(const nav_msgs::msg::Path &path) override
nav2_core setPlan - Sets the global plan