diff --git a/nav2_bt_navigator/include/nav2_bt_navigator/bt_navigator.hpp b/nav2_bt_navigator/include/nav2_bt_navigator/bt_navigator.hpp index 7b40f6e50ca91d5522b3dc10b9503b8f00c0b9be..f016df80afded076f21c13721df747b90964003d 100644 --- a/nav2_bt_navigator/include/nav2_bt_navigator/bt_navigator.hpp +++ b/nav2_bt_navigator/include/nav2_bt_navigator/bt_navigator.hpp @@ -30,20 +30,61 @@ namespace nav2_bt_navigator { - +/** + * @class nav2_bt_navigator::BtNavigator + * @brief An action server that uses behavior tree for navigating a robot to its + * goal position. + */ class BtNavigator : public nav2_util::LifecycleNode { public: + /** + * @brief A constructor for nav2_bt_navigator::BtNavigator class + */ BtNavigator(); + /** + * @brief A destructor for nav2_bt_navigator::BtNavigator class + */ ~BtNavigator(); protected: - // The lifecycle node interface + /** + * @brief Configures member variables + * + * Initializes action server for "NavigationToPose"; subscription to + * "goal_sub"; and builds behavior tree from xml file. + * @param state Reference to LifeCycle node state + * @return SUCCESS or FAILURE + */ nav2_util::CallbackReturn on_configure(const rclcpp_lifecycle::State & state) override; + /** + * @brief Activates action server + * @param state Reference to LifeCycle node state + * @return SUCCESS or FAILURE + */ nav2_util::CallbackReturn on_activate(const rclcpp_lifecycle::State & state) override; + /** + * @brief Deactivates action server + * @param state Reference to LifeCycle node state + * @return SUCCESS or FAILURE + */ nav2_util::CallbackReturn on_deactivate(const rclcpp_lifecycle::State & state) override; + /** + * @brief Resets member variables + * @param state Reference to LifeCycle node state + * @return SUCCESS or FAILURE + */ nav2_util::CallbackReturn on_cleanup(const rclcpp_lifecycle::State & state) override; + /** + * @brief Called when in shutdown state + * @param state Reference to LifeCycle node state + * @return SUCCESS or FAILURE + */ nav2_util::CallbackReturn on_shutdown(const rclcpp_lifecycle::State & state) override; + /** + * @brief Called when in error state + * @param state Reference to LifeCycle node state + */ nav2_util::CallbackReturn on_error(const rclcpp_lifecycle::State & state) override; using ActionServer = nav2_util::SimpleActionServer<nav2_msgs::action::NavigateToPose>; @@ -51,13 +92,20 @@ protected: // Our action server implements the NavigateToPose action std::unique_ptr<ActionServer> action_server_; - // The action server callback + /** + * @brief Action server callbacks + */ void navigateToPose(); - // Goal pose initialization on the blackboard + /** + * @brief Goal pose initialization on the blackboard + */ void initializeGoalPose(); - // A subscription and callback to handle the topic-based goal published from rviz + /** + * @brief A subscription and callback to handle the topic-based goal published + * from rviz + */ void onGoalPoseReceived(const geometry_msgs::msg::PoseStamped::SharedPtr pose); rclcpp::Subscription<geometry_msgs::msg::PoseStamped>::SharedPtr goal_sub_;