Easy Navigation
Loading...
Searching...
No Matches
GoalManagerClient.hpp
Go to the documentation of this file.
1// Copyright 2025 Intelligent Robotics Lab
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
17
18#ifndef EASYNAV_SYSTEM__GOALMANAGERCLIENT_HPP_
19#define EASYNAV_SYSTEM__GOALMANAGERCLIENT_HPP_
20
21#include "rclcpp/rclcpp.hpp"
22
23#include "easynav_interfaces/msg/navigation_control.hpp"
24#include "geometry_msgs/msg/pose_stamped.hpp"
25#include "nav_msgs/msg/goals.hpp"
26
27namespace easynav
28{
29
30using namespace std::placeholders;
31
39{
40public:
41 RCLCPP_SMART_PTR_DEFINITIONS(GoalManagerClient)
42
43
59
64 GoalManagerClient(rclcpp::Node::SharedPtr node);
65
70 void send_goal(const geometry_msgs::msg::PoseStamped & goal);
71
76 void send_goals(const nav_msgs::msg::Goals & goals);
77
81 void cancel();
82
86 void reset();
87
92 [[nodiscard]] State get_state() const {return state_;}
93
98 [[nodiscard]] const easynav_interfaces::msg::NavigationControl & get_last_control() const;
99
104 [[nodiscard]] const easynav_interfaces::msg::NavigationControl & get_feedback() const;
105
110 [[nodiscard]] const easynav_interfaces::msg::NavigationControl & get_result() const;
111
112private:
114 rclcpp::Node::SharedPtr node_;
115
117 rclcpp::Publisher<easynav_interfaces::msg::NavigationControl>::SharedPtr control_pub_;
118
120 rclcpp::Subscription<easynav_interfaces::msg::NavigationControl>::SharedPtr control_sub_;
121
123 easynav_interfaces::msg::NavigationControl::UniquePtr last_control_;
124
126 easynav_interfaces::msg::NavigationControl last_feedback_;
127
129 easynav_interfaces::msg::NavigationControl last_result_;
130
132 std::string id_;
133
135 State state_;
136
138 void control_callback(easynav_interfaces::msg::NavigationControl::UniquePtr msg);
139};
140
141} // namespace easynav
142
143#endif // EASYNAV_SYSTEM__GOALMANAGERCLIENT_HPP_
void cancel()
Cancel the current goal.
Definition GoalManagerClient.cpp:217
const easynav_interfaces::msg::NavigationControl & get_feedback() const
Get the most recent feedback received.
Definition GoalManagerClient.cpp:156
const easynav_interfaces::msg::NavigationControl & get_result() const
Get the last result message received.
Definition GoalManagerClient.cpp:162
void send_goals(const nav_msgs::msg::Goals &goals)
Send a list of goals to the GoalManager.
Definition GoalManagerClient.cpp:180
void send_goal(const geometry_msgs::msg::PoseStamped &goal)
Send a single goal to the GoalManager.
Definition GoalManagerClient.cpp:168
State
Internal state of the client-side goal manager.
Definition GoalManagerClient.hpp:48
@ SENT_GOAL
Definition GoalManagerClient.hpp:50
@ SENT_PREEMPT
Definition GoalManagerClient.hpp:51
@ NAVIGATION_FAILED
Definition GoalManagerClient.hpp:55
@ ACCEPTED_AND_NAVIGATING
Definition GoalManagerClient.hpp:52
@ IDLE
Definition GoalManagerClient.hpp:49
@ ERROR
Definition GoalManagerClient.hpp:57
@ NAVIGATION_CANCELLED
Definition GoalManagerClient.hpp:56
@ NAVIGATION_FINISHED
Definition GoalManagerClient.hpp:53
@ NAVIGATION_REJECTED
Definition GoalManagerClient.hpp:54
const easynav_interfaces::msg::NavigationControl & get_last_control() const
Get the last control message sent or received.
Definition GoalManagerClient.cpp:150
GoalManagerClient(rclcpp::Node::SharedPtr node)
Constructor.
Definition GoalManagerClient.cpp:31
State get_state() const
Get the current internal state.
Definition GoalManagerClient.hpp:92
void reset()
Reset internal client state.
Definition GoalManagerClient.cpp:241
Definition CircularBuffer.hpp:23