Skip to content

Commit a5d5c95

Browse files
nav2_behavior_tree: fix input port parsing error in AreErrorCodesPresent (ros-navigation#4986)
The getInput method does not support std::set<uint16_t> parsing. So, let's replace the type of the input port by std::vector<int> which is supported, and convert the list to a std::set<uint16_t>. This commit fixes issue ros-navigation#4985. Signed-off-by: Dylan De Coeyer <[email protected]> Signed-off-by: Sakshay Mahna <[email protected]>
1 parent 9a551ff commit a5d5c95

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

nav2_behavior_tree/include/nav2_behavior_tree/plugins/condition/are_error_codes_present_condition.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ class AreErrorCodesPresent : public BT::ConditionNode
3434
const BT::NodeConfiguration & conf)
3535
: BT::ConditionNode(condition_name, conf)
3636
{
37-
getInput<std::set<uint16_t>>("error_codes_to_check", error_codes_to_check_); //NOLINT
37+
std::vector<int> error_codes_to_check_vector;
38+
getInput("error_codes_to_check", error_codes_to_check_vector); //NOLINT
39+
40+
error_codes_to_check_ = std::set<uint16_t>(
41+
error_codes_to_check_vector.begin(),
42+
error_codes_to_check_vector.end());
3843
}
3944

4045
AreErrorCodesPresent() = delete;
@@ -55,7 +60,7 @@ class AreErrorCodesPresent : public BT::ConditionNode
5560
return
5661
{
5762
BT::InputPort<uint16_t>("error_code", "The active error codes"), //NOLINT
58-
BT::InputPort<std::set<uint16_t>>("error_codes_to_check", "Error codes to check")//NOLINT
63+
BT::InputPort<std::vector<int>>("error_codes_to_check", "Error codes to check")//NOLINT
5964
};
6065
}
6166

nav2_behavior_tree/test/plugins/condition/test_are_error_codes_present.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class AreErrorCodesPresentFixture : public nav2_behavior_tree::BehaviorTreeTestF
2828
void SetUp()
2929
{
3030
uint16_t error_code = ActionResult::NONE;
31-
std::set<uint16_t> error_codes_to_check = {ActionResult::UNKNOWN}; //NOLINT
31+
std::vector<int> error_codes_to_check = {ActionResult::UNKNOWN}; //NOLINT
3232
config_->blackboard->set("error_code", error_code);
3333
config_->blackboard->set("error_codes_to_check", error_codes_to_check);
3434

0 commit comments

Comments
 (0)