12#include <geometry_msgs/msg/point_stamped.hpp>
13#include <geometry_msgs/msg/pose_stamped.hpp>
14#include <lanelet2_map_interface/lanelet2_map_interface.hpp>
15#include <rclcpp/rclcpp.hpp>
16#include <rclcpp_action/rclcpp_action.hpp>
17#include <route_planning_msgs/action/plan_route.hpp>
24template <
typename T,
typename A>
25struct is_vector<std::vector<T, A>> : std::true_type {};
34 using PlanRoute = route_planning_msgs::action::PlanRoute;
61 const std::string& description,
62 const bool add_to_auto_reconfigurable_params =
true,
63 const bool is_required =
false,
64 const bool read_only =
false,
65 const std::optional<double>& from_value = std::nullopt,
66 const std::optional<double>& to_value = std::nullopt,
67 const std::optional<double>& step_value = std::nullopt,
68 const std::string& additional_constraints =
"");
76 rcl_interfaces::msg::SetParametersResult
parametersCallback(
const std::vector<rclcpp::Parameter>& parameters);
114 void sendGoal(
const geometry_msgs::msg::PoseStamped::SharedPtr msg,
115 const std::vector<geometry_msgs::msg::PointStamped>& intermediate_destinations = {});
130 void feedbackCallback(GoalHandlePlanRoute::SharedPtr goal_handle,
const std::shared_ptr<const PlanRoute::Feedback> feedback);
137 void resultCallback(
const GoalHandlePlanRoute::WrappedResult& result);
Action client node for planning a route.
size_t next_waypoint_idx_
Index of next waypoint to follow.
double active_waypoint_wait_time_s_
Wait time of the active waypoint [s].
std::shared_future< GoalHandlePlanRoute::SharedPtr > goal_handle_future_
Goal handle.
std::vector< double > waypoint_wait_times_
Wait time for each waypoint [s]; negative values mark intermediate destinations.
bool has_active_waypoint_
Whether the active goal belongs to the waypoint list.
void planToRandomDestination()
Plans to a random destination.
rclcpp_action::ClientGoalHandle< PlanRoute > GoalHandlePlanRoute
void planToNextWaypoint()
Plans to next waypoint.
void goalPoseCallback(const geometry_msgs::msg::PoseStamped::SharedPtr msg)
Callback for goal pose (most likely received from RViz)
void resultCallback(const GoalHandlePlanRoute::WrappedResult &result)
Callback for result from the action server.
bool cancel_route_
Flag to cancel the route planning action (parameter)
double auto_planning_resume_time_s_
Earliest wall-clock time at which automatic planning may continue.
rcl_interfaces::msg::SetParametersResult parametersCallback(const std::vector< rclcpp::Parameter > ¶meters)
Handles reconfiguration when a parameter value is changed.
bool enable_continuous_planning_
Whether to continuously plan a new route (parameter)
std::vector< std::pair< double, double > > waypoints_
WGS84 waypoints to endlessly follow.
rclcpp::TimerBase::SharedPtr auto_planning_timer_
Timer to automatically plan route, e.g., if waypoints are given.
route_planning_msgs::action::PlanRoute PlanRoute
rclcpp_action::Client< PlanRoute >::SharedPtr action_client_
Action client.
PlanRouteActionClient()
Constructor.
void sendGoal(const geometry_msgs::msg::PoseStamped::SharedPtr msg, const std::vector< geometry_msgs::msg::PointStamped > &intermediate_destinations={})
Sends a goal to the action server.
std::string ll2_map_server_name_
Name of lanelet2_map_server node (parameter)
void autoPlanningTimerCallback()
Callback for automatically planning a route, e.g., if waypoints are given.
bool has_completed_one_goal_
Whether one goal has been completed (succeeded or failed)
OnSetParametersCallbackHandle::SharedPtr parameters_callback_
Callback handle for dynamic parameter reconfiguration.
void goalResponseCallback(const GoalHandlePlanRoute::SharedPtr &goal_handle)
Callback for goal response from the action server.
std::vector< std::string > waypoints_param_
WGS84 waypoints to endlessly follow (parameter)
void feedbackCallback(GoalHandlePlanRoute::SharedPtr goal_handle, const std::shared_ptr< const PlanRoute::Feedback > feedback)
Callback for feedback from the action server.
bool enable_random_destination_
Whether to plan a route to a random destination (parameter)
void setup()
Sets up subscribers, publishers, etc. to configure the node.
rclcpp::Subscription< geometry_msgs::msg::PoseStamped >::SharedPtr goal_pose_subscriber_
Subscriber for goal pose.
void declareAndLoadParameter(const std::string &name, T ¶m, const std::string &description, const bool add_to_auto_reconfigurable_params=true, const bool is_required=false, const bool read_only=false, const std::optional< double > &from_value=std::nullopt, const std::optional< double > &to_value=std::nullopt, const std::optional< double > &step_value=std::nullopt, const std::string &additional_constraints="")
Declares and loads a ROS parameter.
std::vector< std::tuple< std::string, std::function< void(const rclcpp::Parameter &)> > > auto_reconfigurable_params_
Auto-reconfigurable parameters for dynamic reconfiguration.
std::unique_ptr< Lanelet2MapInterface > ll2_interface_
Lanelet2 map interface.
constexpr bool is_vector_v