Nav2 Navigation Stack - humble  humble
ROS 2 Navigation Stack
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
nav2_bt_navigator::Navigator< ActionT > Class Template Referenceabstract

Navigator interface that acts as a base class for all BT-based Navigator action's plugins. More...

#include <nav2_bt_navigator/include/nav2_bt_navigator/navigator.hpp>

Collaboration diagram for nav2_bt_navigator::Navigator< ActionT >:
Collaboration graph
[legend]

Public Types

using Ptr = std::shared_ptr< nav2_bt_navigator::Navigator< ActionT > >
 

Public Member Functions

 Navigator ()
 A Navigator constructor.
 
virtual ~Navigator ()=default
 Virtual destructor.
 
bool on_configure (rclcpp_lifecycle::LifecycleNode::WeakPtr parent_node, const std::vector< std::string > &plugin_lib_names, const FeedbackUtils &feedback_utils, nav2_bt_navigator::NavigatorMuxer *plugin_muxer, std::shared_ptr< nav2_util::OdomSmoother > odom_smoother)
 Configuration to setup the navigator's backend BT and actions. More...
 
bool on_activate ()
 Activation of the navigator's backend BT and actions. More...
 
bool on_deactivate ()
 Deactivation of the navigator's backend BT and actions. More...
 
bool on_cleanup ()
 Cleanup a navigator. More...
 
virtual std::string getName ()=0
 Get the action name of this navigator to expose. More...
 
virtual std::string getDefaultBTFilepath (rclcpp_lifecycle::LifecycleNode::WeakPtr node)=0
 
std::unique_ptr< nav2_behavior_tree::BtActionServer< ActionT > > & getActionServer ()
 Get the action server. More...
 

Protected Member Functions

bool onGoalReceived (typename ActionT::Goal::ConstSharedPtr goal)
 An intermediate goal reception function to mux navigators.
 
void onCompletion (typename ActionT::Result::SharedPtr result, const nav2_behavior_tree::BtStatus final_bt_status)
 An intermediate completion function to mux navigators.
 
virtual bool goalReceived (typename ActionT::Goal::ConstSharedPtr goal)=0
 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.
 
virtual void onLoop ()=0
 A callback that defines execution that happens on one iteration through the BT Can be used to publish action feedback.
 
virtual void onPreempt (typename ActionT::Goal::ConstSharedPtr goal)=0
 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)=0
 A callback that is called when a the action is completed; Can fill in action result message or indicate that this action is done.
 
virtual bool configure (rclcpp_lifecycle::LifecycleNode::WeakPtr, std::shared_ptr< nav2_util::OdomSmoother >)
 
virtual bool cleanup ()
 Method to cleanup resources.
 
virtual bool activate ()
 Method to activate any threads involved in execution.
 
virtual bool deactivate ()
 Method to deactivate and any threads involved in execution.
 

Protected Attributes

std::unique_ptr< nav2_behavior_tree::BtActionServer< ActionT > > bt_action_server_
 
rclcpp::Logger logger_ {rclcpp::get_logger("Navigator")}
 
rclcpp::Clock::SharedPtr clock_
 
FeedbackUtils feedback_utils_
 
NavigatorMuxerplugin_muxer_
 

Detailed Description

template<class ActionT>
class nav2_bt_navigator::Navigator< ActionT >

Navigator interface that acts as a base class for all BT-based Navigator action's plugins.

Definition at line 114 of file navigator.hpp.

Member Function Documentation

◆ configure()

template<class ActionT >
virtual bool nav2_bt_navigator::Navigator< ActionT >::configure ( rclcpp_lifecycle::LifecycleNode::WeakPtr  ,
std::shared_ptr< nav2_util::OdomSmoother  
)
inlineprotectedvirtual
Parameters
Methodto configure resources.

Reimplemented in nav2_bt_navigator::NavigateToPoseNavigator, and nav2_bt_navigator::NavigateThroughPosesNavigator.

Definition at line 308 of file navigator.hpp.

Referenced by nav2_bt_navigator::Navigator< ActionT >::on_configure().

Here is the caller graph for this function:

◆ getActionServer()

template<class ActionT >
std::unique_ptr<nav2_behavior_tree::BtActionServer<ActionT> >& nav2_bt_navigator::Navigator< ActionT >::getActionServer ( )
inline

Get the action server.

Returns
Action server pointer

Definition at line 240 of file navigator.hpp.

◆ getName()

template<class ActionT >
virtual std::string nav2_bt_navigator::Navigator< ActionT >::getName ( )
pure virtual

Get the action name of this navigator to expose.

Returns
string Name of action to expose

Implemented in nav2_bt_navigator::NavigateToPoseNavigator, and nav2_bt_navigator::NavigateThroughPosesNavigator.

Referenced by nav2_bt_navigator::Navigator< ActionT >::on_configure(), nav2_bt_navigator::Navigator< ActionT >::onCompletion(), and nav2_bt_navigator::Navigator< ActionT >::onGoalReceived().

Here is the caller graph for this function:

◆ on_activate()

template<class ActionT >
bool nav2_bt_navigator::Navigator< ActionT >::on_activate ( )
inline

Activation of the navigator's backend BT and actions.

Returns
bool If successful

Definition at line 187 of file navigator.hpp.

References nav2_bt_navigator::Navigator< ActionT >::activate().

Here is the call graph for this function:

◆ on_cleanup()

template<class ActionT >
bool nav2_bt_navigator::Navigator< ActionT >::on_cleanup ( )
inline

Cleanup a navigator.

Returns
bool If successful

Definition at line 216 of file navigator.hpp.

References nav2_bt_navigator::Navigator< ActionT >::cleanup().

Here is the call graph for this function:

◆ on_configure()

template<class ActionT >
bool nav2_bt_navigator::Navigator< ActionT >::on_configure ( rclcpp_lifecycle::LifecycleNode::WeakPtr  parent_node,
const std::vector< std::string > &  plugin_lib_names,
const FeedbackUtils feedback_utils,
nav2_bt_navigator::NavigatorMuxer plugin_muxer,
std::shared_ptr< nav2_util::OdomSmoother odom_smoother 
)
inline

Configuration to setup the navigator's backend BT and actions.

Parameters
parent_nodeThe ROS parent node to utilize
plugin_lib_namesa vector of plugin shared libraries to load
feedback_utilsSome utilities useful for navigators to have
plugin_muxerThe muxing object to ensure only one navigator can be active at a time
odom_smootherObject to get current smoothed robot's speed
Returns
bool If successful

Definition at line 142 of file navigator.hpp.

References nav2_bt_navigator::Navigator< ActionT >::configure(), nav2_bt_navigator::Navigator< ActionT >::getName(), nav2_bt_navigator::Navigator< ActionT >::onCompletion(), nav2_bt_navigator::Navigator< ActionT >::onGoalReceived(), nav2_bt_navigator::Navigator< ActionT >::onLoop(), and nav2_bt_navigator::Navigator< ActionT >::onPreempt().

Here is the call graph for this function:

◆ on_deactivate()

template<class ActionT >
bool nav2_bt_navigator::Navigator< ActionT >::on_deactivate ( )
inline

Deactivation of the navigator's backend BT and actions.

Returns
bool If successful

Definition at line 202 of file navigator.hpp.

References nav2_bt_navigator::Navigator< ActionT >::deactivate().

Here is the call graph for this function:

The documentation for this class was generated from the following file: