-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Mission planner bt #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
699debf
Integrate shell code for control path (#7)
69a647c
Ros2 devel (#8)
b7c30bb
Move some of the task base classes out to separate directories. (#9)
435db94
Start implementation of TaskClient and TaskServer (#10)
f05decc
Continue implementation of the architectural shell for the command ta…
44989f1
Merge branch 'master' of https://github.com/ros-planning/navigation2 …
mhpanah 6b3bf7e
Merge branch 'ros2_devel' of https://github.com/ros-planning/navigati…
mhpanah 8acca22
Added dummy BT mission planner
mhpanah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains hidden or 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,23 @@ | ||
| cmake_minimum_required(VERSION 3.5) | ||
| project(MissionPlanner_BT) | ||
| aux_source_directory(./src/ SRC_LIST) | ||
|
|
||
| # Default to C++14 | ||
| if(NOT CMAKE_CXX_STANDARD) | ||
| set(CMAKE_CXX_STANDARD 14) | ||
| endif() | ||
|
|
||
| if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| add_compile_options(-Wall -Wextra -Wpedantic) | ||
| endif() | ||
|
|
||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") | ||
|
|
||
| find_package(BTpp REQUIRED) | ||
|
|
||
| include_directories(include ${BTpp_INCLUDE_DIRS}) | ||
|
|
||
| add_executable(${PROJECT_NAME} ${SRC_LIST}) | ||
|
|
||
| TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${BTpp_LIBRARIES}) | ||
|
|
||
This file contains hidden or 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,5 @@ | ||
| #Mission Planner Behaivor Tree | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Behaivor -> Behaviour |
||
| ------ | ||
| Clone/Download and install the library [BT++](https://github.com/miccol/Behavior-Tree) system-wide | ||
|
|
||
|
|
||
This file contains hidden or 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,24 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // 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 <behavior_tree.h> | ||
|
|
||
| class CancelAction : public BT::ActionNode | ||
| { | ||
| public: | ||
| CancelAction(std::string name); | ||
| ~CancelAction(); | ||
| BT::ReturnStatus Tick(); | ||
| void Halt(); | ||
| }; |
This file contains hidden or 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,27 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // 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 <behavior_tree.h> | ||
|
|
||
| class CancelCondition : public BT::ConditionNode | ||
| { | ||
| public: | ||
| CancelCondition(std::string name); | ||
| ~CancelCondition(); | ||
| void set_boolean_value(bool boolean_value); | ||
| BT::ReturnStatus Tick(); | ||
|
|
||
| private: | ||
| bool boolean_value_; | ||
| }; |
This file contains hidden or 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,24 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // 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 <behavior_tree.h> | ||
|
|
||
| class Nav2PoseAction : public BT::ActionNode | ||
| { | ||
| public: | ||
| Nav2PoseAction(std::string name); | ||
| ~Nav2PoseAction(); | ||
| BT::ReturnStatus Tick(); | ||
| void Halt(); | ||
| }; |
This file contains hidden or 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,27 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // 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 <behavior_tree.h> | ||
|
|
||
| class Nav2PoseCondition : public BT::ConditionNode | ||
| { | ||
| public: | ||
| Nav2PoseCondition(std::string name); | ||
| ~Nav2PoseCondition(); | ||
| void set_boolean_value(bool boolean_value); | ||
| BT::ReturnStatus Tick(); | ||
|
|
||
| private: | ||
| bool boolean_value_; | ||
| }; |
This file contains hidden or 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,24 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // 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 <behavior_tree.h> | ||
|
|
||
| class PlannerAction : public BT::ActionNode | ||
| { | ||
| public: | ||
| PlannerAction(std::string name); | ||
| ~PlannerAction(); | ||
| BT::ReturnStatus Tick(); | ||
| void Halt(); | ||
| }; |
This file contains hidden or 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,24 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // 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 <behavior_tree.h> | ||
|
|
||
| class TakePicAction : public BT::ActionNode | ||
| { | ||
| public: | ||
| TakePicAction(std::string name); | ||
| ~TakePicAction(); | ||
| BT::ReturnStatus Tick(); | ||
| void Halt(); | ||
| }; |
This file contains hidden or 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,27 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // 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 <behavior_tree.h> | ||
|
|
||
| class TakePicCondition : public BT::ConditionNode | ||
| { | ||
| public: | ||
| TakePicCondition(std::string name); | ||
| ~TakePicCondition(); | ||
| void set_boolean_value(bool boolean_value); | ||
| BT::ReturnStatus Tick(); | ||
|
|
||
| private: | ||
| bool boolean_value_; | ||
| }; |
This file contains hidden or 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,45 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // 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 "CancelAction.h" | ||
|
|
||
| CancelAction::CancelAction(std::string name) : ActionNode::ActionNode(name) | ||
| { | ||
| } | ||
|
|
||
| BT::ReturnStatus CancelAction::Tick() | ||
| { | ||
| if (is_halted()) | ||
| { | ||
| return BT::HALTED; | ||
| } | ||
| int count = 0; | ||
| while (count != 10) | ||
| { | ||
| count++; | ||
| std::cout << "Canceling the mission... " << count << std::endl; | ||
| if (count == 2) | ||
| { | ||
| count = 0; | ||
| std::cout << "Mission is canceled!" << std::endl; | ||
| return BT::SUCCESS; | ||
| } | ||
| std::this_thread::sleep_for(std::chrono::seconds(1)); | ||
| } | ||
| } | ||
|
|
||
| void CancelAction::Halt() | ||
| { | ||
| std::cout << "Cancel Action is halted!" << std::endl; | ||
| } |
This file contains hidden or 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,42 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // 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 "CancelCondition.h" | ||
|
|
||
| CancelCondition::CancelCondition(std::string name) : BT::ConditionNode::ConditionNode(name) | ||
| { | ||
| type_ = BT::CONDITION_NODE; | ||
| boolean_value_ = true; | ||
| } | ||
|
|
||
| CancelCondition::~CancelCondition() {} | ||
|
|
||
| BT::ReturnStatus CancelCondition::Tick() | ||
| { | ||
| if (boolean_value_) | ||
| { | ||
| set_status(BT::SUCCESS); | ||
| return BT::SUCCESS; | ||
| } | ||
| else | ||
| { | ||
| set_status(BT::FAILURE); | ||
| return BT::FAILURE; | ||
| } | ||
| } | ||
|
|
||
| void CancelCondition::set_boolean_value(bool boolean_value) | ||
| { | ||
| boolean_value_ = boolean_value; | ||
| } |
This file contains hidden or 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,48 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // 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 "Nav2PoseAction.h" | ||
|
|
||
| Nav2PoseAction::Nav2PoseAction(std::string name) : ActionNode::ActionNode(name) | ||
| { | ||
| } | ||
|
|
||
| BT::ReturnStatus Nav2PoseAction::Tick() | ||
| { | ||
| if (is_halted()) | ||
| { | ||
| return BT::HALTED; | ||
| } | ||
| int count = 0; | ||
| while (count != 10) | ||
| { | ||
| count++; | ||
| std::cout << "Navigating to pose.. " << count << std::endl; | ||
| if (count == 5) | ||
| { | ||
| count = 0; | ||
| std::cout << "Navigating to pose has succeeded!" << std::endl; | ||
| std::this_thread::sleep_for(std::chrono::seconds(1)); | ||
| return BT::SUCCESS; | ||
| } | ||
| std::this_thread::sleep_for(std::chrono::seconds(1)); | ||
| //else | ||
| //return BT::RUNNING; | ||
| } | ||
| } | ||
|
|
||
| void Nav2PoseAction::Halt() | ||
| { | ||
| std::cout << "Nav2Pose Action is halted!" << std::endl; | ||
| } |
This file contains hidden or 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,42 @@ | ||
| // Copyright (c) 2018 Intel Corporation | ||
| // | ||
| // 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 "Nav2PoseCondition.h" | ||
|
|
||
| Nav2PoseCondition::Nav2PoseCondition(std::string name) : BT::ConditionNode::ConditionNode(name) | ||
| { | ||
| type_ = BT::CONDITION_NODE; | ||
| boolean_value_ = true; | ||
| } | ||
|
|
||
| Nav2PoseCondition::~Nav2PoseCondition() {} | ||
|
|
||
| BT::ReturnStatus Nav2PoseCondition::Tick() | ||
| { | ||
| if (boolean_value_) | ||
| { | ||
| set_status(BT::SUCCESS); | ||
| return BT::SUCCESS; | ||
| } | ||
| else | ||
| { | ||
| set_status(BT::FAILURE); | ||
| return BT::FAILURE; | ||
| } | ||
| } | ||
|
|
||
| void Nav2PoseCondition::set_boolean_value(bool boolean_value) | ||
| { | ||
| boolean_value_ = boolean_value; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should BTpp be BTcpp?