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

Navigator interface that acts as a base class for all BT-based Navigator action's plugins All methods from NavigatorBase are marked as final so they may not be overridden by derived methods - instead, users should use the appropriate APIs provided after BT Action handling. More...

#include <nav2_core/include/nav2_core/behavior_tree_navigator.hpp>

Inheritance diagram for nav2_core::BehaviorTreeNavigator< ActionT >:
Inheritance graph
[legend]
Collaboration diagram for nav2_core::BehaviorTreeNavigator< ActionT >:
Collaboration graph
[legend]

Public Types

using Ptr = std::shared_ptr< nav2_core::BehaviorTreeNavigator< ActionT > >
 

Public Member Functions

 BehaviorTreeNavigator ()
 A Navigator constructor.
 
virtual ~BehaviorTreeNavigator ()=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_core::NavigatorMuxer *plugin_muxer, std::shared_ptr< nav2_util::OdomSmoother > odom_smoother) final
 Configuration to setup the navigator's backend BT and actions. More...
 
bool on_activate () final
 Activation of the navigator's backend BT and actions. More...
 
bool on_deactivate () final
 Deactivation of the navigator's backend BT and actions. More...
 
bool on_cleanup () final
 Cleanup a navigator. More...
 
virtual std::string getDefaultBTFilepath (rclcpp_lifecycle::LifecycleNode::WeakPtr node)=0
 
virtual std::string getName ()=0
 Get the action name of this navigator to expose. 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_core::BehaviorTreeNavigator< ActionT >

Navigator interface that acts as a base class for all BT-based Navigator action's plugins All methods from NavigatorBase are marked as final so they may not be overridden by derived methods - instead, users should use the appropriate APIs provided after BT Action handling.

Definition at line 159 of file behavior_tree_navigator.hpp.

Member Function Documentation

◆ configure()

template<class ActionT >
virtual bool nav2_core::BehaviorTreeNavigator< 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 347 of file behavior_tree_navigator.hpp.

Referenced by nav2_core::BehaviorTreeNavigator< ActionT >::on_configure().

Here is the caller graph for this function:

◆ getName()

template<class ActionT >
virtual std::string nav2_core::BehaviorTreeNavigator< 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_core::BehaviorTreeNavigator< ActionT >::on_configure(), nav2_core::BehaviorTreeNavigator< ActionT >::onCompletion(), and nav2_core::BehaviorTreeNavigator< ActionT >::onGoalReceived().

Here is the caller graph for this function:

◆ on_activate()

template<class ActionT >
bool nav2_core::BehaviorTreeNavigator< ActionT >::on_activate ( )
inlinefinalvirtual

Activation of the navigator's backend BT and actions.

Returns
bool If successful

Implements nav2_core::NavigatorBase.

Definition at line 235 of file behavior_tree_navigator.hpp.

References nav2_core::BehaviorTreeNavigator< ActionT >::activate().

Here is the call graph for this function:

◆ on_cleanup()

template<class ActionT >
bool nav2_core::BehaviorTreeNavigator< ActionT >::on_cleanup ( )
inlinefinalvirtual

Cleanup a navigator.

Returns
bool If successful

Implements nav2_core::NavigatorBase.

Definition at line 264 of file behavior_tree_navigator.hpp.

References nav2_core::BehaviorTreeNavigator< ActionT >::cleanup().

Here is the call graph for this function:

◆ on_configure()

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

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

Implements nav2_core::NavigatorBase.

Definition at line 188 of file behavior_tree_navigator.hpp.

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

Here is the call graph for this function:

◆ on_deactivate()

template<class ActionT >
bool nav2_core::BehaviorTreeNavigator< ActionT >::on_deactivate ( )
inlinefinalvirtual

Deactivation of the navigator's backend BT and actions.

Returns
bool If successful

Implements nav2_core::NavigatorBase.

Definition at line 250 of file behavior_tree_navigator.hpp.

References nav2_core::BehaviorTreeNavigator< ActionT >::deactivate().

Here is the call graph for this function:

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