Skip to content

Commit fdf6180

Browse files
committed
ignore if no timestamps
Signed-off-by: Tony Najjar <[email protected]>
1 parent f01f551 commit fdf6180

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ inline BT::NodeStatus GoalUpdater::tick()
7272
callback_group_executor_.spin_all(std::chrono::milliseconds(49));
7373

7474
if (last_goal_received_.header.stamp == rclcpp::Time(0)) {
75-
// if the goal doesn't have a timestamp, we don't do any timestamp-checking and accept it
76-
setOutput("output_goal", last_goal_received_);
75+
// if the goal doesn't have a timestamp, we reject it
76+
RCLCPP_WARN(
77+
node_->get_logger(), "The received goal has no timestamp. Ignoring.");
78+
setOutput("output_goal", goal);
7779
} else {
7880
auto last_goal_received_time = rclcpp::Time(last_goal_received_.header.stamp);
7981
auto goal_time = rclcpp::Time(goal.header.stamp);
@@ -101,7 +103,9 @@ inline BT::NodeStatus GoalUpdater::tick()
101103
}
102104
}
103105
if (last_goals_received_time > most_recent_goal_time) {
104-
setOutput("output_goals", last_goals_received_.poses);
106+
RCLCPP_WARN(
107+
node_->get_logger(), "The received goals array has no timestamp. Ignoring.");
108+
setOutput("output_goals", goals);
105109
} else {
106110
RCLCPP_WARN(
107111
node_->get_logger(),

0 commit comments

Comments
 (0)