From a673f31e003fb3e64f7e6e530c79727c3ab591b3 Mon Sep 17 00:00:00 2001 From: Steve Macenski Date: Fri, 30 Jun 2023 12:34:14 -0700 Subject: [PATCH 1/4] CI test fixing for BT.CPP (paired with BehaviorTree.CPP/579) (#3605) * CI test fixing for BT.CPP (paired with BehaviorTree.CPP/579) * lint * fixing smoother unit test failures Signed-off-by: jncfa <20467009+jncfa@users.noreply.github.com> --- .../decorator/test_single_trigger_node.cpp | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/nav2_behavior_tree/test/plugins/decorator/test_single_trigger_node.cpp b/nav2_behavior_tree/test/plugins/decorator/test_single_trigger_node.cpp index 5b341290575..1b23ca1d0a7 100644 --- a/nav2_behavior_tree/test/plugins/decorator/test_single_trigger_node.cpp +++ b/nav2_behavior_tree/test/plugins/decorator/test_single_trigger_node.cpp @@ -24,13 +24,25 @@ using namespace std::chrono; // NOLINT using namespace std::chrono_literals; // NOLINT +// Shim BT node to access protected resetStatus method +class ShimNode : public nav2_behavior_tree::SingleTrigger +{ +public: + ShimNode( + const std::string & name, + const BT::NodeConfiguration & confi) + : SingleTrigger(name, confi) + {} + ~ShimNode() {} + void changeStatus() {resetStatus();} +}; + class SingleTriggerTestFixture : public nav2_behavior_tree::BehaviorTreeTestFixture { public: void SetUp() { - bt_node_ = std::make_shared( - "single_trigger", *config_); + bt_node_ = std::make_shared("single_trigger", *config_); dummy_node_ = std::make_shared(); bt_node_->setChild(dummy_node_.get()); } @@ -42,11 +54,11 @@ class SingleTriggerTestFixture : public nav2_behavior_tree::BehaviorTreeTestFixt } protected: - static std::shared_ptr bt_node_; + static std::shared_ptr bt_node_; static std::shared_ptr dummy_node_; }; -std::shared_ptr +std::shared_ptr SingleTriggerTestFixture::bt_node_ = nullptr; std::shared_ptr SingleTriggerTestFixture::dummy_node_ = nullptr; @@ -71,6 +83,7 @@ TEST_F(SingleTriggerTestFixture, test_behavior) // halt BT for a new execution run, should work when dummy node is running // and once when dummy node returns success and then fail bt_node_->halt(); + bt_node_->changeStatus(); // BTv3.8+ doesn't reset root node automatically dummy_node_->changeStatus(BT::NodeStatus::RUNNING); EXPECT_EQ(bt_node_->executeTick(), BT::NodeStatus::RUNNING); dummy_node_->changeStatus(BT::NodeStatus::SUCCESS); From eb4e0ed694d47658fc53226d17868e4a2d036464 Mon Sep 17 00:00:00 2001 From: jncfa <20467009+jncfa@users.noreply.github.com> Date: Sat, 19 Jul 2025 13:01:00 +0000 Subject: [PATCH 2/4] fix devcontainer setup for humble Signed-off-by: jncfa <20467009+jncfa@users.noreply.github.com> --- .devcontainer/devcontainer.json | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ddb2d13801e..12ccc8fae16 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,7 @@ "dockerfile": "../Dockerfile", "context": "..", "target": "visualizer", - "cacheFrom": "ghcr.io/ros-planning/navigation2:humble" + "cacheFrom": "ghcr.io/ros-navigation/navigation2:humble" }, "runArgs": [ // "--cap-add=SYS_PTRACE", // enable debugging, e.g. gdb diff --git a/Dockerfile b/Dockerfile index d0b1e41eaea..58a80b189bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -219,7 +219,7 @@ COPY --from=caddyer /usr/bin/caddy /usr/bin/caddy # download media files RUN mkdir -p $ROOT_SRV/media && cd /tmp && \ - export ICONS="icons.tar.gz" && wget https://github.com/ros-planning/navigation2/files/11506823/$ICONS && \ + export ICONS="icons.tar.gz" && wget https://github.com/ros-navigation/navigation2/files/11506823/$ICONS && \ echo "cae5e2a5230f87b004c8232b579781edb4a72a7431405381403c6f9e9f5f7d41 $ICONS" | sha256sum -c && \ tar xvz -C $ROOT_SRV/media -f $ICONS && rm $ICONS From c635523496bb23d31f7c574a5a600ef749b41437 Mon Sep 17 00:00:00 2001 From: stevemacenski Date: Fri, 30 Jun 2023 11:01:13 -0700 Subject: [PATCH 3/4] fixing last issue Signed-off-by: jncfa <20467009+jncfa@users.noreply.github.com> --- .../plugins/action/navigate_through_poses_action.hpp | 3 ++- nav2_mppi_controller/test/utils_test.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/navigate_through_poses_action.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/navigate_through_poses_action.hpp index 7e7f3d5c30b..d6ec12aed0d 100644 --- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/navigate_through_poses_action.hpp +++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/navigate_through_poses_action.hpp @@ -55,7 +55,8 @@ class NavigateThroughPosesAction : public BtActionNode("goals", "Destinations to plan through"), + BT::InputPort>( + "goals", "Destinations to plan through"), BT::InputPort("behavior_tree", "Behavior tree to run"), }); } diff --git a/nav2_mppi_controller/test/utils_test.cpp b/nav2_mppi_controller/test/utils_test.cpp index 9e13ba2f0bf..a6b8f594995 100644 --- a/nav2_mppi_controller/test/utils_test.cpp +++ b/nav2_mppi_controller/test/utils_test.cpp @@ -368,7 +368,7 @@ TEST(UtilsTests, SmootherTest) // Check that path is smoother float smoothed_val{0}, original_val{0}; - for (unsigned int i = 0; i != noisey_sequence.vx.shape(0); i++) { + for (unsigned int i = 1; i != noisey_sequence.vx.shape(0) - 1; i++) { smoothed_val += fabs(noisey_sequence.vx(i) - 0.2); smoothed_val += fabs(noisey_sequence.vy(i) - 0.0); smoothed_val += fabs(noisey_sequence.wz(i) - 0.3); From 435120b487b73f022a96094fbaee8c2b8384facb Mon Sep 17 00:00:00 2001 From: jncfa <20467009+jncfa@users.noreply.github.com> Date: Mon, 21 Jul 2025 21:37:44 +0200 Subject: [PATCH 4/4] avoid transitive include of Signed-off-by: jncfa <20467009+jncfa@users.noreply.github.com> --- .../plugins/action/navigate_through_poses_action.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/navigate_through_poses_action.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/navigate_through_poses_action.hpp index d6ec12aed0d..7b4db99bc15 100644 --- a/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/navigate_through_poses_action.hpp +++ b/nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/navigate_through_poses_action.hpp @@ -16,6 +16,7 @@ #define NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__NAVIGATE_THROUGH_POSES_ACTION_HPP_ #include +#include #include "geometry_msgs/msg/point.hpp" #include "geometry_msgs/msg/quaternion.hpp"