Class NavigateToPoseNavigator

Inheritance Relationships

Base Type

Class Documentation

class NavigateToPoseNavigator : public nav2_bt_navigator::Navigator<nav2_msgs::action::NavigateToPose>

A navigator for navigating to a specified pose.

Public Types

using ActionT = nav2_msgs::action::NavigateToPose

Public Functions

inline NavigateToPoseNavigator()

A constructor for NavigateToPoseNavigator.

virtual bool configure(rclcpp_lifecycle::LifecycleNode::WeakPtr node, std::shared_ptr<nav2_util::OdomSmoother> odom_smoother) override

A configure state transition to configure navigator’s state.

Parameters:
  • node – Weakptr to the lifecycle node

  • odom_smoother – Object to get current smoothed robot’s speed

virtual bool cleanup() override

A cleanup state transition to remove memory allocated.

void onGoalPoseReceived(const geometry_msgs::msg::PoseStamped::SharedPtr pose)

A subscription and callback to handle the topic-based goal published from rviz.

Parameters:

pose – Pose received via atopic

inline virtual std::string getName() override

Get action name for this navigator.

Returns:

string Name of action server

virtual std::string getDefaultBTFilepath(rclcpp_lifecycle::LifecycleNode::WeakPtr node) override

Get navigator’s default BT.

Parameters:

node – WeakPtr to the lifecycle node

Returns:

string Filepath to default XML

Protected Functions

virtual bool goalReceived(ActionT::Goal::ConstSharedPtr goal) override

A callback to be called when a new goal is received by the BT action server Can be used to check if goal is valid and put values on the blackboard which depend on the received goal.

Parameters:

goal – Action template’s goal message

Returns:

bool if goal was received successfully to be processed

virtual void onLoop() override

A callback that defines execution that happens on one iteration through the BT Can be used to publish action feedback.

virtual void onPreempt(ActionT::Goal::ConstSharedPtr goal) override

A callback that is called when a preempt is requested.

virtual void goalCompleted(typename ActionT::Result::SharedPtr result, const nav2_behavior_tree::BtStatus final_bt_status) override

A callback that is called when a the action is completed, can fill in action result message or indicate that this action is done.

Parameters:
  • result – Action template result message to populate

  • final_bt_status – Resulting status of the behavior tree execution that may be referenced while populating the result.

void initializeGoalPose(ActionT::Goal::ConstSharedPtr goal)

Goal pose initialization on the blackboard.

Parameters:

goal – Action template’s goal message to process

Protected Attributes

rclcpp::Time start_time_
rclcpp::Subscription<geometry_msgs::msg::PoseStamped>::SharedPtr goal_sub_
rclcpp_action::Client<ActionT>::SharedPtr self_client_
std::string goal_blackboard_id_
std::string path_blackboard_id_
std::shared_ptr<nav2_util::OdomSmoother> odom_smoother_