-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding Bt to cancel wait, spin and backup (#2856)
* adding Bt to cancel wait * Adding cancel for spining recovery * adding BT for cancelling the backup behavior * adding cancel recoveries to param files for wider test coverage * updating BT's XML * updating XML nodes
- Loading branch information
1 parent
e173995
commit 95e76c6
Showing
19 changed files
with
891 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/back_up_cancel_node.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (c) 2022 Neobotix GmbH | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__BACK_UP_CANCEL_NODE_HPP_ | ||
#define NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__BACK_UP_CANCEL_NODE_HPP_ | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "nav2_msgs/action/back_up.hpp" | ||
|
||
#include "nav2_behavior_tree/bt_cancel_action_node.hpp" | ||
|
||
namespace nav2_behavior_tree | ||
{ | ||
|
||
/** | ||
* @brief A nav2_behavior_tree::BtActionNode class that wraps nav2_msgs::action::BackUp | ||
*/ | ||
class BackUpCancel : public BtCancelActionNode<nav2_msgs::action::BackUp> | ||
{ | ||
public: | ||
/** | ||
* @brief A constructor for nav2_behavior_tree::BackUpAction | ||
* @param xml_tag_name Name for the XML tag for this node | ||
* @param action_name Action name this node creates a client for | ||
* @param conf BT node configuration | ||
*/ | ||
BackUpCancel( | ||
const std::string & xml_tag_name, | ||
const std::string & action_name, | ||
const BT::NodeConfiguration & conf); | ||
|
||
/** | ||
* @brief Creates list of BT ports | ||
* @return BT::PortsList Containing basic ports along with node-specific ports | ||
*/ | ||
static BT::PortsList providedPorts() | ||
{ | ||
return providedBasicPorts( | ||
{ | ||
}); | ||
} | ||
}; | ||
|
||
} // namespace nav2_behavior_tree | ||
|
||
#endif // NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__BACK_UP_CANCEL_NODE_HPP_ |
59 changes: 59 additions & 0 deletions
59
nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/spin_cancel_node.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (c) 2022 Neobotix GmbH | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__SPIN_CANCEL_NODE_HPP_ | ||
#define NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__SPIN_CANCEL_NODE_HPP_ | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "nav2_msgs/action/spin.hpp" | ||
|
||
#include "nav2_behavior_tree/bt_cancel_action_node.hpp" | ||
|
||
namespace nav2_behavior_tree | ||
{ | ||
|
||
/** | ||
* @brief A nav2_behavior_tree::BtActionNode class that wraps nav2_msgs::action::Wait | ||
*/ | ||
class SpinCancel : public BtCancelActionNode<nav2_msgs::action::Spin> | ||
{ | ||
public: | ||
/** | ||
* @brief A constructor for nav2_behavior_tree::WaitAction | ||
* @param xml_tag_name Name for the XML tag for this node | ||
* @param action_name Action name this node creates a client for | ||
* @param conf BT node configuration | ||
*/ | ||
SpinCancel( | ||
const std::string & xml_tag_name, | ||
const std::string & action_name, | ||
const BT::NodeConfiguration & conf); | ||
|
||
/** | ||
* @brief Creates list of BT ports | ||
* @return BT::PortsList Containing basic ports along with node-specific ports | ||
*/ | ||
static BT::PortsList providedPorts() | ||
{ | ||
return providedBasicPorts( | ||
{ | ||
}); | ||
} | ||
}; | ||
|
||
} // namespace nav2_behavior_tree | ||
|
||
#endif // NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__SPIN_CANCEL_NODE_HPP_ |
59 changes: 59 additions & 0 deletions
59
nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/wait_cancel_node.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (c) 2022 Neobotix GmbH | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__WAIT_CANCEL_NODE_HPP_ | ||
#define NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__WAIT_CANCEL_NODE_HPP_ | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "nav2_msgs/action/wait.hpp" | ||
|
||
#include "nav2_behavior_tree/bt_cancel_action_node.hpp" | ||
|
||
namespace nav2_behavior_tree | ||
{ | ||
|
||
/** | ||
* @brief A nav2_behavior_tree::BtActionNode class that wraps nav2_msgs::action::Wait | ||
*/ | ||
class WaitCancel : public BtCancelActionNode<nav2_msgs::action::Wait> | ||
{ | ||
public: | ||
/** | ||
* @brief A constructor for nav2_behavior_tree::WaitAction | ||
* @param xml_tag_name Name for the XML tag for this node | ||
* @param action_name Action name this node creates a client for | ||
* @param conf BT node configuration | ||
*/ | ||
WaitCancel( | ||
const std::string & xml_tag_name, | ||
const std::string & action_name, | ||
const BT::NodeConfiguration & conf); | ||
|
||
/** | ||
* @brief Creates list of BT ports | ||
* @return BT::PortsList Containing basic ports along with node-specific ports | ||
*/ | ||
static BT::PortsList providedPorts() | ||
{ | ||
return providedBasicPorts( | ||
{ | ||
}); | ||
} | ||
}; | ||
|
||
} // namespace nav2_behavior_tree | ||
|
||
#endif // NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__WAIT_CANCEL_NODE_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2022 Neobotix GmbH | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include <string> | ||
#include <memory> | ||
|
||
#include "std_msgs/msg/string.hpp" | ||
|
||
#include "nav2_behavior_tree/plugins/action/back_up_cancel_node.hpp" | ||
|
||
namespace nav2_behavior_tree | ||
{ | ||
|
||
BackUpCancel::BackUpCancel( | ||
const std::string & xml_tag_name, | ||
const std::string & action_name, | ||
const BT::NodeConfiguration & conf) | ||
: BtCancelActionNode<nav2_msgs::action::BackUp>(xml_tag_name, action_name, conf) | ||
{ | ||
} | ||
|
||
} // namespace nav2_behavior_tree | ||
|
||
#include "behaviortree_cpp_v3/bt_factory.h" | ||
BT_REGISTER_NODES(factory) | ||
{ | ||
BT::NodeBuilder builder = | ||
[](const std::string & name, const BT::NodeConfiguration & config) | ||
{ | ||
return std::make_unique<nav2_behavior_tree::BackUpCancel>( | ||
name, "backup", config); | ||
}; | ||
|
||
factory.registerBuilder<nav2_behavior_tree::BackUpCancel>( | ||
"CancelBackUp", builder); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2022 Neobotix GmbH | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include <string> | ||
#include <memory> | ||
|
||
#include "std_msgs/msg/string.hpp" | ||
|
||
#include "nav2_behavior_tree/plugins/action/spin_cancel_node.hpp" | ||
|
||
namespace nav2_behavior_tree | ||
{ | ||
|
||
SpinCancel::SpinCancel( | ||
const std::string & xml_tag_name, | ||
const std::string & action_name, | ||
const BT::NodeConfiguration & conf) | ||
: BtCancelActionNode<nav2_msgs::action::Spin>(xml_tag_name, action_name, conf) | ||
{ | ||
} | ||
|
||
} // namespace nav2_behavior_tree | ||
|
||
#include "behaviortree_cpp_v3/bt_factory.h" | ||
BT_REGISTER_NODES(factory) | ||
{ | ||
BT::NodeBuilder builder = | ||
[](const std::string & name, const BT::NodeConfiguration & config) | ||
{ | ||
return std::make_unique<nav2_behavior_tree::SpinCancel>( | ||
name, "spin", config); | ||
}; | ||
|
||
factory.registerBuilder<nav2_behavior_tree::SpinCancel>( | ||
"CancelSpin", builder); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2022 Neobotix GmbH | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include <string> | ||
#include <memory> | ||
|
||
#include "std_msgs/msg/string.hpp" | ||
|
||
#include "nav2_behavior_tree/plugins/action/wait_cancel_node.hpp" | ||
|
||
namespace nav2_behavior_tree | ||
{ | ||
|
||
WaitCancel::WaitCancel( | ||
const std::string & xml_tag_name, | ||
const std::string & action_name, | ||
const BT::NodeConfiguration & conf) | ||
: BtCancelActionNode<nav2_msgs::action::Wait>(xml_tag_name, action_name, conf) | ||
{ | ||
} | ||
|
||
} // namespace nav2_behavior_tree | ||
|
||
#include "behaviortree_cpp_v3/bt_factory.h" | ||
BT_REGISTER_NODES(factory) | ||
{ | ||
BT::NodeBuilder builder = | ||
[](const std::string & name, const BT::NodeConfiguration & config) | ||
{ | ||
return std::make_unique<nav2_behavior_tree::WaitCancel>( | ||
name, "wait", config); | ||
}; | ||
|
||
factory.registerBuilder<nav2_behavior_tree::WaitCancel>( | ||
"CancelWait", builder); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.