Class WaypointFollower

Inheritance Relationships

Base Type

  • public nav2_util::LifecycleNode

Class Documentation

class WaypointFollower : public nav2_util::LifecycleNode

An action server that uses behavior tree for navigating a robot to its goal position.

Public Types

using ActionT = nav2_msgs::action::FollowWaypoints
using ClientT = nav2_msgs::action::NavigateToPose
using ActionServer = nav2_util::SimpleActionServer<ActionT>
using ActionClient = rclcpp_action::Client<ClientT>

Public Functions

explicit WaypointFollower(const rclcpp::NodeOptions &options = rclcpp::NodeOptions())

A constructor for nav2_waypoint_follower::WaypointFollower class.

Parameters:

options – Additional options to control creation of the node.

~WaypointFollower()

A destructor for nav2_waypoint_follower::WaypointFollower class.

Protected Functions

nav2_util::CallbackReturn on_configure(const rclcpp_lifecycle::State &state) override

Configures member variables.

Initializes action server for “follow_waypoints”

Parameters:

state – Reference to LifeCycle node state

Returns:

SUCCESS or FAILURE

nav2_util::CallbackReturn on_activate(const rclcpp_lifecycle::State &state) override

Activates action server.

Parameters:

state – Reference to LifeCycle node state

Returns:

SUCCESS or FAILURE

nav2_util::CallbackReturn on_deactivate(const rclcpp_lifecycle::State &state) override

Deactivates action server.

Parameters:

state – Reference to LifeCycle node state

Returns:

SUCCESS or FAILURE

nav2_util::CallbackReturn on_cleanup(const rclcpp_lifecycle::State &state) override

Resets member variables.

Parameters:

state – Reference to LifeCycle node state

Returns:

SUCCESS or FAILURE

nav2_util::CallbackReturn on_shutdown(const rclcpp_lifecycle::State &state) override

Called when in shutdown state.

Parameters:

state – Reference to LifeCycle node state

Returns:

SUCCESS or FAILURE

void followWaypoints()

Action server callbacks.

void resultCallback(const rclcpp_action::ClientGoalHandle<ClientT>::WrappedResult &result)

Action client result callback.

Parameters:

result – Result of action server updated asynchronously

void goalResponseCallback(const rclcpp_action::ClientGoalHandle<ClientT>::SharedPtr &goal)

Action client goal response callback.

Parameters:

goal – Response of action server updated asynchronously

rcl_interfaces::msg::SetParametersResult dynamicParametersCallback(std::vector<rclcpp::Parameter> parameters)

Callback executed when a parameter change is detected.

Parameters:

event – ParameterEvent message

Protected Attributes

rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr dyn_params_handler_
std::unique_ptr<ActionServer> action_server_
ActionClient::SharedPtr nav_to_pose_client_
rclcpp::CallbackGroup::SharedPtr callback_group_
rclcpp::executors::SingleThreadedExecutor callback_group_executor_
std::shared_future<rclcpp_action::ClientGoalHandle<ClientT>::SharedPtr> future_goal_handle_
bool stop_on_failure_
ActionStatus current_goal_status_
int loop_rate_
std::vector<int> failed_ids_
pluginlib::ClassLoader<nav2_core::WaypointTaskExecutor> waypoint_task_executor_loader_
pluginlib::UniquePtr<nav2_core::WaypointTaskExecutor> waypoint_task_executor_
std::string waypoint_task_executor_id_
std::string waypoint_task_executor_type_