23#ifndef EASYNAV_SYSTEM__GOALMANAGER_HPP_
24#define EASYNAV_SYSTEM__GOALMANAGER_HPP_
26#include "rclcpp/subscription.hpp"
27#include "rclcpp/publisher.hpp"
28#include "rclcpp/macros.hpp"
29#include "rclcpp_lifecycle/lifecycle_node.hpp"
31#include "easynav_interfaces/msg/navigation_control.hpp"
32#include "easynav_interfaces/msg/goal_manager_info.hpp"
33#include "geometry_msgs/msg/pose_stamped.hpp"
34#include "nav_msgs/msg/goals.hpp"
71 double height {std::numeric_limits<double>::max()};
83 rclcpp_lifecycle::LifecycleNode::SharedPtr parent_node);
89 [[nodiscard]]
inline nav_msgs::msg::Goals
get_goals()
const {
return goals_;}
112 void set_error(
const std::string & reason);
129 const geometry_msgs::msg::Pose & current_pose,
130 const GoalTolerance & goal_tolerance
135 rclcpp_lifecycle::LifecycleNode::SharedPtr parent_node_;
138 GoalTolerance goal_tolerance_ {};
141 nav_msgs::msg::Goals goals_;
144 rclcpp::Publisher<easynav_interfaces::msg::NavigationControl>::SharedPtr control_pub_;
147 rclcpp::Subscription<easynav_interfaces::msg::NavigationControl>::SharedPtr control_sub_;
150 rclcpp::Subscription<geometry_msgs::msg::PoseStamped>::SharedPtr comanded_pose_sub_;
153 rclcpp::Publisher<easynav_interfaces::msg::GoalManagerInfo>::SharedPtr info_pub_;
156 easynav_interfaces::msg::NavigationControl::UniquePtr last_control_;
162 std::string current_client_id_;
165 bool allow_preempt_goal_ {
true};
168 rclcpp::Time nav_start_time_;
172 const easynav_interfaces::msg::NavigationControl & msg,
173 easynav_interfaces::msg::NavigationControl & response);
176 void control_callback(easynav_interfaces::msg::NavigationControl::UniquePtr msg);
179 void comanded_pose_callback(geometry_msgs::msg::PoseStamped::UniquePtr msg);
182 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:314
nav_msgs::msg::Goals get_goals() const
Get current goals.
Definition GoalManager.hpp:89
GoalManager(NavState &nav_state, rclcpp_lifecycle::LifecycleNode::SharedPtr parent_node)
Constructor.
Definition GoalManager.cpp:76
void set_finished()
Mark the current goal as successfully completed.
Definition GoalManager.cpp:246
State
Current internal goal state.
Definition GoalManager.hpp:57
@ ACTIVE
A goal is currently being pursued.
Definition GoalManager.hpp:59
@ IDLE
No active goal.
Definition GoalManager.hpp:58
void set_error(const std::string &reason)
Mark the system as in error state.
Definition GoalManager.cpp:264
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:395
State get_state() const
Get current internal goal state.
Definition GoalManager.hpp:95
void set_failed(const std::string &reason)
Mark the current goal as failed.
Definition GoalManager.cpp:282
A generic, type-safe, thread-safe blackboard to hold runtime state.
Definition NavState.hpp:87
Definition CircularBuffer.hpp:28
A structure to represent the goal tolerances.
Definition GoalManager.hpp:67
double yaw
Angular tolerance in radians for the yaw angle.
Definition GoalManager.hpp:73
double height
Positional tolerance for z axis in meters. Very big number as default.
Definition GoalManager.hpp:71
double position
Positional tolerance for x/y in meters.
Definition GoalManager.hpp:69