diff --git a/README.md b/README.md
index 3fbb186d45..6df210791b 100644
--- a/README.md
+++ b/README.md
@@ -27,11 +27,13 @@ If you need professional services related to Nav2, please contact Open Navigatio
Please thank our amazing sponsors for their generous support of Nav2 on behalf of the community to allow the project to continue to be professionally maintained, developed, and supported for the long-haul! [Open Navigation LLC](https://www.opennav.org/) provides project leadership, maintenance, development, and support services to the Nav2 & ROS community.
-
+
### [Dexory](https://www.dexory.com/) develops robotics and AI logistics solutions to drive better business decisions using a digital twin of warehouses to provide inventory insights.
+### [Nvidia](https://www.nvidia.com/en-us/deep-learning-ai/industries/robotics/) develops GPU and AI technologies that power modern robotics, autonomous driving, data centers, gaming, and more.
+
### [Polymath Robotics](https://www.polymathrobotics.com/) creates safety-critical navigation systems for industrial vehicles that are radically simple to enable and deploy.
### [Stereolabs](https://www.stereolabs.com/) produces the high-quality ZED stereo cameras with a complete vision pipeline from neural depth to SLAM, 3D object tracking, AI and more.
diff --git a/doc/sponsors_feb_2024.png b/doc/sponsors_feb_2024.png
new file mode 100644
index 0000000000..50dfbc47a4
Binary files /dev/null and b/doc/sponsors_feb_2024.png differ
diff --git a/doc/sponsors_jan_2024.png b/doc/sponsors_jan_2024.png
new file mode 100644
index 0000000000..601df4909c
Binary files /dev/null and b/doc/sponsors_jan_2024.png differ
diff --git a/nav2_behavior_tree/CMakeLists.txt b/nav2_behavior_tree/CMakeLists.txt
index fe539b0965..91fc49b71d 100644
--- a/nav2_behavior_tree/CMakeLists.txt
+++ b/nav2_behavior_tree/CMakeLists.txt
@@ -11,7 +11,7 @@ find_package(geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(nav2_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
-find_package(behaviortree_cpp_v3 REQUIRED)
+find_package(behaviortree_cpp REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(std_msgs REQUIRED)
@@ -34,7 +34,7 @@ set(dependencies
sensor_msgs
nav2_msgs
nav_msgs
- behaviortree_cpp_v3
+ behaviortree_cpp
tf2
tf2_ros
tf2_geometry_msgs
@@ -222,6 +222,17 @@ install(TARGETS ${library_name}
RUNTIME DESTINATION bin
)
+# we will embed the list of plugin names inside a header file
+set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen)
+configure_file(plugins_list.hpp.in ${GENERATED_DIR}/plugins_list.hpp)
+
+add_executable(generate_nav2_tree_nodes_xml src/generate_nav2_tree_nodes_xml.cpp)
+ament_target_dependencies(generate_nav2_tree_nodes_xml ${dependencies})
+# allow generate_nav2_tree_nodes_xml to find plugins_list.hpp
+target_include_directories(generate_nav2_tree_nodes_xml PRIVATE ${GENERATED_DIR})
+install(TARGETS generate_nav2_tree_nodes_xml DESTINATION lib/${PROJECT_NAME})
+
+
install(DIRECTORY include/
DESTINATION include/
)
@@ -231,6 +242,7 @@ install(DIRECTORY test/utils/
)
install(FILES nav2_tree_nodes.xml DESTINATION share/${PROJECT_NAME})
+install(FILES ${GENERATED_DIR}/plugins_list.hpp DESTINATION include/${PROJECT_NAME})
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
diff --git a/nav2_behavior_tree/README.md b/nav2_behavior_tree/README.md
index 84e16e7d4e..0ade4e0a01 100644
--- a/nav2_behavior_tree/README.md
+++ b/nav2_behavior_tree/README.md
@@ -41,7 +41,7 @@ BehaviorTreeEngine::BehaviorTreeEngine()
Once a new node is registered with the factory, it is now available to the BehaviorTreeEngine and can be used in Behavior Trees. For example, the following simple XML description of a BT shows the FollowPath node in use:
```XML
-
+
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/behavior_tree_engine.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/behavior_tree_engine.hpp
index daf609d067..9ee903fd78 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/behavior_tree_engine.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/behavior_tree_engine.hpp
@@ -20,10 +20,9 @@
#include
#include
-#include "behaviortree_cpp_v3/behavior_tree.h"
-#include "behaviortree_cpp_v3/bt_factory.h"
-#include "behaviortree_cpp_v3/xml_parsing.h"
-#include "behaviortree_cpp_v3/loggers/bt_zmq_publisher.h"
+#include "behaviortree_cpp/behavior_tree.h"
+#include "behaviortree_cpp/bt_factory.h"
+#include "behaviortree_cpp/xml_parsing.h"
#include "rclcpp/rclcpp.hpp"
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp
index 39c5c5f7d9..6193a91a86 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_node.hpp
@@ -19,7 +19,7 @@
#include
#include
-#include "behaviortree_cpp_v3/action_node.h"
+#include "behaviortree_cpp/action_node.h"
#include "nav2_util/node_utils.hpp"
#include "rclcpp_action/rclcpp_action.hpp"
#include "nav2_behavior_tree/bt_utils.hpp"
@@ -188,7 +188,7 @@ class BtActionNode : public BT::ActionNodeBase
BT::NodeStatus tick() override
{
// first step to be done only at the beginning of the Action
- if (status() == BT::NodeStatus::IDLE) {
+ if (!BT::isStatusActive(status())) {
// setting the status to RUNNING to notify the BT Loggers (if any)
setStatus(BT::NodeStatus::RUNNING);
@@ -325,7 +325,9 @@ class BtActionNode : public BT::ActionNodeBase
on_cancelled();
}
- setStatus(BT::NodeStatus::IDLE);
+ // this is probably redundant, since the parent node
+ // is supposed to call it, but we keep it, just in case
+ resetStatus();
}
protected:
@@ -376,12 +378,14 @@ class BtActionNode : public BT::ActionNodeBase
if (this->goal_handle_->get_goal_id() == result.goal_id) {
goal_result_available_ = true;
result_ = result;
+ emitWakeUpSignal();
}
};
send_goal_options.feedback_callback =
[this](typename rclcpp_action::ClientGoalHandle::SharedPtr,
const std::shared_ptr feedback) {
feedback_ = feedback;
+ emitWakeUpSignal();
};
future_goal_handle_ = std::make_shared<
@@ -434,9 +438,9 @@ class BtActionNode : public BT::ActionNodeBase
void increment_recovery_count()
{
int recovery_count = 0;
- config().blackboard->template get("number_recoveries", recovery_count); // NOLINT
+ [[maybe_unused]] auto res = config().blackboard->get("number_recoveries", recovery_count); // NOLINT
recovery_count += 1;
- config().blackboard->template set("number_recoveries", recovery_count); // NOLINT
+ config().blackboard->set("number_recoveries", recovery_count); // NOLINT
}
std::string action_name_;
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp
index eef3ad2c86..5e005fc610 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp
@@ -237,7 +237,8 @@ bool BtActionServer::loadBehaviorTree(const std::string & bt_xml_filena
// Create the Behavior Tree from the XML input
try {
tree_ = bt_->createTreeFromFile(filename, blackboard_);
- for (auto & blackboard : tree_.blackboard_stack) {
+ for (auto & subtree : tree_.subtrees) {
+ auto & blackboard = subtree->blackboard;
blackboard->set("node", client_node_);
blackboard->set("server_timeout", default_server_timeout_);
blackboard->set("bt_loop_duration", bt_loop_duration_);
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/bt_cancel_action_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/bt_cancel_action_node.hpp
index ea3e41d859..789e30133d 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/bt_cancel_action_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/bt_cancel_action_node.hpp
@@ -19,7 +19,7 @@
#include
#include
-#include "behaviortree_cpp_v3/action_node.h"
+#include "behaviortree_cpp/action_node.h"
#include "nav2_util/node_utils.hpp"
#include "rclcpp_action/rclcpp_action.hpp"
#include "nav2_behavior_tree/bt_utils.hpp"
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp
index 1afdb5adfd..d51c7d2839 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp
@@ -19,7 +19,7 @@
#include
#include
-#include "behaviortree_cpp_v3/action_node.h"
+#include "behaviortree_cpp/action_node.h"
#include "nav2_util/node_utils.hpp"
#include "rclcpp/rclcpp.hpp"
#include "nav2_behavior_tree/bt_utils.hpp"
@@ -157,7 +157,7 @@ class BtServiceNode : public BT::ActionNodeBase
void halt() override
{
request_sent_ = false;
- setStatus(BT::NodeStatus::IDLE);
+ resetStatus();
}
/**
@@ -230,9 +230,9 @@ class BtServiceNode : public BT::ActionNodeBase
void increment_recovery_count()
{
int recovery_count = 0;
- config().blackboard->template get("number_recoveries", recovery_count); // NOLINT
+ [[maybe_unused]] auto res = config().blackboard->get("number_recoveries", recovery_count); // NOLINT
recovery_count += 1;
- config().blackboard->template set("number_recoveries", recovery_count); // NOLINT
+ config().blackboard->set("number_recoveries", recovery_count); // NOLINT
}
std::string service_name_, service_node_name_;
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/bt_utils.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/bt_utils.hpp
index c0425d1711..7075bc63f4 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/bt_utils.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/bt_utils.hpp
@@ -20,7 +20,7 @@
#include "rclcpp/time.hpp"
#include "rclcpp/node.hpp"
-#include "behaviortree_cpp_v3/behavior_tree.h"
+#include "behaviortree_cpp/behavior_tree.h"
#include "geometry_msgs/msg/point.hpp"
#include "geometry_msgs/msg/quaternion.hpp"
#include "geometry_msgs/msg/pose_stamped.hpp"
@@ -132,20 +132,27 @@ inline std::set convertFromString(StringView key)
}
/**
- * @brief Return parameter value from behavior tree node or ros2 parameter file
+ * @brief Return parameter value from behavior tree node or ros2 parameter file.
* @param node rclcpp::Node::SharedPtr
* @param param_name std::string
* @param behavior_tree_node T2
* @return
*/
-template
+template
T1 deconflictPortAndParamFrame(
rclcpp::Node::SharedPtr node,
std::string param_name,
- T2 * behavior_tree_node)
+ const T2 * behavior_tree_node)
{
T1 param_value;
- if (!behavior_tree_node->getInput(param_name, param_value)) {
+ bool param_from_input = behavior_tree_node->getInput(param_name, param_value).has_value();
+
+ if constexpr (std::is_same_v) {
+ // not valid if port doesn't exist or it is an empty string
+ param_from_input &= !param_value.empty();
+ }
+
+ if (!param_from_input) {
RCLCPP_DEBUG(
node->get_logger(),
"Parameter '%s' not provided by behavior tree xml file, "
@@ -162,6 +169,37 @@ T1 deconflictPortAndParamFrame(
}
}
+/**
+ * @brief Try reading an import port first, and if that doesn't work
+ * fallback to reading directly the blackboard.
+ * The blackboard must be passed explitly because config() is private in BT.CPP 4.X
+ *
+ * @param bt_node node
+ * @param blackboard the blackboard ovtained with node->config().blackboard
+ * @param param_name std::string
+ * @param behavior_tree_node the node
+ * @return
+ */
+template inline
+bool getInputPortOrBlackboard(
+ const BT::TreeNode & bt_node,
+ const BT::Blackboard & blackboard,
+ const std::string & param_name,
+ T & value)
+{
+ if (bt_node.getInput(param_name, value)) {
+ return true;
+ }
+ if (blackboard.get(param_name, value)) {
+ return true;
+ }
+ return false;
+}
+
+// Macro to remove boiler plate when using getInputPortOrBlackboard
+#define getInputOrBlackboard(name, value) \
+ getInputPortOrBlackboard(*this, *(this->config().blackboard), name, value);
+
} // namespace BT
#endif // NAV2_BEHAVIOR_TREE__BT_UTILS_HPP_
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/controller_selector_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/controller_selector_node.hpp
index 968750a05e..625f7e9483 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/controller_selector_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/controller_selector_node.hpp
@@ -21,7 +21,7 @@
#include "std_msgs/msg/string.hpp"
-#include "behaviortree_cpp_v3/action_node.h"
+#include "behaviortree_cpp/action_node.h"
#include "rclcpp/rclcpp.hpp"
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/goal_checker_selector_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/goal_checker_selector_node.hpp
index 11f0d0f423..90a10f1675 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/goal_checker_selector_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/goal_checker_selector_node.hpp
@@ -21,7 +21,7 @@
#include "std_msgs/msg/string.hpp"
-#include "behaviortree_cpp_v3/action_node.h"
+#include "behaviortree_cpp/action_node.h"
#include "rclcpp/rclcpp.hpp"
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/planner_selector_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/planner_selector_node.hpp
index 3aa9e6573e..4a1dd779a3 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/planner_selector_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/planner_selector_node.hpp
@@ -21,7 +21,7 @@
#include "std_msgs/msg/string.hpp"
-#include "behaviortree_cpp_v3/action_node.h"
+#include "behaviortree_cpp/action_node.h"
#include "rclcpp/rclcpp.hpp"
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/progress_checker_selector_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/progress_checker_selector_node.hpp
index e996bda55b..c9c6115108 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/progress_checker_selector_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/progress_checker_selector_node.hpp
@@ -20,7 +20,7 @@
#include "std_msgs/msg/string.hpp"
-#include "behaviortree_cpp_v3/action_node.h"
+#include "behaviortree_cpp/action_node.h"
#include "rclcpp/rclcpp.hpp"
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/remove_passed_goals_action.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/remove_passed_goals_action.hpp
index d9b3d4a59c..344afd546d 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/remove_passed_goals_action.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/remove_passed_goals_action.hpp
@@ -22,7 +22,7 @@
#include "geometry_msgs/msg/pose_stamped.hpp"
#include "nav2_util/geometry_utils.hpp"
#include "nav2_util/robot_utils.hpp"
-#include "behaviortree_cpp_v3/action_node.h"
+#include "behaviortree_cpp/action_node.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/smoother_selector_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/smoother_selector_node.hpp
index f9bb293d26..da5a727444 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/smoother_selector_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/smoother_selector_node.hpp
@@ -21,7 +21,7 @@
#include "std_msgs/msg/string.hpp"
-#include "behaviortree_cpp_v3/action_node.h"
+#include "behaviortree_cpp/action_node.h"
#include "rclcpp/rclcpp.hpp"
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/truncate_path_action.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/truncate_path_action.hpp
index 2604bcfea1..5501d49cf3 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/truncate_path_action.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/truncate_path_action.hpp
@@ -21,7 +21,7 @@
#include "nav_msgs/msg/path.hpp"
-#include "behaviortree_cpp_v3/action_node.h"
+#include "behaviortree_cpp/action_node.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/truncate_path_local_action.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/truncate_path_local_action.hpp
index 113e0d83e7..94b4b66ca2 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/truncate_path_local_action.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/truncate_path_local_action.hpp
@@ -22,7 +22,7 @@
#include "nav_msgs/msg/path.hpp"
-#include "behaviortree_cpp_v3/action_node.h"
+#include "behaviortree_cpp/action_node.h"
#include "tf2_ros/buffer.h"
namespace nav2_behavior_tree
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/are_error_codes_present_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/are_error_codes_present_condition.hpp
index 42721f6266..209958c38d 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/are_error_codes_present_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/are_error_codes_present_condition.hpp
@@ -21,7 +21,7 @@
#include
#include "rclcpp/rclcpp.hpp"
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/distance_traveled_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/distance_traveled_condition.hpp
index 3c87c7370c..67747c62b8 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/distance_traveled_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/distance_traveled_condition.hpp
@@ -19,7 +19,7 @@
#include
#include
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
#include "rclcpp/rclcpp.hpp"
#include "geometry_msgs/msg/pose_stamped.hpp"
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/globally_updated_goal_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/globally_updated_goal_condition.hpp
index 64f77f1473..7e3e92e799 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/globally_updated_goal_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/globally_updated_goal_condition.hpp
@@ -20,7 +20,7 @@
#include "rclcpp/rclcpp.hpp"
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
#include "geometry_msgs/msg/pose_stamped.hpp"
@@ -57,7 +57,12 @@ class GloballyUpdatedGoalCondition : public BT::ConditionNode
*/
static BT::PortsList providedPorts()
{
- return {};
+ return {
+ BT::InputPort>(
+ "goals", "Vector of navigation goals"),
+ BT::InputPort(
+ "goal", "Navigation goal"),
+ };
}
private:
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/goal_reached_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/goal_reached_condition.hpp
index acbca8c960..b79fabe2f9 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/goal_reached_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/goal_reached_condition.hpp
@@ -19,7 +19,7 @@
#include
#include "rclcpp/rclcpp.hpp"
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
#include "tf2_ros/buffer.h"
namespace nav2_behavior_tree
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/goal_updated_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/goal_updated_condition.hpp
index 1e8c9712c1..89d4b7a573 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/goal_updated_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/goal_updated_condition.hpp
@@ -18,7 +18,7 @@
#include
#include
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
#include "geometry_msgs/msg/pose_stamped.hpp"
namespace nav2_behavior_tree
@@ -54,7 +54,12 @@ class GoalUpdatedCondition : public BT::ConditionNode
*/
static BT::PortsList providedPorts()
{
- return {};
+ return {
+ BT::InputPort>(
+ "goals", "Vector of navigation goals"),
+ BT::InputPort(
+ "goal", "Navigation goal"),
+ };
}
private:
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/initial_pose_received_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/initial_pose_received_condition.hpp
index 2bb7d995b8..548c15268b 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/initial_pose_received_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/initial_pose_received_condition.hpp
@@ -15,7 +15,8 @@
#ifndef NAV2_BEHAVIOR_TREE__PLUGINS__CONDITION__INITIAL_POSE_RECEIVED_CONDITION_HPP_
#define NAV2_BEHAVIOR_TREE__PLUGINS__CONDITION__INITIAL_POSE_RECEIVED_CONDITION_HPP_
-#include "behaviortree_cpp_v3/behavior_tree.h"
+#include
+#include "behaviortree_cpp/behavior_tree.h"
namespace nav2_behavior_tree
{
@@ -23,7 +24,21 @@ namespace nav2_behavior_tree
* @brief A BT::ConditionNode that returns SUCCESS if initial pose
* has been received and FAILURE otherwise
*/
-BT::NodeStatus initialPoseReceived(BT::TreeNode & tree_node);
-}
+class InitialPoseReceived : public BT::ConditionNode
+{
+public:
+ InitialPoseReceived(
+ const std::string & name,
+ const BT::NodeConfiguration & config);
+
+ static BT::PortsList providedPorts()
+ {
+ return {BT::InputPort("initial_pose_received")};
+ }
+
+ BT::NodeStatus tick() override;
+};
+
+} // namespace nav2_behavior_tree
#endif // NAV2_BEHAVIOR_TREE__PLUGINS__CONDITION__INITIAL_POSE_RECEIVED_CONDITION_HPP_
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_battery_charging_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_battery_charging_condition.hpp
index 37a53b41e1..704154a31d 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_battery_charging_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_battery_charging_condition.hpp
@@ -21,7 +21,7 @@
#include "rclcpp/rclcpp.hpp"
#include "sensor_msgs/msg/battery_state.hpp"
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_battery_low_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_battery_low_condition.hpp
index ff47910580..59a023ff3c 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_battery_low_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_battery_low_condition.hpp
@@ -22,7 +22,7 @@
#include "rclcpp/rclcpp.hpp"
#include "sensor_msgs/msg/battery_state.hpp"
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_path_valid_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_path_valid_condition.hpp
index 36890f2a8a..5a9f255a9b 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_path_valid_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_path_valid_condition.hpp
@@ -19,7 +19,7 @@
#include
#include "rclcpp/rclcpp.hpp"
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
#include "geometry_msgs/msg/pose_stamped.hpp"
#include "nav2_msgs/srv/is_path_valid.hpp"
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_stuck_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_stuck_condition.hpp
index 565f261100..e532822d42 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_stuck_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/is_stuck_condition.hpp
@@ -20,7 +20,7 @@
#include
#include "rclcpp/rclcpp.hpp"
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
#include "nav_msgs/msg/odometry.hpp"
namespace nav2_behavior_tree
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/path_expiring_timer_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/path_expiring_timer_condition.hpp
index fb2f42f3d4..8871892949 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/path_expiring_timer_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/path_expiring_timer_condition.hpp
@@ -18,7 +18,7 @@
#include
#include "rclcpp/rclcpp.hpp"
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
#include "nav_msgs/msg/path.hpp"
namespace nav2_behavior_tree
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/time_expired_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/time_expired_condition.hpp
index 356a79857d..26a3431b5d 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/time_expired_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/time_expired_condition.hpp
@@ -19,7 +19,7 @@
#include
#include "rclcpp/rclcpp.hpp"
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/transform_available_condition.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/transform_available_condition.hpp
index 5fdefa9b8b..511c381321 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/transform_available_condition.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/transform_available_condition.hpp
@@ -20,7 +20,7 @@
#include
#include "rclcpp/rclcpp.hpp"
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
#include "tf2_ros/buffer.h"
namespace nav2_behavior_tree
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/pipeline_sequence.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/pipeline_sequence.hpp
index 0384381d2a..ce3406904f 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/pipeline_sequence.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/pipeline_sequence.hpp
@@ -16,8 +16,8 @@
#define NAV2_BEHAVIOR_TREE__PLUGINS__CONTROL__PIPELINE_SEQUENCE_HPP_
#include
-#include "behaviortree_cpp_v3/control_node.h"
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/control_node.h"
+#include "behaviortree_cpp/bt_factory.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/recovery_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/recovery_node.hpp
index 89c0cfa300..62759ea711 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/recovery_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/recovery_node.hpp
@@ -16,7 +16,7 @@
#define NAV2_BEHAVIOR_TREE__PLUGINS__CONTROL__RECOVERY_NODE_HPP_
#include
-#include "behaviortree_cpp_v3/control_node.h"
+#include "behaviortree_cpp/control_node.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/round_robin_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/round_robin_node.hpp
index 8c374ce6af..86f2b38c5b 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/round_robin_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/control/round_robin_node.hpp
@@ -17,8 +17,8 @@
#include
-#include "behaviortree_cpp_v3/control_node.h"
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/control_node.h"
+#include "behaviortree_cpp/bt_factory.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/distance_controller.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/distance_controller.hpp
index f85a3975d0..7fbda19c63 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/distance_controller.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/distance_controller.hpp
@@ -22,7 +22,7 @@
#include "geometry_msgs/msg/pose_stamped.hpp"
#include "tf2_ros/buffer.h"
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/goal_updated_controller.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/goal_updated_controller.hpp
index 4ac0ab44ee..bdd4171185 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/goal_updated_controller.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/goal_updated_controller.hpp
@@ -19,7 +19,7 @@
#include
#include
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
#include "rclcpp/rclcpp.hpp"
#include "geometry_msgs/msg/pose_stamped.hpp"
@@ -48,7 +48,12 @@ class GoalUpdatedController : public BT::DecoratorNode
*/
static BT::PortsList providedPorts()
{
- return {};
+ return {
+ BT::InputPort>(
+ "goals", "Vector of navigation goals"),
+ BT::InputPort(
+ "goal", "Navigation goal"),
+ };
}
private:
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/goal_updater_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/goal_updater_node.hpp
index 49dfbc1a0c..ddce12cf02 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/goal_updater_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/goal_updater_node.hpp
@@ -21,7 +21,7 @@
#include "geometry_msgs/msg/pose_stamped.hpp"
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
#include "rclcpp/rclcpp.hpp"
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/path_longer_on_approach.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/path_longer_on_approach.hpp
index 6e41516434..bdf4a080d1 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/path_longer_on_approach.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/path_longer_on_approach.hpp
@@ -21,7 +21,7 @@
#include "geometry_msgs/msg/pose_stamped.hpp"
#include "nav_msgs/msg/path.hpp"
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
#include "rclcpp/rclcpp.hpp"
namespace nav2_behavior_tree
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/rate_controller.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/rate_controller.hpp
index 24a0207e3b..c390357b34 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/rate_controller.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/rate_controller.hpp
@@ -18,7 +18,7 @@
#include
#include
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/single_trigger_node.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/single_trigger_node.hpp
index c16ef63efa..02c0c1812e 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/single_trigger_node.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/single_trigger_node.hpp
@@ -18,7 +18,7 @@
#include
#include
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
namespace nav2_behavior_tree
{
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/speed_controller.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/speed_controller.hpp
index 8150eb3109..ed454c0aa1 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/speed_controller.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/decorator/speed_controller.hpp
@@ -24,7 +24,7 @@
#include "nav_msgs/msg/odometry.hpp"
#include "nav2_util/odometry_utils.hpp"
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
namespace nav2_behavior_tree
{
@@ -57,6 +57,10 @@ class SpeedController : public BT::DecoratorNode
BT::InputPort("max_rate", 1.0, "Maximum rate"),
BT::InputPort("min_speed", 0.0, "Minimum speed"),
BT::InputPort("max_speed", 0.5, "Maximum speed"),
+ BT::InputPort>(
+ "goals", "Vector of navigation goals"),
+ BT::InputPort(
+ "goal", "Navigation goal"),
};
}
diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/ros_topic_logger.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/ros_topic_logger.hpp
index 0e14a59ee8..d1ccef107e 100644
--- a/nav2_behavior_tree/include/nav2_behavior_tree/ros_topic_logger.hpp
+++ b/nav2_behavior_tree/include/nav2_behavior_tree/ros_topic_logger.hpp
@@ -19,7 +19,7 @@
#include
#include
-#include "behaviortree_cpp_v3/loggers/abstract_logger.h"
+#include "behaviortree_cpp/loggers/abstract_logger.h"
#include "rclcpp/rclcpp.hpp"
#include "nav2_msgs/msg/behavior_tree_log.hpp"
#include "nav2_msgs/msg/behavior_tree_status_change.h"
diff --git a/nav2_behavior_tree/nav2_tree_nodes.xml b/nav2_behavior_tree/nav2_tree_nodes.xml
index 3e23aafbd0..925e9c3579 100644
--- a/nav2_behavior_tree/nav2_tree_nodes.xml
+++ b/nav2_behavior_tree/nav2_tree_nodes.xml
@@ -4,7 +4,7 @@
please refer to the groot_instructions.md and REAMDE.md respectively located in the
nav2_behavior_tree package.
-->
-
+
@@ -224,9 +224,15 @@
Parent frame for transform
-
+
+ Vector of navigation goals
+ Navigation goal
+
-
+
+ Vector of navigation goals
+ Navigation goal
+
Min battery % or voltage before triggering
@@ -255,6 +261,7 @@
+ SUCCESS if initial_pose_received true
@@ -313,6 +320,8 @@
Maximum rate
Minimum speed
Maximum speed
+ Vector of navigation goals
+ Navigation goal
@@ -322,6 +331,8 @@
+ Vector of navigation goals
+ Navigation goal
diff --git a/nav2_behavior_tree/package.xml b/nav2_behavior_tree/package.xml
index 797d53270b..b9ed847ce3 100644
--- a/nav2_behavior_tree/package.xml
+++ b/nav2_behavior_tree/package.xml
@@ -17,7 +17,7 @@
rclcpp
rclcpp_action
rclcpp_lifecycle
- behaviortree_cpp_v3
+ behaviortree_cpp
builtin_interfaces
geometry_msgs
sensor_msgs
@@ -36,7 +36,7 @@
rclcpp_action
rclcpp_lifecycle
std_msgs
- behaviortree_cpp_v3
+ behaviortree_cpp
builtin_interfaces
geometry_msgs
sensor_msgs
diff --git a/nav2_behavior_tree/plugins/action/assisted_teleop_action.cpp b/nav2_behavior_tree/plugins/action/assisted_teleop_action.cpp
index 64eb61d788..e876d2ce40 100644
--- a/nav2_behavior_tree/plugins/action/assisted_teleop_action.cpp
+++ b/nav2_behavior_tree/plugins/action/assisted_teleop_action.cpp
@@ -70,7 +70,7 @@ BT::NodeStatus AssistedTeleopAction::on_cancelled()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/assisted_teleop_cancel_node.cpp b/nav2_behavior_tree/plugins/action/assisted_teleop_cancel_node.cpp
index e226ba1975..362499c9f2 100644
--- a/nav2_behavior_tree/plugins/action/assisted_teleop_cancel_node.cpp
+++ b/nav2_behavior_tree/plugins/action/assisted_teleop_cancel_node.cpp
@@ -32,7 +32,7 @@ AssistedTeleopCancel::AssistedTeleopCancel(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/back_up_action.cpp b/nav2_behavior_tree/plugins/action/back_up_action.cpp
index 09d79c7e23..e17580fe71 100644
--- a/nav2_behavior_tree/plugins/action/back_up_action.cpp
+++ b/nav2_behavior_tree/plugins/action/back_up_action.cpp
@@ -76,7 +76,7 @@ BT::NodeStatus BackUpAction::on_cancelled()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/back_up_cancel_node.cpp b/nav2_behavior_tree/plugins/action/back_up_cancel_node.cpp
index 3baa1ffb1e..21835c326a 100644
--- a/nav2_behavior_tree/plugins/action/back_up_cancel_node.cpp
+++ b/nav2_behavior_tree/plugins/action/back_up_cancel_node.cpp
@@ -32,7 +32,7 @@ BackUpCancel::BackUpCancel(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/clear_costmap_service.cpp b/nav2_behavior_tree/plugins/action/clear_costmap_service.cpp
index 08d2b00632..2d007a6623 100644
--- a/nav2_behavior_tree/plugins/action/clear_costmap_service.cpp
+++ b/nav2_behavior_tree/plugins/action/clear_costmap_service.cpp
@@ -60,7 +60,7 @@ void ClearCostmapAroundRobotService::on_tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("ClearEntireCostmap");
diff --git a/nav2_behavior_tree/plugins/action/compute_path_through_poses_action.cpp b/nav2_behavior_tree/plugins/action/compute_path_through_poses_action.cpp
index 8bfffed843..a0572ecad6 100644
--- a/nav2_behavior_tree/plugins/action/compute_path_through_poses_action.cpp
+++ b/nav2_behavior_tree/plugins/action/compute_path_through_poses_action.cpp
@@ -65,7 +65,7 @@ BT::NodeStatus ComputePathThroughPosesAction::on_cancelled()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/compute_path_to_pose_action.cpp b/nav2_behavior_tree/plugins/action/compute_path_to_pose_action.cpp
index c4b93afa85..c7f1a0164e 100644
--- a/nav2_behavior_tree/plugins/action/compute_path_to_pose_action.cpp
+++ b/nav2_behavior_tree/plugins/action/compute_path_to_pose_action.cpp
@@ -71,7 +71,7 @@ void ComputePathToPoseAction::halt()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/controller_cancel_node.cpp b/nav2_behavior_tree/plugins/action/controller_cancel_node.cpp
index 966ee01e10..b2eb4358c2 100644
--- a/nav2_behavior_tree/plugins/action/controller_cancel_node.cpp
+++ b/nav2_behavior_tree/plugins/action/controller_cancel_node.cpp
@@ -32,7 +32,7 @@ ControllerCancel::ControllerCancel(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/controller_selector_node.cpp b/nav2_behavior_tree/plugins/action/controller_selector_node.cpp
index 7d77adbee3..b58d78bb78 100644
--- a/nav2_behavior_tree/plugins/action/controller_selector_node.cpp
+++ b/nav2_behavior_tree/plugins/action/controller_selector_node.cpp
@@ -84,7 +84,7 @@ ControllerSelector::callbackControllerSelect(const std_msgs::msg::String::Shared
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("ControllerSelector");
diff --git a/nav2_behavior_tree/plugins/action/drive_on_heading_action.cpp b/nav2_behavior_tree/plugins/action/drive_on_heading_action.cpp
index 7e0b613f62..03c0034414 100644
--- a/nav2_behavior_tree/plugins/action/drive_on_heading_action.cpp
+++ b/nav2_behavior_tree/plugins/action/drive_on_heading_action.cpp
@@ -74,7 +74,7 @@ BT::NodeStatus DriveOnHeadingAction::on_cancelled()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/drive_on_heading_cancel_node.cpp b/nav2_behavior_tree/plugins/action/drive_on_heading_cancel_node.cpp
index b29de63df5..8ac530f8df 100644
--- a/nav2_behavior_tree/plugins/action/drive_on_heading_cancel_node.cpp
+++ b/nav2_behavior_tree/plugins/action/drive_on_heading_cancel_node.cpp
@@ -32,7 +32,7 @@ DriveOnHeadingCancel::DriveOnHeadingCancel(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/follow_path_action.cpp b/nav2_behavior_tree/plugins/action/follow_path_action.cpp
index 00acf5c349..b662221de0 100644
--- a/nav2_behavior_tree/plugins/action/follow_path_action.cpp
+++ b/nav2_behavior_tree/plugins/action/follow_path_action.cpp
@@ -96,7 +96,7 @@ void FollowPathAction::on_wait_for_result(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/goal_checker_selector_node.cpp b/nav2_behavior_tree/plugins/action/goal_checker_selector_node.cpp
index 1a2e9c703b..3ee9d83260 100644
--- a/nav2_behavior_tree/plugins/action/goal_checker_selector_node.cpp
+++ b/nav2_behavior_tree/plugins/action/goal_checker_selector_node.cpp
@@ -75,7 +75,7 @@ GoalCheckerSelector::callbackGoalCheckerSelect(const std_msgs::msg::String::Shar
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("GoalCheckerSelector");
diff --git a/nav2_behavior_tree/plugins/action/navigate_through_poses_action.cpp b/nav2_behavior_tree/plugins/action/navigate_through_poses_action.cpp
index 57db894248..9213cd564f 100644
--- a/nav2_behavior_tree/plugins/action/navigate_through_poses_action.cpp
+++ b/nav2_behavior_tree/plugins/action/navigate_through_poses_action.cpp
@@ -61,7 +61,7 @@ BT::NodeStatus NavigateThroughPosesAction::on_cancelled()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/navigate_to_pose_action.cpp b/nav2_behavior_tree/plugins/action/navigate_to_pose_action.cpp
index 8022697e0e..07bea22436 100644
--- a/nav2_behavior_tree/plugins/action/navigate_to_pose_action.cpp
+++ b/nav2_behavior_tree/plugins/action/navigate_to_pose_action.cpp
@@ -59,7 +59,7 @@ BT::NodeStatus NavigateToPoseAction::on_cancelled()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/planner_selector_node.cpp b/nav2_behavior_tree/plugins/action/planner_selector_node.cpp
index ccb8518412..5d0610c0fa 100644
--- a/nav2_behavior_tree/plugins/action/planner_selector_node.cpp
+++ b/nav2_behavior_tree/plugins/action/planner_selector_node.cpp
@@ -84,7 +84,7 @@ PlannerSelector::callbackPlannerSelect(const std_msgs::msg::String::SharedPtr ms
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("PlannerSelector");
diff --git a/nav2_behavior_tree/plugins/action/progress_checker_selector_node.cpp b/nav2_behavior_tree/plugins/action/progress_checker_selector_node.cpp
index e8c418ddc1..fea2194158 100644
--- a/nav2_behavior_tree/plugins/action/progress_checker_selector_node.cpp
+++ b/nav2_behavior_tree/plugins/action/progress_checker_selector_node.cpp
@@ -74,7 +74,7 @@ ProgressCheckerSelector::callbackProgressCheckerSelect(const std_msgs::msg::Stri
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("ProgressCheckerSelector");
diff --git a/nav2_behavior_tree/plugins/action/reinitialize_global_localization_service.cpp b/nav2_behavior_tree/plugins/action/reinitialize_global_localization_service.cpp
index 388f16ccb2..30b876d534 100644
--- a/nav2_behavior_tree/plugins/action/reinitialize_global_localization_service.cpp
+++ b/nav2_behavior_tree/plugins/action/reinitialize_global_localization_service.cpp
@@ -26,7 +26,7 @@ ReinitializeGlobalLocalizationService::ReinitializeGlobalLocalizationService(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType(
diff --git a/nav2_behavior_tree/plugins/action/remove_passed_goals_action.cpp b/nav2_behavior_tree/plugins/action/remove_passed_goals_action.cpp
index bf8b95c84f..86f5fffd6b 100644
--- a/nav2_behavior_tree/plugins/action/remove_passed_goals_action.cpp
+++ b/nav2_behavior_tree/plugins/action/remove_passed_goals_action.cpp
@@ -41,7 +41,7 @@ void RemovePassedGoals::initialize()
auto node = config().blackboard->get("node");
node->get_parameter("transform_tolerance", transform_tolerance_);
- robot_base_frame_ = BT::deconflictPortAndParamFrame(
+ robot_base_frame_ = BT::deconflictPortAndParamFrame(
node, "robot_base_frame", this);
}
@@ -89,7 +89,7 @@ inline BT::NodeStatus RemovePassedGoals::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("RemovePassedGoals");
diff --git a/nav2_behavior_tree/plugins/action/smooth_path_action.cpp b/nav2_behavior_tree/plugins/action/smooth_path_action.cpp
index da547b1587..3a67904558 100644
--- a/nav2_behavior_tree/plugins/action/smooth_path_action.cpp
+++ b/nav2_behavior_tree/plugins/action/smooth_path_action.cpp
@@ -64,7 +64,7 @@ BT::NodeStatus SmoothPathAction::on_cancelled()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/smoother_selector_node.cpp b/nav2_behavior_tree/plugins/action/smoother_selector_node.cpp
index 0a84062e08..c717332c79 100644
--- a/nav2_behavior_tree/plugins/action/smoother_selector_node.cpp
+++ b/nav2_behavior_tree/plugins/action/smoother_selector_node.cpp
@@ -85,7 +85,7 @@ SmootherSelector::callbackSmootherSelect(const std_msgs::msg::String::SharedPtr
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("SmootherSelector");
diff --git a/nav2_behavior_tree/plugins/action/spin_action.cpp b/nav2_behavior_tree/plugins/action/spin_action.cpp
index cab9c8f821..d10bb83f32 100644
--- a/nav2_behavior_tree/plugins/action/spin_action.cpp
+++ b/nav2_behavior_tree/plugins/action/spin_action.cpp
@@ -72,7 +72,7 @@ BT::NodeStatus SpinAction::on_cancelled()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/spin_cancel_node.cpp b/nav2_behavior_tree/plugins/action/spin_cancel_node.cpp
index 62ddbc4719..1d75c5cf27 100644
--- a/nav2_behavior_tree/plugins/action/spin_cancel_node.cpp
+++ b/nav2_behavior_tree/plugins/action/spin_cancel_node.cpp
@@ -32,7 +32,7 @@ SpinCancel::SpinCancel(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/truncate_path_action.cpp b/nav2_behavior_tree/plugins/action/truncate_path_action.cpp
index b394a804c7..7bebfbfba3 100644
--- a/nav2_behavior_tree/plugins/action/truncate_path_action.cpp
+++ b/nav2_behavior_tree/plugins/action/truncate_path_action.cpp
@@ -20,7 +20,7 @@
#include "nav_msgs/msg/path.hpp"
#include "geometry_msgs/msg/pose_stamped.hpp"
#include "nav2_util/geometry_utils.hpp"
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
#include "nav2_behavior_tree/plugins/action/truncate_path_action.hpp"
@@ -82,7 +82,7 @@ inline BT::NodeStatus TruncatePath::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("TruncatePath");
diff --git a/nav2_behavior_tree/plugins/action/truncate_path_local_action.cpp b/nav2_behavior_tree/plugins/action/truncate_path_local_action.cpp
index 934f2b86bb..35dc8635c8 100644
--- a/nav2_behavior_tree/plugins/action/truncate_path_local_action.cpp
+++ b/nav2_behavior_tree/plugins/action/truncate_path_local_action.cpp
@@ -17,7 +17,7 @@
#include
#include
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
#include "geometry_msgs/msg/pose_stamped.hpp"
#include "nav2_util/geometry_utils.hpp"
#include "nav2_util/robot_utils.hpp"
@@ -150,7 +150,7 @@ TruncatePathLocal::poseDistance(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory) {
factory.registerNodeType(
"TruncatePathLocal");
diff --git a/nav2_behavior_tree/plugins/action/wait_action.cpp b/nav2_behavior_tree/plugins/action/wait_action.cpp
index b931707673..b607d026e5 100644
--- a/nav2_behavior_tree/plugins/action/wait_action.cpp
+++ b/nav2_behavior_tree/plugins/action/wait_action.cpp
@@ -56,7 +56,7 @@ void WaitAction::on_tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/action/wait_cancel_node.cpp b/nav2_behavior_tree/plugins/action/wait_cancel_node.cpp
index 9365b7e06f..b45db33396 100644
--- a/nav2_behavior_tree/plugins/action/wait_cancel_node.cpp
+++ b/nav2_behavior_tree/plugins/action/wait_cancel_node.cpp
@@ -32,7 +32,7 @@ WaitCancel::WaitCancel(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
BT::NodeBuilder builder =
diff --git a/nav2_behavior_tree/plugins/condition/are_error_codes_present_condition.cpp b/nav2_behavior_tree/plugins/condition/are_error_codes_present_condition.cpp
index 6764cccd11..f39dd8fbce 100644
--- a/nav2_behavior_tree/plugins/condition/are_error_codes_present_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/are_error_codes_present_condition.cpp
@@ -14,7 +14,7 @@
#include "nav2_behavior_tree/plugins/condition/are_error_codes_present_condition.hpp"
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType(
diff --git a/nav2_behavior_tree/plugins/condition/distance_traveled_condition.cpp b/nav2_behavior_tree/plugins/condition/distance_traveled_condition.cpp
index 64394ee378..7db1817c65 100644
--- a/nav2_behavior_tree/plugins/condition/distance_traveled_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/distance_traveled_condition.cpp
@@ -43,9 +43,9 @@ void DistanceTraveledCondition::initialize()
tf_ = config().blackboard->get>("tf_buffer");
node_->get_parameter("transform_tolerance", transform_tolerance_);
- global_frame_ = BT::deconflictPortAndParamFrame(
+ global_frame_ = BT::deconflictPortAndParamFrame(
node_, "global_frame", this);
- robot_base_frame_ = BT::deconflictPortAndParamFrame(
+ robot_base_frame_ = BT::deconflictPortAndParamFrame(
node_, "robot_base_frame", this);
initialized_ = true;
}
@@ -56,7 +56,7 @@ BT::NodeStatus DistanceTraveledCondition::tick()
initialize();
}
- if (status() == BT::NodeStatus::IDLE) {
+ if (!BT::isStatusActive(status())) {
if (!nav2_util::getCurrentPose(
start_pose_, *tf_, global_frame_, robot_base_frame_,
transform_tolerance_))
@@ -92,7 +92,7 @@ BT::NodeStatus DistanceTraveledCondition::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("DistanceTraveled");
diff --git a/nav2_behavior_tree/plugins/condition/globally_updated_goal_condition.cpp b/nav2_behavior_tree/plugins/condition/globally_updated_goal_condition.cpp
index fee838c937..dbd84d8b2e 100644
--- a/nav2_behavior_tree/plugins/condition/globally_updated_goal_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/globally_updated_goal_condition.cpp
@@ -16,6 +16,7 @@
#include
#include "nav2_behavior_tree/plugins/condition/globally_updated_goal_condition.hpp"
+#include "nav2_behavior_tree/bt_utils.hpp"
namespace nav2_behavior_tree
{
@@ -33,15 +34,15 @@ BT::NodeStatus GloballyUpdatedGoalCondition::tick()
{
if (first_time) {
first_time = false;
- config().blackboard->get>("goals", goals_);
- config().blackboard->get("goal", goal_);
+ BT::getInputOrBlackboard("goals", goals_);
+ BT::getInputOrBlackboard("goal", goal_);
return BT::NodeStatus::SUCCESS;
}
std::vector current_goals;
- config().blackboard->get>("goals", current_goals);
+ BT::getInputOrBlackboard("goals", current_goals);
geometry_msgs::msg::PoseStamped current_goal;
- config().blackboard->get("goal", current_goal);
+ BT::getInputOrBlackboard("goal", current_goal);
if (goal_ != current_goal || goals_ != current_goals) {
goal_ = current_goal;
@@ -54,7 +55,7 @@ BT::NodeStatus GloballyUpdatedGoalCondition::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("GlobalUpdatedGoal");
diff --git a/nav2_behavior_tree/plugins/condition/goal_reached_condition.cpp b/nav2_behavior_tree/plugins/condition/goal_reached_condition.cpp
index 2697680415..7024356203 100644
--- a/nav2_behavior_tree/plugins/condition/goal_reached_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/goal_reached_condition.cpp
@@ -33,7 +33,7 @@ GoalReachedCondition::GoalReachedCondition(
{
auto node = config().blackboard->get("node");
- robot_base_frame_ = BT::deconflictPortAndParamFrame(
+ robot_base_frame_ = BT::deconflictPortAndParamFrame(
node, "robot_base_frame", this);
}
@@ -90,7 +90,7 @@ bool GoalReachedCondition::isGoalReached()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("GoalReached");
diff --git a/nav2_behavior_tree/plugins/condition/goal_updated_condition.cpp b/nav2_behavior_tree/plugins/condition/goal_updated_condition.cpp
index 34930bb582..88d329efc2 100644
--- a/nav2_behavior_tree/plugins/condition/goal_updated_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/goal_updated_condition.cpp
@@ -15,6 +15,7 @@
#include
#include
#include "nav2_behavior_tree/plugins/condition/goal_updated_condition.hpp"
+#include "nav2_behavior_tree/bt_utils.hpp"
namespace nav2_behavior_tree
{
@@ -27,16 +28,16 @@ GoalUpdatedCondition::GoalUpdatedCondition(
BT::NodeStatus GoalUpdatedCondition::tick()
{
- if (status() == BT::NodeStatus::IDLE) {
- config().blackboard->get>("goals", goals_);
- config().blackboard->get("goal", goal_);
+ if (!BT::isStatusActive(status())) {
+ BT::getInputOrBlackboard("goals", goals_);
+ BT::getInputOrBlackboard("goal", goal_);
return BT::NodeStatus::FAILURE;
}
std::vector current_goals;
- config().blackboard->get>("goals", current_goals);
geometry_msgs::msg::PoseStamped current_goal;
- config().blackboard->get("goal", current_goal);
+ BT::getInputOrBlackboard("goals", current_goals);
+ BT::getInputOrBlackboard("goal", current_goal);
if (goal_ != current_goal || goals_ != current_goals) {
goal_ = current_goal;
@@ -49,7 +50,7 @@ BT::NodeStatus GoalUpdatedCondition::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("GoalUpdated");
diff --git a/nav2_behavior_tree/plugins/condition/initial_pose_received_condition.cpp b/nav2_behavior_tree/plugins/condition/initial_pose_received_condition.cpp
index 41796834c6..9d93022912 100644
--- a/nav2_behavior_tree/plugins/condition/initial_pose_received_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/initial_pose_received_condition.cpp
@@ -13,22 +13,28 @@
// limitations under the License.
#include "nav2_behavior_tree/plugins/condition/initial_pose_received_condition.hpp"
+#include "nav2_behavior_tree/bt_utils.hpp"
namespace nav2_behavior_tree
{
+InitialPoseReceived::InitialPoseReceived(
+ const std::string & name,
+ const BT::NodeConfiguration & config)
+: BT::ConditionNode(name, config)
+{
+}
-BT::NodeStatus initialPoseReceived(BT::TreeNode & tree_node)
+BT::NodeStatus InitialPoseReceived::tick()
{
- auto initPoseReceived = tree_node.config().blackboard->get("initial_pose_received");
+ bool initPoseReceived = false;
+ BT::getInputOrBlackboard("initial_pose_received", initPoseReceived);
return initPoseReceived ? BT::NodeStatus::SUCCESS : BT::NodeStatus::FAILURE;
}
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
- factory.registerSimpleCondition(
- "InitialPoseReceived",
- std::bind(&nav2_behavior_tree::initialPoseReceived, std::placeholders::_1));
+ factory.registerNodeType("InitialPoseReceived");
}
diff --git a/nav2_behavior_tree/plugins/condition/is_battery_charging_condition.cpp b/nav2_behavior_tree/plugins/condition/is_battery_charging_condition.cpp
index c9c05f6875..27e1bd55fc 100644
--- a/nav2_behavior_tree/plugins/condition/is_battery_charging_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/is_battery_charging_condition.cpp
@@ -59,7 +59,7 @@ void IsBatteryChargingCondition::batteryCallback(sensor_msgs::msg::BatteryState:
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("IsBatteryCharging");
diff --git a/nav2_behavior_tree/plugins/condition/is_battery_low_condition.cpp b/nav2_behavior_tree/plugins/condition/is_battery_low_condition.cpp
index 9d221cf8c8..a0e3761f28 100644
--- a/nav2_behavior_tree/plugins/condition/is_battery_low_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/is_battery_low_condition.cpp
@@ -77,7 +77,7 @@ void IsBatteryLowCondition::batteryCallback(sensor_msgs::msg::BatteryState::Shar
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("IsBatteryLow");
diff --git a/nav2_behavior_tree/plugins/condition/is_path_valid_condition.cpp b/nav2_behavior_tree/plugins/condition/is_path_valid_condition.cpp
index 59d593a147..7274743e1e 100644
--- a/nav2_behavior_tree/plugins/condition/is_path_valid_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/is_path_valid_condition.cpp
@@ -64,7 +64,7 @@ BT::NodeStatus IsPathValidCondition::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("IsPathValid");
diff --git a/nav2_behavior_tree/plugins/condition/is_stuck_condition.cpp b/nav2_behavior_tree/plugins/condition/is_stuck_condition.cpp
index a898dec947..d0ca48cd7f 100644
--- a/nav2_behavior_tree/plugins/condition/is_stuck_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/is_stuck_condition.cpp
@@ -143,7 +143,7 @@ bool IsStuckCondition::isStuck()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("IsStuck");
diff --git a/nav2_behavior_tree/plugins/condition/path_expiring_timer_condition.cpp b/nav2_behavior_tree/plugins/condition/path_expiring_timer_condition.cpp
index 1347998602..540af1d83d 100644
--- a/nav2_behavior_tree/plugins/condition/path_expiring_timer_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/path_expiring_timer_condition.cpp
@@ -15,7 +15,7 @@
#include
#include
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
#include "nav2_behavior_tree/plugins/condition/path_expiring_timer_condition.hpp"
@@ -68,7 +68,7 @@ BT::NodeStatus PathExpiringTimerCondition::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("PathExpiringTimer");
diff --git a/nav2_behavior_tree/plugins/condition/time_expired_condition.cpp b/nav2_behavior_tree/plugins/condition/time_expired_condition.cpp
index 64afd1a34b..f03c9711aa 100644
--- a/nav2_behavior_tree/plugins/condition/time_expired_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/time_expired_condition.cpp
@@ -16,7 +16,7 @@
#include
#include
-#include "behaviortree_cpp_v3/condition_node.h"
+#include "behaviortree_cpp/condition_node.h"
#include "nav2_behavior_tree/plugins/condition/time_expired_condition.hpp"
@@ -46,7 +46,7 @@ BT::NodeStatus TimeExpiredCondition::tick()
initialize();
}
- if (status() == BT::NodeStatus::IDLE) {
+ if (!BT::isStatusActive(status())) {
start_ = node_->now();
return BT::NodeStatus::FAILURE;
}
@@ -67,7 +67,7 @@ BT::NodeStatus TimeExpiredCondition::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("TimeExpired");
diff --git a/nav2_behavior_tree/plugins/condition/transform_available_condition.cpp b/nav2_behavior_tree/plugins/condition/transform_available_condition.cpp
index 33e94178de..0ee491fbfd 100644
--- a/nav2_behavior_tree/plugins/condition/transform_available_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/transform_available_condition.cpp
@@ -83,7 +83,7 @@ BT::NodeStatus TransformAvailableCondition::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("TransformAvailable");
diff --git a/nav2_behavior_tree/plugins/condition/would_a_controller_recovery_help_condition.cpp b/nav2_behavior_tree/plugins/condition/would_a_controller_recovery_help_condition.cpp
index f8c62064f6..87625d4511 100644
--- a/nav2_behavior_tree/plugins/condition/would_a_controller_recovery_help_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/would_a_controller_recovery_help_condition.cpp
@@ -33,7 +33,7 @@ WouldAControllerRecoveryHelp::WouldAControllerRecoveryHelp(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType(
diff --git a/nav2_behavior_tree/plugins/condition/would_a_planner_recovery_help_condition.cpp b/nav2_behavior_tree/plugins/condition/would_a_planner_recovery_help_condition.cpp
index 91de9c2e22..603eb60f10 100644
--- a/nav2_behavior_tree/plugins/condition/would_a_planner_recovery_help_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/would_a_planner_recovery_help_condition.cpp
@@ -35,7 +35,7 @@ WouldAPlannerRecoveryHelp::WouldAPlannerRecoveryHelp(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType(
diff --git a/nav2_behavior_tree/plugins/condition/would_a_smoother_recovery_help_condition.cpp b/nav2_behavior_tree/plugins/condition/would_a_smoother_recovery_help_condition.cpp
index fb903e1cbf..50665256c2 100644
--- a/nav2_behavior_tree/plugins/condition/would_a_smoother_recovery_help_condition.cpp
+++ b/nav2_behavior_tree/plugins/condition/would_a_smoother_recovery_help_condition.cpp
@@ -33,7 +33,7 @@ WouldASmootherRecoveryHelp::WouldASmootherRecoveryHelp(
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType(
diff --git a/nav2_behavior_tree/plugins/control/pipeline_sequence.cpp b/nav2_behavior_tree/plugins/control/pipeline_sequence.cpp
index 640c3ed7b4..bc2327af28 100644
--- a/nav2_behavior_tree/plugins/control/pipeline_sequence.cpp
+++ b/nav2_behavior_tree/plugins/control/pipeline_sequence.cpp
@@ -35,6 +35,7 @@ PipelineSequence::PipelineSequence(
BT::NodeStatus PipelineSequence::tick()
{
+ unsigned skipped_count = 0;
for (std::size_t i = 0; i < children_nodes_.size(); ++i) {
auto status = children_nodes_[i]->executeTick();
switch (status) {
@@ -42,6 +43,10 @@ BT::NodeStatus PipelineSequence::tick()
ControlNode::haltChildren();
last_child_ticked_ = 0; // reset
return status;
+ case BT::NodeStatus::SKIPPED:
+ skipped_count++;
+ // do nothing and continue on to the next child.
+ break;
case BT::NodeStatus::SUCCESS:
// do nothing and continue on to the next child. If it is the last child
// we'll exit the loop and hit the wrap-up code at the end of the method.
@@ -63,6 +68,10 @@ BT::NodeStatus PipelineSequence::tick()
// Wrap up.
ControlNode::haltChildren();
last_child_ticked_ = 0; // reset
+ if (skipped_count == children_nodes_.size()) {
+ // All the children were skipped
+ return BT::NodeStatus::SKIPPED;
+ }
return BT::NodeStatus::SUCCESS;
}
diff --git a/nav2_behavior_tree/plugins/control/recovery_node.cpp b/nav2_behavior_tree/plugins/control/recovery_node.cpp
index 44e56dc55e..6eb3c6e99e 100644
--- a/nav2_behavior_tree/plugins/control/recovery_node.cpp
+++ b/nav2_behavior_tree/plugins/control/recovery_node.cpp
@@ -45,12 +45,18 @@ BT::NodeStatus RecoveryNode::tick()
if (current_child_idx_ == 0) {
switch (child_status) {
+ case BT::NodeStatus::SKIPPED:
+ // If first child is skipped, the entire branch is considered skipped
+ halt();
+ return BT::NodeStatus::SKIPPED;
+
case BT::NodeStatus::SUCCESS:
- {
- // reset node and return success when first child returns success
- halt();
- return BT::NodeStatus::SUCCESS;
- }
+ // reset node and return success when first child returns success
+ halt();
+ return BT::NodeStatus::SUCCESS;
+
+ case BT::NodeStatus::RUNNING:
+ return BT::NodeStatus::RUNNING;
case BT::NodeStatus::FAILURE:
{
@@ -66,44 +72,41 @@ BT::NodeStatus RecoveryNode::tick()
}
}
- case BT::NodeStatus::RUNNING:
- {
- return BT::NodeStatus::RUNNING;
- }
-
default:
- {
- throw BT::LogicError("A child node must never return IDLE");
- }
+ throw BT::LogicError("A child node must never return IDLE");
} // end switch
} else if (current_child_idx_ == 1) {
switch (child_status) {
+ case BT::NodeStatus::SKIPPED:
+ {
+ // if we skip the recovery (maybe a precondition fails), then we
+ // should assume that no recovery is possible. For this reason,
+ // we should return FAILURE and reset the index.
+ // This does not count as a retry.
+ current_child_idx_ = 0;
+ ControlNode::haltChild(1);
+ return BT::NodeStatus::FAILURE;
+ }
+ case BT::NodeStatus::RUNNING:
+ return child_status;
+
case BT::NodeStatus::SUCCESS:
{
// halt second child, increment recovery count, and tick first child in next iteration
ControlNode::haltChild(1);
retry_count_++;
- current_child_idx_--;
+ current_child_idx_ = 0;
}
break;
case BT::NodeStatus::FAILURE:
- {
- // reset node and return failure if second child fails
- halt();
- return BT::NodeStatus::FAILURE;
- }
-
- case BT::NodeStatus::RUNNING:
- {
- return BT::NodeStatus::RUNNING;
- }
+ // reset node and return failure if second child fails
+ halt();
+ return BT::NodeStatus::FAILURE;
default:
- {
- throw BT::LogicError("A child node must never return IDLE");
- }
+ throw BT::LogicError("A child node must never return IDLE");
} // end switch
}
} // end while loop
@@ -122,7 +125,7 @@ void RecoveryNode::halt()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("RecoveryNode");
diff --git a/nav2_behavior_tree/plugins/control/round_robin_node.cpp b/nav2_behavior_tree/plugins/control/round_robin_node.cpp
index 135ea09b74..9293a5b118 100644
--- a/nav2_behavior_tree/plugins/control/round_robin_node.cpp
+++ b/nav2_behavior_tree/plugins/control/round_robin_node.cpp
@@ -36,18 +36,22 @@ BT::NodeStatus RoundRobinNode::tick()
const auto num_children = children_nodes_.size();
setStatus(BT::NodeStatus::RUNNING);
+ unsigned num_skipped_children = 0;
- while (num_failed_children_ < num_children) {
+ while (num_failed_children_ + num_skipped_children < num_children) {
TreeNode * child_node = children_nodes_[current_child_idx_];
const BT::NodeStatus child_status = child_node->executeTick();
+ if (child_status != BT::NodeStatus::RUNNING) {
+ // Increment index and wrap around to the first child
+ if (++current_child_idx_ == num_children) {
+ current_child_idx_ = 0;
+ }
+ }
+
switch (child_status) {
case BT::NodeStatus::SUCCESS:
{
- // Wrap around to the first child
- if (++current_child_idx_ >= num_children) {
- current_child_idx_ = 0;
- }
num_failed_children_ = 0;
ControlNode::haltChildren();
return BT::NodeStatus::SUCCESS;
@@ -55,27 +59,27 @@ BT::NodeStatus RoundRobinNode::tick()
case BT::NodeStatus::FAILURE:
{
- if (++current_child_idx_ >= num_children) {
- current_child_idx_ = 0;
- }
num_failed_children_++;
break;
}
- case BT::NodeStatus::RUNNING:
+ case BT::NodeStatus::SKIPPED:
{
- return BT::NodeStatus::RUNNING;
+ num_skipped_children++;
+ break;
}
+ case BT::NodeStatus::RUNNING:
+ return BT::NodeStatus::RUNNING;
default:
- {
- throw BT::LogicError("Invalid status return from BT node");
- }
+ throw BT::LogicError("Invalid status return from BT node");
}
}
+ const bool all_skipped = (num_skipped_children == num_children);
halt();
- return BT::NodeStatus::FAILURE;
+ // If all the children were skipped, this node is considered skipped
+ return all_skipped ? BT::NodeStatus::SKIPPED : BT::NodeStatus::FAILURE;
}
void RoundRobinNode::halt()
diff --git a/nav2_behavior_tree/plugins/decorator/distance_controller.cpp b/nav2_behavior_tree/plugins/decorator/distance_controller.cpp
index b59fba77b4..7f87695416 100644
--- a/nav2_behavior_tree/plugins/decorator/distance_controller.cpp
+++ b/nav2_behavior_tree/plugins/decorator/distance_controller.cpp
@@ -23,7 +23,7 @@
#include "geometry_msgs/msg/pose_stamped.hpp"
#include "tf2_ros/buffer.h"
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
#include "nav2_behavior_tree/plugins/decorator/distance_controller.hpp"
#include "nav2_behavior_tree/bt_utils.hpp"
@@ -43,15 +43,15 @@ DistanceController::DistanceController(
tf_ = config().blackboard->get>("tf_buffer");
node_->get_parameter("transform_tolerance", transform_tolerance_);
- global_frame_ = BT::deconflictPortAndParamFrame(
+ global_frame_ = BT::deconflictPortAndParamFrame(
node_, "global_frame", this);
- robot_base_frame_ = BT::deconflictPortAndParamFrame(
+ robot_base_frame_ = BT::deconflictPortAndParamFrame(
node_, "robot_base_frame", this);
}
inline BT::NodeStatus DistanceController::tick()
{
- if (status() == BT::NodeStatus::IDLE) {
+ if (!BT::isStatusActive(status())) {
// Reset the starting position since we're starting a new iteration of
// the distance controller (moving from IDLE to RUNNING)
if (!nav2_util::getCurrentPose(
@@ -90,8 +90,9 @@ inline BT::NodeStatus DistanceController::tick()
const BT::NodeStatus child_state = child_node_->executeTick();
switch (child_state) {
+ case BT::NodeStatus::SKIPPED:
case BT::NodeStatus::RUNNING:
- return BT::NodeStatus::RUNNING;
+ return child_state;
case BT::NodeStatus::SUCCESS:
if (!nav2_util::getCurrentPose(
@@ -114,7 +115,7 @@ inline BT::NodeStatus DistanceController::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("DistanceController");
diff --git a/nav2_behavior_tree/plugins/decorator/goal_updated_controller.cpp b/nav2_behavior_tree/plugins/decorator/goal_updated_controller.cpp
index f8a2d8cefc..d0de920545 100644
--- a/nav2_behavior_tree/plugins/decorator/goal_updated_controller.cpp
+++ b/nav2_behavior_tree/plugins/decorator/goal_updated_controller.cpp
@@ -17,9 +17,9 @@
#include "rclcpp/rclcpp.hpp"
#include "geometry_msgs/msg/pose_stamped.hpp"
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
#include "nav2_behavior_tree/plugins/decorator/goal_updated_controller.hpp"
-
+#include "nav2_behavior_tree/bt_utils.hpp"
namespace nav2_behavior_tree
{
@@ -33,12 +33,12 @@ GoalUpdatedController::GoalUpdatedController(
BT::NodeStatus GoalUpdatedController::tick()
{
- if (status() == BT::NodeStatus::IDLE) {
+ if (!BT::isStatusActive(status())) {
// Reset since we're starting a new iteration of
// the goal updated controller (moving from IDLE to RUNNING)
- config().blackboard->get>("goals", goals_);
- config().blackboard->get("goal", goal_);
+ BT::getInputOrBlackboard("goals", goals_);
+ BT::getInputOrBlackboard("goal", goal_);
goal_was_updated_ = true;
}
@@ -46,9 +46,9 @@ BT::NodeStatus GoalUpdatedController::tick()
setStatus(BT::NodeStatus::RUNNING);
std::vector current_goals;
- config().blackboard->get>("goals", current_goals);
+ BT::getInputOrBlackboard("goals", current_goals);
geometry_msgs::msg::PoseStamped current_goal;
- config().blackboard->get("goal", current_goal);
+ BT::getInputOrBlackboard("goal", current_goal);
if (goal_ != current_goal || goals_ != current_goals) {
goal_ = current_goal;
@@ -61,19 +61,7 @@ BT::NodeStatus GoalUpdatedController::tick()
// 'til completion
if ((child_node_->status() == BT::NodeStatus::RUNNING) || goal_was_updated_) {
goal_was_updated_ = false;
- const BT::NodeStatus child_state = child_node_->executeTick();
-
- switch (child_state) {
- case BT::NodeStatus::RUNNING:
- return BT::NodeStatus::RUNNING;
-
- case BT::NodeStatus::SUCCESS:
- return BT::NodeStatus::SUCCESS;
-
- case BT::NodeStatus::FAILURE:
- default:
- return BT::NodeStatus::FAILURE;
- }
+ return child_node_->executeTick();
}
return status();
@@ -81,7 +69,7 @@ BT::NodeStatus GoalUpdatedController::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("GoalUpdatedController");
diff --git a/nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp b/nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp
index 1f7226e6aa..fa5badf750 100644
--- a/nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp
+++ b/nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp
@@ -17,7 +17,7 @@
#include
#include "geometry_msgs/msg/pose_stamped.hpp"
-#include "behaviortree_cpp_v3/decorator_node.h"
+#include "behaviortree_cpp/decorator_node.h"
#include "nav2_behavior_tree/plugins/decorator/goal_updater_node.hpp"
@@ -84,7 +84,7 @@ GoalUpdater::callback_updated_goal(const geometry_msgs::msg::PoseStamped::Shared
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("GoalUpdater");
diff --git a/nav2_behavior_tree/plugins/decorator/path_longer_on_approach.cpp b/nav2_behavior_tree/plugins/decorator/path_longer_on_approach.cpp
index d4b40b0964..cb39a24557 100644
--- a/nav2_behavior_tree/plugins/decorator/path_longer_on_approach.cpp
+++ b/nav2_behavior_tree/plugins/decorator/path_longer_on_approach.cpp
@@ -62,7 +62,7 @@ inline BT::NodeStatus PathLongerOnApproach::tick()
getInput("prox_len", prox_len_);
getInput("length_factor", length_factor_);
- if (status() == BT::NodeStatus::IDLE) {
+ if (!BT::isStatusActive(status())) {
// Reset the starting point since we're starting a new iteration of
// PathLongerOnApproach (moving from IDLE to RUNNING)
first_time_ = true;
@@ -77,14 +77,14 @@ inline BT::NodeStatus PathLongerOnApproach::tick()
{
const BT::NodeStatus child_state = child_node_->executeTick();
switch (child_state) {
+ case BT::NodeStatus::SKIPPED:
case BT::NodeStatus::RUNNING:
- return BT::NodeStatus::RUNNING;
+ return child_state;
case BT::NodeStatus::SUCCESS:
- old_path_ = new_path_;
- return BT::NodeStatus::SUCCESS;
case BT::NodeStatus::FAILURE:
old_path_ = new_path_;
- return BT::NodeStatus::FAILURE;
+ resetChild();
+ return child_state;
default:
old_path_ = new_path_;
return BT::NodeStatus::FAILURE;
@@ -97,7 +97,7 @@ inline BT::NodeStatus PathLongerOnApproach::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("PathLongerOnApproach");
diff --git a/nav2_behavior_tree/plugins/decorator/rate_controller.cpp b/nav2_behavior_tree/plugins/decorator/rate_controller.cpp
index b710ec3009..9592d119c9 100644
--- a/nav2_behavior_tree/plugins/decorator/rate_controller.cpp
+++ b/nav2_behavior_tree/plugins/decorator/rate_controller.cpp
@@ -43,7 +43,7 @@ BT::NodeStatus RateController::tick()
initialize();
}
- if (status() == BT::NodeStatus::IDLE) {
+ if (!BT::isStatusActive(status())) {
// Reset the starting point since we're starting a new iteration of
// the rate controller (moving from IDLE to RUNNING)
start_ = std::chrono::high_resolution_clock::now();
@@ -70,14 +70,15 @@ BT::NodeStatus RateController::tick()
const BT::NodeStatus child_state = child_node_->executeTick();
switch (child_state) {
+ case BT::NodeStatus::SKIPPED:
case BT::NodeStatus::RUNNING:
- return BT::NodeStatus::RUNNING;
+ case BT::NodeStatus::FAILURE:
+ return child_state;
case BT::NodeStatus::SUCCESS:
start_ = std::chrono::high_resolution_clock::now(); // Reset the timer
return BT::NodeStatus::SUCCESS;
- case BT::NodeStatus::FAILURE:
default:
return BT::NodeStatus::FAILURE;
}
@@ -88,7 +89,7 @@ BT::NodeStatus RateController::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("RateController");
diff --git a/nav2_behavior_tree/plugins/decorator/single_trigger_node.cpp b/nav2_behavior_tree/plugins/decorator/single_trigger_node.cpp
index 84f0fadfbb..c95d646438 100644
--- a/nav2_behavior_tree/plugins/decorator/single_trigger_node.cpp
+++ b/nav2_behavior_tree/plugins/decorator/single_trigger_node.cpp
@@ -30,7 +30,7 @@ SingleTrigger::SingleTrigger(
BT::NodeStatus SingleTrigger::tick()
{
- if (status() == BT::NodeStatus::IDLE) {
+ if (!BT::isStatusActive(status())) {
first_time_ = true;
}
@@ -40,16 +40,14 @@ BT::NodeStatus SingleTrigger::tick()
const BT::NodeStatus child_state = child_node_->executeTick();
switch (child_state) {
+ case BT::NodeStatus::SKIPPED:
case BT::NodeStatus::RUNNING:
- return BT::NodeStatus::RUNNING;
-
- case BT::NodeStatus::SUCCESS:
- first_time_ = false;
- return BT::NodeStatus::SUCCESS;
+ return child_state;
case BT::NodeStatus::FAILURE:
+ case BT::NodeStatus::SUCCESS:
first_time_ = false;
- return BT::NodeStatus::FAILURE;
+ return child_state;
default:
first_time_ = false;
@@ -62,7 +60,7 @@ BT::NodeStatus SingleTrigger::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("SingleTrigger");
diff --git a/nav2_behavior_tree/plugins/decorator/speed_controller.cpp b/nav2_behavior_tree/plugins/decorator/speed_controller.cpp
index f47dfed38a..b8e5b3915a 100644
--- a/nav2_behavior_tree/plugins/decorator/speed_controller.cpp
+++ b/nav2_behavior_tree/plugins/decorator/speed_controller.cpp
@@ -19,6 +19,7 @@
#include "nav2_util/geometry_utils.hpp"
#include "nav2_behavior_tree/plugins/decorator/speed_controller.hpp"
+#include "nav2_behavior_tree/bt_utils.hpp"
namespace nav2_behavior_tree
{
@@ -58,20 +59,20 @@ SpeedController::SpeedController(
inline BT::NodeStatus SpeedController::tick()
{
- if (status() == BT::NodeStatus::IDLE) {
+ if (!BT::isStatusActive(status())) {
// Reset since we're starting a new iteration of
// the speed controller (moving from IDLE to RUNNING)
- config().blackboard->get>("goals", goals_);
- config().blackboard->get("goal", goal_);
+ BT::getInputOrBlackboard("goals", goals_);
+ BT::getInputOrBlackboard("goal", goal_);
period_ = 1.0 / max_rate_;
start_ = node_->now();
first_tick_ = true;
}
std::vector current_goals;
- config().blackboard->get>("goals", current_goals);
+ BT::getInputOrBlackboard("goals", current_goals);
geometry_msgs::msg::PoseStamped current_goal;
- config().blackboard->get("goal", current_goal);
+ BT::getInputOrBlackboard("goal", current_goal);
if (goal_ != current_goal || goals_ != current_goals) {
// Reset state and set period to max since we have a new goal
@@ -100,19 +101,7 @@ inline BT::NodeStatus SpeedController::tick()
start_ = node_->now();
}
- const BT::NodeStatus child_state = child_node_->executeTick();
-
- switch (child_state) {
- case BT::NodeStatus::RUNNING:
- return BT::NodeStatus::RUNNING;
-
- case BT::NodeStatus::SUCCESS:
- return BT::NodeStatus::SUCCESS;
-
- case BT::NodeStatus::FAILURE:
- default:
- return BT::NodeStatus::FAILURE;
- }
+ return child_node_->executeTick();
}
return status();
@@ -120,7 +109,7 @@ inline BT::NodeStatus SpeedController::tick()
} // namespace nav2_behavior_tree
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
BT_REGISTER_NODES(factory)
{
factory.registerNodeType("SpeedController");
diff --git a/nav2_behavior_tree/plugins_list.hpp.in b/nav2_behavior_tree/plugins_list.hpp.in
new file mode 100644
index 0000000000..148583b927
--- /dev/null
+++ b/nav2_behavior_tree/plugins_list.hpp.in
@@ -0,0 +1,6 @@
+
+// This was automativally generated by cmake
+namespace nav2::details
+{
+ const char* BT_BUILTIN_PLUGINS = "@plugin_libs@";
+}
diff --git a/nav2_behavior_tree/src/behavior_tree_engine.cpp b/nav2_behavior_tree/src/behavior_tree_engine.cpp
index 429368ea96..8ed1cd4e71 100644
--- a/nav2_behavior_tree/src/behavior_tree_engine.cpp
+++ b/nav2_behavior_tree/src/behavior_tree_engine.cpp
@@ -20,7 +20,7 @@
#include
#include "rclcpp/rclcpp.hpp"
-#include "behaviortree_cpp_v3/utils/shared_library.h"
+#include "behaviortree_cpp/utils/shared_library.h"
namespace nav2_behavior_tree
{
@@ -32,6 +32,11 @@ BehaviorTreeEngine::BehaviorTreeEngine(
for (const auto & p : plugin_libraries) {
factory_.registerFromPlugin(loader.getOSName(p));
}
+
+ // FIXME: the next two line are needed for back-compatibility with BT.CPP 3.8.x
+ // Note that the can be removed, once we migrate from BT.CPP 4.5.x to 4.6+
+ BT::ReactiveSequence::EnableException(false);
+ BT::ReactiveFallback::EnableException(false);
}
BtStatus
@@ -48,11 +53,11 @@ BehaviorTreeEngine::run(
try {
while (rclcpp::ok() && result == BT::NodeStatus::RUNNING) {
if (cancelRequested()) {
- tree->rootNode()->halt();
+ tree->haltTree();
return BtStatus::CANCELED;
}
- result = tree->tickRoot();
+ result = tree->tickOnce();
onLoop();
diff --git a/nav2_behavior_tree/src/generate_nav2_tree_nodes_xml.cpp b/nav2_behavior_tree/src/generate_nav2_tree_nodes_xml.cpp
new file mode 100644
index 0000000000..4992e2e777
--- /dev/null
+++ b/nav2_behavior_tree/src/generate_nav2_tree_nodes_xml.cpp
@@ -0,0 +1,47 @@
+// Copyright (c) 2024 Davide Faconti
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License. Reserved.
+
+#include
+#include
+#include
+#include
+
+#include "behaviortree_cpp/behavior_tree.h"
+#include "behaviortree_cpp/bt_factory.h"
+#include "behaviortree_cpp/utils/shared_library.h"
+#include "behaviortree_cpp/xml_parsing.h"
+
+#include "plugins_list.hpp"
+
+int main()
+{
+ BT::BehaviorTreeFactory factory;
+
+ std::vector plugins_list;
+ boost::split(plugins_list, nav2::details::BT_BUILTIN_PLUGINS, boost::is_any_of(";"));
+
+ for (const auto & plugin : plugins_list) {
+ std::cout << "Loading: " << plugin << "\n";
+ factory.registerFromPlugin(BT::SharedLibrary::getOSName(plugin));
+ }
+ std::cout << "\nGenerating file: nav2_tree_nodes.xml\n"
+ << "\nCompare it with the one in the git repo and update the latter if necessary.\n";
+
+ std::ofstream xml_file;
+ xml_file.open("nav2_tree_nodes.xml");
+ xml_file << BT::writeTreeNodesModelXML(factory) << std::endl;
+ xml_file.close();
+
+ return 0;
+}
diff --git a/nav2_behavior_tree/test/plugins/action/test_assisted_teleop_action.cpp b/nav2_behavior_tree/test/plugins/action/test_assisted_teleop_action.cpp
index cbb5606d8b..c5d40f0f4e 100644
--- a/nav2_behavior_tree/test/plugins/action/test_assisted_teleop_action.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_assisted_teleop_action.cpp
@@ -17,7 +17,7 @@
#include
#include
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_action_server.hpp"
#include "nav2_behavior_tree/plugins/action/assisted_teleop_action.hpp"
@@ -123,7 +123,7 @@ TEST_F(AssistedTeleopActionTestFixture, test_ports)
{
std::string xml_txt =
R"(
-
+
@@ -134,7 +134,7 @@ TEST_F(AssistedTeleopActionTestFixture, test_ports)
xml_txt =
R"(
-
+
@@ -148,7 +148,7 @@ TEST_F(AssistedTeleopActionTestFixture, test_tick)
{
std::string xml_txt =
R"(
-
+
@@ -172,7 +172,7 @@ TEST_F(AssistedTeleopActionTestFixture, test_failure)
{
std::string xml_txt =
R"(
-
+
diff --git a/nav2_behavior_tree/test/plugins/action/test_assisted_teleop_cancel_node.cpp b/nav2_behavior_tree/test/plugins/action/test_assisted_teleop_cancel_node.cpp
index a9261fe4b8..a516d868e4 100644
--- a/nav2_behavior_tree/test/plugins/action/test_assisted_teleop_cancel_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_assisted_teleop_cancel_node.cpp
@@ -17,7 +17,7 @@
#include
#include
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_action_server.hpp"
#include "nav2_behavior_tree/plugins/action/assisted_teleop_cancel_node.hpp"
@@ -122,7 +122,7 @@ TEST_F(CancelAssistedTeleopActionTestFixture, test_ports)
{
std::string xml_txt =
R"(
-
+
diff --git a/nav2_behavior_tree/test/plugins/action/test_back_up_action.cpp b/nav2_behavior_tree/test/plugins/action/test_back_up_action.cpp
index 9df8b3da15..846e7e86db 100644
--- a/nav2_behavior_tree/test/plugins/action/test_back_up_action.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_back_up_action.cpp
@@ -18,7 +18,7 @@
#include
#include
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_action_server.hpp"
#include "nav2_behavior_tree/plugins/action/back_up_action.hpp"
@@ -122,7 +122,7 @@ TEST_F(BackUpActionTestFixture, test_ports)
{
std::string xml_txt =
R"(
-
+
@@ -134,7 +134,7 @@ TEST_F(BackUpActionTestFixture, test_ports)
xml_txt =
R"(
-
+
@@ -149,7 +149,7 @@ TEST_F(BackUpActionTestFixture, test_tick)
{
std::string xml_txt =
R"(
-
+
@@ -174,7 +174,7 @@ TEST_F(BackUpActionTestFixture, test_failure)
{
std::string xml_txt =
R"(
-
+
diff --git a/nav2_behavior_tree/test/plugins/action/test_back_up_cancel_node.cpp b/nav2_behavior_tree/test/plugins/action/test_back_up_cancel_node.cpp
index c7f379a64c..a3ea28791c 100644
--- a/nav2_behavior_tree/test/plugins/action/test_back_up_cancel_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_back_up_cancel_node.cpp
@@ -17,7 +17,7 @@
#include
#include
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_action_server.hpp"
#include "nav2_behavior_tree/plugins/action/back_up_cancel_node.hpp"
@@ -120,7 +120,7 @@ TEST_F(CancelBackUpActionTestFixture, test_ports)
{
std::string xml_txt =
R"(
-
+
diff --git a/nav2_behavior_tree/test/plugins/action/test_bt_action_node.cpp b/nav2_behavior_tree/test/plugins/action/test_bt_action_node.cpp
index ec3aa03a07..8aa1c3366e 100644
--- a/nav2_behavior_tree/test/plugins/action/test_bt_action_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_bt_action_node.cpp
@@ -23,7 +23,7 @@
#include "rclcpp/rclcpp.hpp"
#include "rclcpp_action/rclcpp_action.hpp"
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "nav2_behavior_tree/bt_action_node.hpp"
#include "test_msgs/action/fibonacci.hpp"
@@ -238,7 +238,7 @@ TEST_F(BTActionNodeTestFixture, test_server_timeout_success)
// create tree
std::string xml_txt =
R"(
-
+
@@ -264,7 +264,7 @@ TEST_F(BTActionNodeTestFixture, test_server_timeout_success)
// main BT execution loop
while (rclcpp::ok() && result == BT::NodeStatus::RUNNING) {
- result = tree_->tickRoot();
+ result = tree_->tickOnce();
ticks++;
loopRate.sleep();
}
@@ -307,7 +307,7 @@ TEST_F(BTActionNodeTestFixture, test_server_timeout_success)
// main BT execution loop
while (rclcpp::ok() && result == BT::NodeStatus::RUNNING) {
- result = tree_->tickRoot();
+ result = tree_->tickOnce();
ticks++;
loopRate.sleep();
}
@@ -316,8 +316,10 @@ TEST_F(BTActionNodeTestFixture, test_server_timeout_success)
// the BT should have failed
EXPECT_EQ(result, BT::NodeStatus::FAILURE);
- // since the server timeout is 20ms and bt loop duration is 10ms, number of ticks should be 2
- EXPECT_EQ(ticks, 2);
+ // since the server timeout is 20ms and bt loop duration is 10ms, number of ticks should
+ // be at most 2, but it can be 1 too, because the tickOnce may execute two ticks.
+ EXPECT_LE(ticks, 2);
+ EXPECT_GE(ticks, 1);
}
TEST_F(BTActionNodeTestFixture, test_server_timeout_failure)
@@ -325,7 +327,7 @@ TEST_F(BTActionNodeTestFixture, test_server_timeout_failure)
// create tree
std::string xml_txt =
R"(
-
+
@@ -352,7 +354,7 @@ TEST_F(BTActionNodeTestFixture, test_server_timeout_failure)
// main BT execution loop
while (rclcpp::ok() && result == BT::NodeStatus::RUNNING) {
- result = tree_->tickRoot();
+ result = tree_->tickOnce();
ticks++;
loopRate.sleep();
}
@@ -386,7 +388,7 @@ TEST_F(BTActionNodeTestFixture, test_server_timeout_failure)
// main BT execution loop
while (rclcpp::ok() && result == BT::NodeStatus::RUNNING) {
- result = tree_->tickRoot();
+ result = tree_->tickOnce();
ticks++;
loopRate.sleep();
}
@@ -401,7 +403,7 @@ TEST_F(BTActionNodeTestFixture, test_server_cancel)
// create tree
std::string xml_txt =
R"(
-
+
@@ -429,7 +431,7 @@ TEST_F(BTActionNodeTestFixture, test_server_cancel)
// main BT execution loop
while (rclcpp::ok() && result == BT::NodeStatus::RUNNING && ticks < 5) {
- result = tree_->tickRoot();
+ result = tree_->tickOnce();
ticks++;
loopRate.sleep();
}
@@ -461,7 +463,7 @@ TEST_F(BTActionNodeTestFixture, test_server_cancel)
// main BT execution loop
while (rclcpp::ok() && result == BT::NodeStatus::RUNNING && ticks < 7) {
- result = tree_->tickRoot();
+ result = tree_->tickOnce();
ticks++;
loopRate.sleep();
}
diff --git a/nav2_behavior_tree/test/plugins/action/test_clear_costmap_service.cpp b/nav2_behavior_tree/test/plugins/action/test_clear_costmap_service.cpp
index e21f9802d7..76f3b1d025 100644
--- a/nav2_behavior_tree/test/plugins/action/test_clear_costmap_service.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_clear_costmap_service.cpp
@@ -18,7 +18,7 @@
#include
#include
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_service.hpp"
#include "nav2_behavior_tree/plugins/action/clear_costmap_service.hpp"
@@ -100,7 +100,7 @@ TEST_F(ClearEntireCostmapServiceTestFixture, test_tick)
{
std::string xml_txt =
R"(
-
+
@@ -195,7 +195,7 @@ TEST_F(ClearCostmapExceptRegionServiceTestFixture, test_tick)
{
std::string xml_txt =
R"(
-
+
@@ -290,7 +290,7 @@ TEST_F(ClearCostmapAroundRobotServiceTestFixture, test_tick)
{
std::string xml_txt =
R"(
-
+
diff --git a/nav2_behavior_tree/test/plugins/action/test_compute_path_through_poses_action.cpp b/nav2_behavior_tree/test/plugins/action/test_compute_path_through_poses_action.cpp
index 001c3de67f..24d10b63d6 100644
--- a/nav2_behavior_tree/test/plugins/action/test_compute_path_through_poses_action.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_compute_path_through_poses_action.cpp
@@ -22,7 +22,7 @@
#include "nav_msgs/msg/path.hpp"
#include "geometry_msgs/msg/pose_stamped.hpp"
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_action_server.hpp"
#include "nav2_behavior_tree/plugins/action/compute_path_through_poses_action.hpp"
@@ -128,7 +128,7 @@ TEST_F(ComputePathThroughPosesActionTestFixture, test_tick)
// create tree
std::string xml_txt =
R"(
-
+
@@ -156,13 +156,13 @@ TEST_F(ComputePathThroughPosesActionTestFixture, test_tick)
// check if returned path is correct
nav_msgs::msg::Path path;
- config_->blackboard->get("path", path);
+ EXPECT_TRUE(config_->blackboard->get("path", path));
EXPECT_EQ(path.poses.size(), 2u);
EXPECT_EQ(path.poses[0].pose.position.x, 0.0);
EXPECT_EQ(path.poses[1].pose.position.x, 1.0);
// halt node so another goal can be sent
- tree_->rootNode()->halt();
+ tree_->haltTree();
EXPECT_EQ(tree_->rootNode()->status(), BT::NodeStatus::IDLE);
// set new goal
@@ -176,7 +176,7 @@ TEST_F(ComputePathThroughPosesActionTestFixture, test_tick)
EXPECT_EQ(tree_->rootNode()->status(), BT::NodeStatus::SUCCESS);
EXPECT_EQ(action_server_->getCurrentGoal()->goals[0].pose.position.x, -2.5);
- config_->blackboard->get("path", path);
+ EXPECT_TRUE(config_->blackboard->get("path", path));
EXPECT_EQ(path.poses.size(), 2u);
EXPECT_EQ(path.poses[0].pose.position.x, 0.0);
EXPECT_EQ(path.poses[1].pose.position.x, -2.5);
@@ -187,7 +187,7 @@ TEST_F(ComputePathThroughPosesActionTestFixture, test_tick_use_start)
// create tree
std::string xml_txt =
R"(
-
+
@@ -222,13 +222,13 @@ TEST_F(ComputePathThroughPosesActionTestFixture, test_tick_use_start)
// check if returned path is correct
nav_msgs::msg::Path path;
- config_->blackboard->get("path", path);
+ EXPECT_TRUE(config_->blackboard->get("path", path));
EXPECT_EQ(path.poses.size(), 2u);
EXPECT_EQ(path.poses[0].pose.position.x, 2.0);
EXPECT_EQ(path.poses[1].pose.position.x, 1.0);
// halt node so another goal can be sent
- tree_->rootNode()->halt();
+ tree_->haltTree();
EXPECT_EQ(tree_->rootNode()->status(), BT::NodeStatus::IDLE);
// set new goal and new start
@@ -244,7 +244,7 @@ TEST_F(ComputePathThroughPosesActionTestFixture, test_tick_use_start)
EXPECT_EQ(tree_->rootNode()->status(), BT::NodeStatus::SUCCESS);
EXPECT_EQ(action_server_->getCurrentGoal()->goals[0].pose.position.x, -2.5);
- config_->blackboard->get("path", path);
+ EXPECT_TRUE(config_->blackboard->get("path", path));
EXPECT_EQ(path.poses.size(), 2u);
EXPECT_EQ(path.poses[0].pose.position.x, -1.5);
EXPECT_EQ(path.poses[1].pose.position.x, -2.5);
diff --git a/nav2_behavior_tree/test/plugins/action/test_compute_path_to_pose_action.cpp b/nav2_behavior_tree/test/plugins/action/test_compute_path_to_pose_action.cpp
index f1da97cb25..29ebaef936 100644
--- a/nav2_behavior_tree/test/plugins/action/test_compute_path_to_pose_action.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_compute_path_to_pose_action.cpp
@@ -21,7 +21,7 @@
#include "nav_msgs/msg/path.hpp"
#include "geometry_msgs/msg/pose_stamped.hpp"
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_action_server.hpp"
#include "nav2_behavior_tree/plugins/action/compute_path_to_pose_action.hpp"
@@ -125,7 +125,7 @@ TEST_F(ComputePathToPoseActionTestFixture, test_tick)
// create tree
std::string xml_txt =
R"(
-
+
@@ -153,13 +153,13 @@ TEST_F(ComputePathToPoseActionTestFixture, test_tick)
// check if returned path is correct
nav_msgs::msg::Path path;
- config_->blackboard->get("path", path);
+ EXPECT_TRUE(config_->blackboard->get("path", path));
EXPECT_EQ(path.poses.size(), 2u);
EXPECT_EQ(path.poses[0].pose.position.x, 0.0);
EXPECT_EQ(path.poses[1].pose.position.x, 1.0);
// halt node so another goal can be sent
- tree_->rootNode()->halt();
+ tree_->haltTree();
EXPECT_EQ(tree_->rootNode()->status(), BT::NodeStatus::IDLE);
// set new goal
@@ -173,7 +173,7 @@ TEST_F(ComputePathToPoseActionTestFixture, test_tick)
EXPECT_EQ(tree_->rootNode()->status(), BT::NodeStatus::SUCCESS);
EXPECT_EQ(action_server_->getCurrentGoal()->goal.pose.position.x, -2.5);
- config_->blackboard->get("path", path);
+ EXPECT_TRUE(config_->blackboard->get("path", path));
EXPECT_EQ(path.poses.size(), 2u);
EXPECT_EQ(path.poses[0].pose.position.x, 0.0);
EXPECT_EQ(path.poses[1].pose.position.x, -2.5);
@@ -184,7 +184,7 @@ TEST_F(ComputePathToPoseActionTestFixture, test_tick_use_start)
// create tree
std::string xml_txt =
R"(
-
+
@@ -219,13 +219,13 @@ TEST_F(ComputePathToPoseActionTestFixture, test_tick_use_start)
// check if returned path is correct
nav_msgs::msg::Path path;
- config_->blackboard->get("path", path);
+ EXPECT_TRUE(config_->blackboard->get("path", path));
EXPECT_EQ(path.poses.size(), 2u);
EXPECT_EQ(path.poses[0].pose.position.x, 2.0);
EXPECT_EQ(path.poses[1].pose.position.x, 1.0);
// halt node so another goal can be sent
- tree_->rootNode()->halt();
+ tree_->haltTree();
EXPECT_EQ(tree_->rootNode()->status(), BT::NodeStatus::IDLE);
// set new goal and new start
@@ -241,7 +241,7 @@ TEST_F(ComputePathToPoseActionTestFixture, test_tick_use_start)
EXPECT_EQ(tree_->rootNode()->status(), BT::NodeStatus::SUCCESS);
EXPECT_EQ(action_server_->getCurrentGoal()->goal.pose.position.x, -2.5);
- config_->blackboard->get("path", path);
+ EXPECT_TRUE(config_->blackboard->get("path", path));
EXPECT_EQ(path.poses.size(), 2u);
EXPECT_EQ(path.poses[0].pose.position.x, -1.5);
EXPECT_EQ(path.poses[1].pose.position.x, -2.5);
diff --git a/nav2_behavior_tree/test/plugins/action/test_controller_cancel_node.cpp b/nav2_behavior_tree/test/plugins/action/test_controller_cancel_node.cpp
index 7be55c08ae..564e72d3d5 100644
--- a/nav2_behavior_tree/test/plugins/action/test_controller_cancel_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_controller_cancel_node.cpp
@@ -17,7 +17,7 @@
#include
#include
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_action_server.hpp"
#include "nav2_behavior_tree/plugins/action/controller_cancel_node.hpp"
@@ -120,7 +120,7 @@ TEST_F(CancelControllerActionTestFixture, test_ports)
{
std::string xml_txt =
R"(
-
+
diff --git a/nav2_behavior_tree/test/plugins/action/test_controller_selector_node.cpp b/nav2_behavior_tree/test/plugins/action/test_controller_selector_node.cpp
index 8c98db78b3..c7f04ae9a9 100644
--- a/nav2_behavior_tree/test/plugins/action/test_controller_selector_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_controller_selector_node.cpp
@@ -20,7 +20,7 @@
#include
#include "utils/test_action_server.hpp"
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "nav2_behavior_tree/plugins/action/controller_selector_node.hpp"
#include "nav_msgs/msg/path.hpp"
#include "std_msgs/msg/string.hpp"
@@ -80,7 +80,7 @@ TEST_F(ControllerSelectorTestFixture, test_custom_topic)
// create tree
std::string xml_txt =
R"(
-
+
@@ -95,7 +95,7 @@ TEST_F(ControllerSelectorTestFixture, test_custom_topic)
// check default value
std::string selected_controller_result;
- config_->blackboard->get("selected_controller", selected_controller_result);
+ EXPECT_TRUE(config_->blackboard->get("selected_controller", selected_controller_result));
EXPECT_EQ(selected_controller_result, "DWB");
@@ -119,7 +119,7 @@ TEST_F(ControllerSelectorTestFixture, test_custom_topic)
}
// check controller updated
- config_->blackboard->get("selected_controller", selected_controller_result);
+ EXPECT_TRUE(config_->blackboard->get("selected_controller", selected_controller_result));
EXPECT_EQ("DWC", selected_controller_result);
}
@@ -128,7 +128,7 @@ TEST_F(ControllerSelectorTestFixture, test_default_topic)
// create tree
std::string xml_txt =
R"(
-
+
@@ -143,7 +143,7 @@ TEST_F(ControllerSelectorTestFixture, test_default_topic)
// check default value
std::string selected_controller_result;
- config_->blackboard->get("selected_controller", selected_controller_result);
+ EXPECT_TRUE(config_->blackboard->get("selected_controller", selected_controller_result));
EXPECT_EQ(selected_controller_result, "GridBased");
@@ -167,7 +167,7 @@ TEST_F(ControllerSelectorTestFixture, test_default_topic)
}
// check controller updated
- config_->blackboard->get("selected_controller", selected_controller_result);
+ EXPECT_TRUE(config_->blackboard->get("selected_controller", selected_controller_result));
EXPECT_EQ("RRT", selected_controller_result);
}
diff --git a/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_action.cpp b/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_action.cpp
index c4439f1e1c..baa5ea02a2 100644
--- a/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_action.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_action.cpp
@@ -18,7 +18,7 @@
#include
#include
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_action_server.hpp"
#include "nav2_behavior_tree/plugins/action/drive_on_heading_action.hpp"
@@ -118,7 +118,7 @@ TEST_F(DriveOnHeadingActionTestFixture, test_ports)
{
std::string xml_txt =
R"(
-
+
@@ -131,7 +131,7 @@ TEST_F(DriveOnHeadingActionTestFixture, test_ports)
xml_txt =
R"(
-
+
@@ -146,7 +146,7 @@ TEST_F(DriveOnHeadingActionTestFixture, test_tick)
{
std::string xml_txt =
R"(
-
+
@@ -169,7 +169,7 @@ TEST_F(DriveOnHeadingActionTestFixture, test_failure)
{
std::string xml_txt =
R"(
-
+
diff --git a/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_cancel_node.cpp b/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_cancel_node.cpp
index 762351bdd1..c94ed1d89f 100644
--- a/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_cancel_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_drive_on_heading_cancel_node.cpp
@@ -17,7 +17,7 @@
#include
#include
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_action_server.hpp"
#include "nav2_behavior_tree/plugins/action/drive_on_heading_cancel_node.hpp"
@@ -123,7 +123,7 @@ TEST_F(CancelDriveOnHeadingTestFixture, test_ports)
{
std::string xml_txt =
R"(
-
+
diff --git a/nav2_behavior_tree/test/plugins/action/test_follow_path_action.cpp b/nav2_behavior_tree/test/plugins/action/test_follow_path_action.cpp
index fea7a2b2b9..4f27220819 100644
--- a/nav2_behavior_tree/test/plugins/action/test_follow_path_action.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_follow_path_action.cpp
@@ -21,7 +21,7 @@
#include "nav_msgs/msg/path.hpp"
#include "geometry_msgs/msg/pose_stamped.hpp"
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_action_server.hpp"
#include "nav2_behavior_tree/plugins/action/follow_path_action.hpp"
@@ -118,7 +118,7 @@ TEST_F(FollowPathActionTestFixture, test_tick)
// create tree
std::string xml_txt =
R"(
-
+
@@ -145,7 +145,7 @@ TEST_F(FollowPathActionTestFixture, test_tick)
EXPECT_EQ(action_server_->getCurrentGoal()->controller_id, std::string("FollowPath"));
// halt node so another goal can be sent
- tree_->rootNode()->halt();
+ tree_->haltTree();
EXPECT_EQ(tree_->rootNode()->status(), BT::NodeStatus::IDLE);
// set new goal
diff --git a/nav2_behavior_tree/test/plugins/action/test_goal_checker_selector_node.cpp b/nav2_behavior_tree/test/plugins/action/test_goal_checker_selector_node.cpp
index 1fd0e286cb..19089fb6f3 100644
--- a/nav2_behavior_tree/test/plugins/action/test_goal_checker_selector_node.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_goal_checker_selector_node.cpp
@@ -20,7 +20,7 @@
#include
#include "utils/test_action_server.hpp"
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "nav2_behavior_tree/plugins/action/goal_checker_selector_node.hpp"
#include "nav_msgs/msg/path.hpp"
#include "std_msgs/msg/string.hpp"
@@ -80,7 +80,7 @@ TEST_F(GoalCheckerSelectorTestFixture, test_custom_topic)
// create tree
std::string xml_txt =
R"(
-
+
@@ -95,7 +95,7 @@ TEST_F(GoalCheckerSelectorTestFixture, test_custom_topic)
// check default value
std::string selected_goal_checker_result;
- config_->blackboard->get("selected_goal_checker", selected_goal_checker_result);
+ EXPECT_TRUE(config_->blackboard->get("selected_goal_checker", selected_goal_checker_result));
EXPECT_EQ(selected_goal_checker_result, "SimpleGoalCheck");
@@ -119,7 +119,7 @@ TEST_F(GoalCheckerSelectorTestFixture, test_custom_topic)
}
// check goal_checker updated
- config_->blackboard->get("selected_goal_checker", selected_goal_checker_result);
+ EXPECT_TRUE(config_->blackboard->get("selected_goal_checker", selected_goal_checker_result));
EXPECT_EQ("AngularGoalChecker", selected_goal_checker_result);
}
@@ -128,7 +128,7 @@ TEST_F(GoalCheckerSelectorTestFixture, test_default_topic)
// create tree
std::string xml_txt =
R"(
-
+
@@ -143,7 +143,7 @@ TEST_F(GoalCheckerSelectorTestFixture, test_default_topic)
// check default value
std::string selected_goal_checker_result;
- config_->blackboard->get("selected_goal_checker", selected_goal_checker_result);
+ EXPECT_TRUE(config_->blackboard->get("selected_goal_checker", selected_goal_checker_result));
EXPECT_EQ(selected_goal_checker_result, "GridBased");
@@ -167,7 +167,7 @@ TEST_F(GoalCheckerSelectorTestFixture, test_default_topic)
}
// check goal_checker updated
- config_->blackboard->get("selected_goal_checker", selected_goal_checker_result);
+ EXPECT_TRUE(config_->blackboard->get("selected_goal_checker", selected_goal_checker_result));
EXPECT_EQ("RRT", selected_goal_checker_result);
}
diff --git a/nav2_behavior_tree/test/plugins/action/test_navigate_through_poses_action.cpp b/nav2_behavior_tree/test/plugins/action/test_navigate_through_poses_action.cpp
index 90cdfbbb0c..a805a721b9 100644
--- a/nav2_behavior_tree/test/plugins/action/test_navigate_through_poses_action.cpp
+++ b/nav2_behavior_tree/test/plugins/action/test_navigate_through_poses_action.cpp
@@ -23,7 +23,7 @@
#include "geometry_msgs/msg/point.hpp"
#include "geometry_msgs/msg/quaternion.hpp"
-#include "behaviortree_cpp_v3/bt_factory.h"
+#include "behaviortree_cpp/bt_factory.h"
#include "utils/test_action_server.hpp"
#include "nav2_behavior_tree/plugins/action/navigate_through_poses_action.hpp"
@@ -124,7 +124,7 @@ TEST_F(NavigateThroughPosesActionTestFixture, test_tick)
// create tree
std::string xml_txt =
R"(
-
+