Skip to content

Commit a797881

Browse files
authored
Add double spin_some in some BT nodes (#5073)
Signed-off-by: Alberto Tudela <ajtudela@gmail.com>
1 parent 718ed65 commit a797881

File tree

6 files changed

+18
-2
lines changed

6 files changed

+18
-2
lines changed

nav2_behavior_tree/plugins/action/controller_selector_node.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ ControllerSelector::ControllerSelector(
5050
qos,
5151
std::bind(&ControllerSelector::callbackControllerSelect, this, _1),
5252
sub_option);
53+
54+
// Spin multiple times due to rclcpp regression in Jazzy requiring a 'warm up' spin
55+
callback_group_executor_.spin_some(std::chrono::nanoseconds(1));
5356
}
5457

5558
BT::NodeStatus ControllerSelector::tick()

nav2_behavior_tree/plugins/action/planner_selector_node.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ PlannerSelector::PlannerSelector(
5050
qos,
5151
std::bind(&PlannerSelector::callbackPlannerSelect, this, _1),
5252
sub_option);
53+
54+
// Spin multiple times due to rclcpp regression in Jazzy requiring a 'warm up' spin
55+
callback_group_executor_.spin_some(std::chrono::nanoseconds(1));
5356
}
5457

5558
BT::NodeStatus PlannerSelector::tick()

nav2_behavior_tree/plugins/action/smoother_selector_node.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ SmootherSelector::SmootherSelector(
5151
qos,
5252
std::bind(&SmootherSelector::callbackSmootherSelect, this, _1),
5353
sub_option);
54+
55+
// Spin multiple times due to rclcpp regression in Jazzy requiring a 'warm up' spin
56+
callback_group_executor_.spin_some(std::chrono::nanoseconds(1));
5457
}
5558

5659
BT::NodeStatus SmootherSelector::tick()

nav2_behavior_tree/plugins/condition/is_battery_charging_condition.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ IsBatteryChargingCondition::IsBatteryChargingCondition(
4040
rclcpp::SystemDefaultsQoS(),
4141
std::bind(&IsBatteryChargingCondition::batteryCallback, this, std::placeholders::_1),
4242
sub_option);
43+
44+
// Spin multiple times due to rclcpp regression in Jazzy requiring a 'warm up' spin
45+
callback_group_executor_.spin_some(std::chrono::nanoseconds(1));
4346
}
4447

4548
BT::NodeStatus IsBatteryChargingCondition::tick()

nav2_behavior_tree/plugins/condition/is_battery_low_condition.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ void IsBatteryLowCondition::initialize()
5656
std::bind(&IsBatteryLowCondition::batteryCallback, this, std::placeholders::_1),
5757
sub_option);
5858
}
59+
60+
// Spin multiple times due to rclcpp regression in Jazzy requiring a 'warm up' spin
61+
callback_group_executor_.spin_some(std::chrono::nanoseconds(1));
5962
}
6063

6164
BT::NodeStatus IsBatteryLowCondition::tick()

nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ GoalUpdater::GoalUpdater(
4949
rclcpp::SystemDefaultsQoS(),
5050
std::bind(&GoalUpdater::callback_updated_goal, this, _1),
5151
sub_option);
52+
53+
// Spin multiple times due to rclcpp regression in Jazzy requiring a 'warm up' spin
54+
callback_group_executor_.spin_all(std::chrono::milliseconds(1));
5255
}
5356

5457
inline BT::NodeStatus GoalUpdater::tick()
@@ -57,8 +60,6 @@ inline BT::NodeStatus GoalUpdater::tick()
5760

5861
getInput("input_goal", goal);
5962

60-
// Spin multiple times due to rclcpp regression in Jazzy requiring a 'warm up' spin
61-
callback_group_executor_.spin_all(std::chrono::milliseconds(1));
6263
callback_group_executor_.spin_all(std::chrono::milliseconds(49));
6364

6465
if (last_goal_received_.header.stamp != rclcpp::Time(0)) {

0 commit comments

Comments
 (0)