Skip to content

Commit 564ca79

Browse files
committed
Merge commit 'eb9ff2e' into develop
2 parents cfafaee + eb9ff2e commit 564ca79

34 files changed

+3358
-294
lines changed

CHANGELOG.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,65 @@
22
Changelog for package behaviortree_cpp
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
3.5.6 (2021-02-03)
6+
------------------
7+
* fix issue `#227 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/227>`_
8+
* fix issue `#256 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/256>`_
9+
* Merge branch 'master' of https://github.com/BehaviorTree/BehaviorTree.CPP
10+
* fix issue `#250 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/250>`_
11+
* Fixed typos on SequenceNode.md (`#254 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/254>`_)
12+
* Contributors: Davide Faconti, LucasNolasco
13+
14+
3.5.5 (2021-01-27)
15+
------------------
16+
* fix issue `#251 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/251>`_
17+
* Contributors: Davide Faconti
18+
19+
3.5.4 (2020-12-10)
20+
------------------
21+
* Update bt_factory.cpp (`#245 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/245>`_)
22+
* Use the latest version of zmq.hpp
23+
* Improved switching BTs with active Groot monitoring (ZMQ logger destruction) (`#244 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/244>`_)
24+
* Skip 100ms (max) wait for detached thread
25+
* add {} to single line if statements
26+
* Update retry_node.cpp
27+
* fix
28+
* fix issue `#230 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/230>`_
29+
* Contributors: Davide Faconti, Florian Gramß, amangiat88
30+
31+
3.5.3 (2020-09-10)
32+
------------------
33+
* fix issue `#228 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/228>`_ . Retry and Repeat node need to halt the child
34+
* better tutorial
35+
* Contributors: Davide Faconti
36+
37+
3.5.2 (2020-09-02)
38+
------------------
39+
* fix warning and follow coding standard
40+
* docs: Small changes to tutorial 02 (`#225 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/225>`_)
41+
Co-authored-by: Valerio Magnago <[email protected]>
42+
* Merge branch 'master' of https://github.com/BehaviorTree/BehaviorTree.CPP
43+
* tutorial 1 fixed
44+
* decreasing warning level to fix issue `#220 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/220>`_
45+
* fix compilation
46+
* Allow BT factory to define clock source for TimerQueue/TimerNode (`#215 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/215>`_)
47+
* Allow BT factory to define clock source for TimerQueue/TimerNode
48+
* Fix unit tests
49+
Co-authored-by: Cam Fulton <[email protected]>
50+
Co-authored-by: Davide Faconti <[email protected]>
51+
* Added delay node and wait for enter keypress node (`#182 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/182>`_)
52+
* Added delay node and wait for enter press node
53+
* Fixed unsigned int to int conversion bug
54+
* Added a new timer to keep a track of delay timeout and return RUNNING in the meanwhile
55+
* Removed wait for keypress node
56+
* Review changes suggested by gramss
57+
Co-authored-by: Indraneel Patil <[email protected]>
58+
* Update SequenceNode.md (`#211 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/211>`_)
59+
* add failure threshold to parallel node with tests (`#216 <https://github.com/BehaviorTree/BehaviorTree.CPP/issues/216>`_)
60+
* Update tutorial_05_subtrees.md
61+
I believe that the API has been updated. Reflecting the same in this tutorial.
62+
* Contributors: Aayush Naik, Davide Faconti, Indraneel Patil, Renan Salles, Valerio Magnago, Wuqiqi123, fultoncjb
63+
564
3.5.1 (2020-06-11)
665
------------------
766
* trying to fix compilation in eloquent Minor fix on line 19

CMakeLists.txt

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@ endif()
1515

1616
#---- Include boost to add coroutines ----
1717
find_package(Boost COMPONENTS coroutine QUIET)
18+
1819
if(Boost_FOUND)
19-
include_directories(${Boost_INCLUDE_DIRS})
2020
string(REPLACE "." "0" Boost_VERSION_NODOT ${Boost_VERSION})
2121
if(NOT Boost_VERSION_NODOT VERSION_LESS 105900)
2222
message(STATUS "Found boost::coroutine2.")
2323
add_definitions(-DBT_BOOST_COROUTINE2)
2424
set(BT_COROUTINES true)
2525
elseif(NOT Boost_VERSION_NODOT VERSION_LESS 105300)
2626
message(STATUS "Found boost::coroutine.")
27-
include_directories(${Boost_INCLUDE_DIRS})
2827
add_definitions(-DBT_BOOST_COROUTINE)
2928
set(BT_COROUTINES true)
3029
endif()
30+
include_directories(${Boost_INCLUDE_DIRS})
3131
endif()
3232

33+
3334
if(NOT DEFINED BT_COROUTINES)
3435
message(STATUS "Coroutines disabled. Install Boost to enable them (version 1.59+ recommended).")
3536
add_definitions(-DBT_NO_COROUTINES)
@@ -47,16 +48,15 @@ option(BUILD_SHARED_LIBS "Build shared libraries" ON)
4748
find_package(Threads)
4849
find_package(ZMQ)
4950

50-
list(APPEND BEHAVIOR_TREE_EXTERNAL_LIBRARIES
51+
list(APPEND BEHAVIOR_TREE_PUBLIC_LIBRARIES
5152
${CMAKE_THREAD_LIBS_INIT}
5253
${CMAKE_DL_LIBS}
53-
${Boost_LIBRARIES} )
54+
)
5455

5556
if( ZMQ_FOUND )
5657
message(STATUS "ZeroMQ found.")
5758
add_definitions( -DZMQ_FOUND )
5859
list(APPEND BT_SOURCE src/loggers/bt_zmq_publisher.cpp)
59-
list(APPEND BEHAVIOR_TREE_EXTERNAL_LIBRARIES ${ZMQ_LIBRARIES})
6060
else()
6161
message(WARNING "ZeroMQ NOT found. Skipping the build of [PublisherZMQ] and [bt_recorder].")
6262
endif()
@@ -100,17 +100,11 @@ elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)
100100
CFG_EXTRAS behaviortree_cpp-extras.cmake # ZMQ found var
101101
)
102102

103-
list(APPEND BEHAVIOR_TREE_EXTERNAL_LIBRARIES ${catkin_LIBRARIES})
103+
list(APPEND BEHAVIOR_TREE_PUBLIC_LIBRARIES ${catkin_LIBRARIES})
104104
set(BUILD_TOOL_INCLUDE_DIRS ${catkin_INCLUDE_DIRS})
105105

106106
elseif(BUILD_UNIT_TESTS)
107-
find_package(GTest)
108-
109-
if(NOT GTEST_FOUND)
110-
message(WARNING " GTest missing! You may want to follow these instructions:")
111-
message(WARNING " https://gist.github.com/Cartexius/4c437c084d6e388288201aadf9c8cdd5")
112-
endif()
113-
107+
find_package(GTest REQUIRED)
114108
endif()
115109
if(NOT MSVC)
116110
list(APPEND BEHAVIOR_TREE_EXTERNAL_LIBRARIES "dw")
@@ -167,7 +161,7 @@ list(APPEND BT_SOURCE
167161
src/decorators/repeat_node.cpp
168162
src/decorators/retry_node.cpp
169163
src/decorators/subtree_node.cpp
170-
src/decorators/timeout_node.cpp
164+
src/decorators/delay_node.cpp
171165

172166
src/controls/if_then_else_node.cpp
173167
src/controls/fallback_node.cpp
@@ -193,7 +187,7 @@ if(CURSES_FOUND)
193187
list(APPEND BT_SOURCE
194188
src/controls/manual_node.cpp
195189
)
196-
list(APPEND BEHAVIOR_TREE_EXTERNAL_LIBRARIES ${CURSES_LIBRARIES})
190+
list(APPEND BEHAVIOR_TREE_PUBLIC_LIBRARIES ${CURSES_LIBRARIES})
197191
add_definitions(-DNCURSES_FOUND)
198192
endif()
199193

@@ -220,7 +214,17 @@ if( ZMQ_FOUND )
220214
endif()
221215

222216
target_link_libraries(${BEHAVIOR_TREE_LIBRARY} PUBLIC
223-
${BEHAVIOR_TREE_EXTERNAL_LIBRARIES})
217+
${BEHAVIOR_TREE_PUBLIC_LIBRARIES})
218+
219+
target_link_libraries(${BEHAVIOR_TREE_LIBRARY} PRIVATE
220+
${Boost_LIBRARIES}
221+
${ZMQ_LIBRARIES})
222+
223+
#get_target_property(my_libs ${BEHAVIOR_TREE_LIBRARY} INTERFACE_LINK_LIBRARIES)
224+
#list(REMOVE_ITEM _libs X)
225+
#message("my_libs: ${my_libs}")
226+
227+
#set_target_properties(${BEHAVIOR_TREE_LIBRARY} PROPERTIES INTERFACE_LINK_LIBRARIES "")
224228

225229
target_compile_definitions(${BEHAVIOR_TREE_LIBRARY} PRIVATE $<$<CONFIG:Debug>:TINYXML2_DEBUG>)
226230

@@ -235,7 +239,7 @@ if( ZMQ_FOUND )
235239
endif()
236240

237241
if(MSVC)
238-
target_compile_options(${BEHAVIOR_TREE_LIBRARY} PRIVATE /W4 /WX)
242+
target_compile_options(${BEHAVIOR_TREE_LIBRARY} PRIVATE /W3 /WX)
239243
else()
240244
target_compile_options(${BEHAVIOR_TREE_LIBRARY} PRIVATE
241245
-Wall -Wextra -Werror=return-type -Wfatal-errors)

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ You can learn about the main concepts, the API and the tutorials here: https://w
4545

4646
To find more details about the conceptual ideas that make this implementation different from others, you can read the [final deliverable of the project MOOD2Be](https://github.com/BehaviorTree/BehaviorTree.CPP/blob/master/MOOD2Be_final_report.pdf).
4747

48+
<!-- # Does your company use BehaviorTree.CPP?
49+
50+
No company, institution or public/private funding is currently supporting the development of BehaviorTree.CPP and Groot.
51+
52+
Consider becoming a **sponsor** to support bug fixing and development of new features. You can find contact details in [package.xml](package.xml). -->
4853

4954
# Design principles
5055

@@ -126,7 +131,7 @@ to your catkin workspace.
126131

127132
# Acknowledgement
128133

129-
This library was developed at **Eurecat - https://eurecat.org/en/** (main author, Davide Faconti) in a joint effort
134+
This library was initially developed at **Eurecat - https://eurecat.org/en/** (main author, Davide Faconti) in a joint effort
130135
with the **Italian Institute of Technology** (Michele Colledanchise).
131136

132137
This software is one of the main components of [MOOD2Be](https://eurecat.org/en/portfolio-items/mood2be/),
@@ -155,7 +160,7 @@ The Preprint version (free) is available here: https://arxiv.org/abs/1709.00084
155160
The MIT License (MIT)
156161

157162
Copyright (c) 2014-2018 Michele Colledanchise
158-
Copyright (c) 2018-2020 Davide Faconti
163+
Copyright (c) 2018-2021 Davide Faconti
159164

160165
Permission is hereby granted, free of charge, to any person obtaining a copy
161166
of this software and associated documentation files (the "Software"), to deal

docs/SequenceNode.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ This tree represents the behavior of a sniper in a computer game.
4545
status = RUNNING;
4646
// _index is a private member
4747

48-
while( index < number_of_children)
48+
while(_index < number_of_children)
4949
{
50-
child_status = child[index]->tick();
50+
child_status = child[_index]->tick();
5151
5252
if( child_status == SUCCESS ) {
5353
_index++;
@@ -72,7 +72,7 @@ This tree represents the behavior of a sniper in a computer game.
7272

7373
This node is particularly useful to continuously check Conditions; but
7474
the user should also be careful when using asynchronous children, to be
75-
sure that thy are not ticked more often that expected.
75+
sure that they are not ticked more often that expected.
7676

7777
Let's take a look at another example:
7878

docs/tutorial_01_first_tree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Let's consider the following XML file named __my_tree.xml__:
107107
<root main_tree_to_execute = "MainTree" >
108108
<BehaviorTree ID="MainTree">
109109
<Sequence name="root_sequence">
110-
<SayHello name="action_hello"/>
110+
<CheckBattery name="check_battery"/>
111111
<OpenGripper name="open_gripper"/>
112112
<ApproachObject name="approach_object"/>
113113
<CloseGripper name="close_gripper"/>

docs/tutorial_02_basic_ports.md

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,27 @@ class SaySomething : public SyncActionNode
9393

9494
```
9595

96+
Alternatively the same functionality can be implemented in a simple function. This function takes an instance of `BT:TreeNode` as input in order to access the "message" Input Port:
97+
98+
```c++
99+
// Simple function that return a NodeStatus
100+
BT::NodeStatus SaySomethingSimple(BT::TreeNode& self)
101+
{
102+
Optional<std::string> msg = self.getInput<std::string>("message");
103+
// Check if optional is valid. If not, throw its error
104+
if (!msg)
105+
{
106+
throw BT::RuntimeError("missing required input [message]: ", msg.error());
107+
}
108+
109+
// use the method value() to extract the valid message.
110+
std::cout << "Robot says: " << msg.value() << std::endl;
111+
return NodeStatus::SUCCESS;
112+
}
113+
```
114+
115+
116+
96117
When a custom TreeNode has input and/or output ports, these ports must be
97118
declared in the __static__ method:
98119
@@ -109,7 +130,7 @@ check the validity of the returned value and to decide what to do:
109130
- Return `NodeStatus::FAILURE`?
110131
- Throw an exception?
111132
- Use a different default value?
112-
133+
113134
!!! Warning "Important"
114135
It is __always__ recommended to call the method `getInput()` inside the
115136
`tick()`, and __not__ in the constructor of the class.
@@ -118,11 +139,11 @@ check the validity of the returned value and to decide what to do:
118139
the nature of the input, which could be either static or dynamic.
119140
A dynamic input can change at run-time, for this reason it should be read
120141
periodically.
121-
142+
122143
## Output ports
123144

124145
An input port pointing to the entry of the blackboard will be valid only
125-
if another node have already wrritten "something" inside that same entry.
146+
if another node have already written "something" inside that same entry.
126147

127148
`ThinkWhatToSay` is an example of Node that uses an __output port__ to write a
128149
string into an entry.
@@ -172,24 +193,31 @@ In this example, a Sequence of 5 Actions is executed:
172193
`SaySomething2` is a SimpleActionNode.
173194

174195
```XML
175-
<root>
176-
<BehaviorTree>
177-
<Sequence name="root">
178-
<SaySomething message="start thinking..." />
179-
<ThinkWhatToSay text="{the_answer}"/>
180-
<SaySomething message="{the_answer}" />
181-
<SaySomething2 message="SaySomething2 works too..." />
182-
<SaySomething2 message="{the_answer}" />
183-
</Sequence>
184-
</BehaviorTree>
185-
</root>
196+
<root main_tree_to_execute = "MainTree" >
197+
<BehaviorTree ID="MainTree">
198+
<Sequence name="root_sequence">
199+
<SaySomething message="start thinking..." />
200+
<ThinkWhatToSay text="{the_answer}"/>
201+
<SaySomething message="{the_answer}" />
202+
<SaySomething2 message="SaySomething2 works too..." />
203+
<SaySomething2 message="{the_answer}" />
204+
</Sequence>
205+
</BehaviorTree>
206+
</root>
186207
```
187208

188209
The C++ code:
189210

190211
```C++
212+
#include "behaviortree_cpp_v3/bt_factory.h"
213+
214+
// file that contains the custom nodes definitions
215+
#include "dummy_nodes.h"
216+
191217
int main()
192218
{
219+
using namespace DummyNodes;
220+
193221
BehaviorTreeFactory factory;
194222

195223
factory.registerNodeType<SaySomething>("SaySomething");
@@ -202,7 +230,7 @@ int main()
202230
factory.registerSimpleAction("SaySomething2", SaySomethingSimple,
203231
say_something_ports );
204232

205-
auto tree = factory.createTreeFromText(xml_text);
233+
auto tree = factory.createTreeFromFile("./my_tree.xml");
206234

207235
tree.tickRoot();
208236

@@ -223,3 +251,5 @@ this means that they "point" to the same entry of the blackboard.
223251
These ports can be connected to each other because their type is the same,
224252
i.e. `std::string`.
225253

254+
255+

docs/tutorial_05_subtrees.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ int main()
8888
auto tree = factory.createTreeFromText(xml_text);
8989

9090
// This logger prints state changes on console
91-
StdCoutLogger logger_cout(tree.rootNode());
91+
StdCoutLogger logger_cout(tree);
9292

9393
// This logger saves state changes on file
94-
FileLogger logger_file(tree.rootNode(), "bt_trace.fbl");
94+
FileLogger logger_file(tree, "bt_trace.fbl");
9595

9696
// This logger stores the execution time of each node
97-
MinitraceLogger logger_minitrace(tree.rootNode(), "bt_trace.json");
97+
MinitraceLogger logger_minitrace(tree, "bt_trace.json");
9898

9999
#ifdef ZMQ_FOUND
100100
// This logger publish status changes using ZeroMQ. Used by Groot

0 commit comments

Comments
 (0)