18#ifndef EASYNAV_SYSTEM__GOALMANAGER_HPP_
19#define EASYNAV_SYSTEM__GOALMANAGER_HPP_
21#include "rclcpp/subscription.hpp"
22#include "rclcpp/publisher.hpp"
23#include "rclcpp/macros.hpp"
24#include "rclcpp_lifecycle/lifecycle_node.hpp"
26#include "easynav_interfaces/msg/navigation_control.hpp"
27#include "easynav_interfaces/msg/goal_manager_info.hpp"
28#include "geometry_msgs/msg/pose_stamped.hpp"
29#include "nav_msgs/msg/goals.hpp"
66 double height {std::numeric_limits<double>::max()};
78 rclcpp_lifecycle::LifecycleNode::SharedPtr parent_node);
84 [[nodiscard]]
inline nav_msgs::msg::Goals
get_goals()
const {
return goals_;}
107 void set_error(
const std::string & reason);
124 const geometry_msgs::msg::Pose & current_pose,
125 const GoalTolerance & goal_tolerance
130 rclcpp_lifecycle::LifecycleNode::SharedPtr parent_node_;
133 GoalTolerance goal_tolerance_ {};
136 nav_msgs::msg::Goals goals_;
139 rclcpp::Publisher<easynav_interfaces::msg::NavigationControl>::SharedPtr control_pub_;
142 rclcpp::Subscription<easynav_interfaces::msg::NavigationControl>::SharedPtr control_sub_;
145 rclcpp::Subscription<geometry_msgs::msg::PoseStamped>::SharedPtr comanded_pose_sub_;
148 rclcpp::Publisher<easynav_interfaces::msg::GoalManagerInfo>::SharedPtr info_pub_;
151 easynav_interfaces::msg::NavigationControl::UniquePtr last_control_;
157 std::string current_client_id_;
160 bool allow_preempt_goal_ {
true};
163 rclcpp::Time nav_start_time_;
167 const easynav_interfaces::msg::NavigationControl & msg,
168 easynav_interfaces::msg::NavigationControl & response);
171 void control_callback(easynav_interfaces::msg::NavigationControl::UniquePtr msg);
174 void comanded_pose_callback(geometry_msgs::msg::PoseStamped::UniquePtr msg);
177 void set_preempted();
A blackboard-like structure to hold the current state of the navigation system.
void update(NavState &nav_state)
Update internal logic, including preemption and timeout checks.
Definition GoalManager.cpp:309
nav_msgs::msg::Goals get_goals() const
Get current goals.
Definition GoalManager.hpp:84
GoalManager(NavState &nav_state, rclcpp_lifecycle::LifecycleNode::SharedPtr parent_node)
Constructor.
Definition GoalManager.cpp:71
void set_finished()
Mark the current goal as successfully completed.
Definition GoalManager.cpp:241
State
Current internal goal state.
Definition GoalManager.hpp:52
@ ACTIVE
A goal is currently being pursued.
Definition GoalManager.hpp:54
@ IDLE
No active goal.
Definition GoalManager.hpp:53
void set_error(const std::string &reason)
Mark the system as in error state.
Definition GoalManager.cpp:259
void check_goals(const geometry_msgs::msg::Pose ¤t_pose, const GoalTolerance &goal_tolerance)
Check if the robot is currently at the first goal.
Definition GoalManager.cpp:390
State get_state() const
Get current internal goal state.
Definition GoalManager.hpp:90
void set_failed(const std::string &reason)
Mark the current goal as failed.
Definition GoalManager.cpp:277
A generic, type-safe, thread-safe blackboard to hold runtime state.
Definition NavState.hpp:82
Definition CircularBuffer.hpp:23
A structure to represent the goal tolerances.
Definition GoalManager.hpp:62
double yaw
Angular tolerance in radians for the yaw angle.
Definition GoalManager.hpp:68
double height
Positional tolerance for z axis in meters. Very big number as default.
Definition GoalManager.hpp:66
double position
Positional tolerance for x/y in meters.
Definition GoalManager.hpp:64