Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Tony Najjar <[email protected]>
  • Loading branch information
tonynajjar committed Nov 28, 2024
1 parent 9c956bd commit e16fbb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace nav2_behavior_tree
class GoalUpdater : public BT::DecoratorNode
{
public:
typedef std::vector<geometry_msgs::msg::PoseStamped> Goals;
/**
* @brief A constructor for nav2_behavior_tree::GoalUpdater
* @param xml_tag_name Name for the XML tag for this node
Expand All @@ -55,10 +56,10 @@ class GoalUpdater : public BT::DecoratorNode
{
return {
BT::InputPort<geometry_msgs::msg::PoseStamped>("input_goal", "Original Goal"),
BT::InputPort<nav2_msgs::msg::PosesStamped>("input_goals", "Original Goals"),
BT::InputPort<Goals>("input_goals", "Original Goals"),
BT::OutputPort<geometry_msgs::msg::PoseStamped>("output_goal",
"Received Goal by subscription"),
BT::OutputPort<nav2_msgs::msg::PosesStamped>("output_goals", "Received Goals by subscription")
BT::OutputPort<Goals>("output_goals", "Received Goals by subscription")
};
}

Expand All @@ -85,7 +86,7 @@ class GoalUpdater : public BT::DecoratorNode
rclcpp::Subscription<nav2_msgs::msg::PosesStamped>::SharedPtr goals_sub_;

geometry_msgs::msg::PoseStamped last_goal_received_;
nav2_msgs::msg::PosesStamped last_goals_received_;
Goals last_goals_received_;

rclcpp::Node::SharedPtr node_;
rclcpp::CallbackGroup::SharedPtr callback_group_;
Expand Down
6 changes: 3 additions & 3 deletions nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ GoalUpdater::GoalUpdater(
inline BT::NodeStatus GoalUpdater::tick()
{
geometry_msgs::msg::PoseStamped goal;
nav2_msgs::msg::PosesStamped goals;
Goals goals;

getInput("input_goal", goal);
getInput("input_goals", goals);
Expand All @@ -84,7 +84,7 @@ inline BT::NodeStatus GoalUpdater::tick()
}
}

if (!last_goals_received_.poses.empty()) {
if (!last_goals_received_.empty()) {
goals = last_goals_received_;

Check warning on line 88 in nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp

View check run for this annotation

Codecov / codecov/patch

nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp#L88

Added line #L88 was not covered by tests
}

Expand All @@ -104,7 +104,7 @@ void
GoalUpdater::callback_updated_goals(const nav2_msgs::msg::PosesStamped::SharedPtr msg)

Check warning on line 104 in nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp

View check run for this annotation

Codecov / codecov/patch

nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp#L104

Added line #L104 was not covered by tests
{
std::lock_guard<std::mutex> lock(mutex_);
last_goals_received_ = *msg;
last_goals_received_ = msg->poses;

Check warning on line 107 in nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp

View check run for this annotation

Codecov / codecov/patch

nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp#L106-L107

Added lines #L106 - L107 were not covered by tests
}

} // namespace nav2_behavior_tree
Expand Down

0 comments on commit e16fbb0

Please sign in to comment.