Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Nov 23, 2022
1 parent c74fa94 commit 41c1f2e
Show file tree
Hide file tree
Showing 20 changed files with 165 additions and 36 deletions.
Binary file added btcpp_logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
128 changes: 128 additions & 0 deletions btcpp_logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
######################################################
# TESTS

include_directories(include)
include_directories(include ${PROJECT_SOURCE_DIR}/3rdparty)

set(BT_TESTS
src/action_test_node.cpp
Expand Down
8 changes: 4 additions & 4 deletions tests/gtest_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static const char* xml_text_subtree = R"(

static const char* xml_text_subtree_part1 = R"(
<root>
<root BTCPP_format="4">
<BehaviorTree ID="MainTree">
<Fallback name="root_selector">
<SubTree ID="DoorClosedSubtree" />
Expand All @@ -88,7 +88,7 @@ static const char* xml_text_subtree_part1 = R"(

static const char* xml_text_subtree_part2 = R"(
<root>
<root BTCPP_format="4">
<BehaviorTree ID="DoorClosedSubtree">
<Sequence name="door_sequence">
<Decorator ID="Inverter">
Expand Down Expand Up @@ -168,7 +168,7 @@ TEST(BehaviorTreeFactory, Subtree)
TEST(BehaviorTreeFactory, Issue7)
{
const std::string xml_text_issue = R"(
<root>
<root BTCPP_format="4">
<BehaviorTree ID="ReceiveGuest">
</BehaviorTree>
</root> )";
Expand All @@ -183,7 +183,7 @@ TEST(BehaviorTreeFactory, Issue7)

static const char* xml_ports_subtree = R"(
<root BTCPP_format="4" format="4" main_tree_to_execute="MainTree">
<root BTCPP_format="4" main_tree_to_execute="MainTree">
<BehaviorTree ID="TalkToMe">
<Sequence>
Expand Down
4 changes: 2 additions & 2 deletions tests/gtest_logger_zmq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ TEST(LoggerZMQ, ZMQLoggerDeletesCleanlyAfterTickingTree)
{
// GIVEN we create a behavior tree through the BT factory and attach a ZMQ publisher to it
static constexpr auto XML = R"(
<root>
<root BTCPP_format="4">
<BehaviorTree>
<SetBlackboard output_key="arg1" value="1" />
</BehaviorTree>
Expand All @@ -30,7 +30,7 @@ TEST(LoggerZMQ, ZMQLoggerDeletesCleanlyAfterNotTickingTree)
{
// GIVEN we create a behavior tree through the BT factory and attach a ZMQ publisher to it
static constexpr auto XML = R"(
<root>
<root BTCPP_format="4">
<BehaviorTree>
<SetBlackboard output_key="arg1" value="1" />
</BehaviorTree>
Expand Down
30 changes: 15 additions & 15 deletions tests/gtest_switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ struct SwitchTest : testing::Test
BT::NodeConfig simple_switch_config_;

SwitchTest() :
action_1("action_1", milliseconds(100)),
action_42("action_42", milliseconds(100)),
action_def("action_default", milliseconds(100))
action_1("action_1", milliseconds(200)),
action_42("action_42", milliseconds(200)),
action_def("action_default", milliseconds(200))
{
BT::PortsRemapping input;
input.insert(std::make_pair("variable", "{my_var}"));
Expand Down Expand Up @@ -78,7 +78,7 @@ TEST_F(SwitchTest, DefaultCase)
ASSERT_EQ(NodeStatus::RUNNING, action_def.status());
ASSERT_EQ(NodeStatus::RUNNING, state);

std::this_thread::sleep_for(milliseconds(110));
std::this_thread::sleep_for(milliseconds(300));
state = root->executeTick();

ASSERT_EQ(NodeStatus::IDLE, action_1.status());
Expand All @@ -97,7 +97,7 @@ TEST_F(SwitchTest, Case1)
ASSERT_EQ(NodeStatus::IDLE, action_def.status());
ASSERT_EQ(NodeStatus::RUNNING, state);

std::this_thread::sleep_for(milliseconds(110));
std::this_thread::sleep_for(milliseconds(300));
state = root->executeTick();

ASSERT_EQ(NodeStatus::IDLE, action_1.status());
Expand All @@ -116,7 +116,7 @@ TEST_F(SwitchTest, Case2)
ASSERT_EQ(NodeStatus::IDLE, action_def.status());
ASSERT_EQ(NodeStatus::RUNNING, state);

std::this_thread::sleep_for(milliseconds(110));
std::this_thread::sleep_for(milliseconds(300));
state = root->executeTick();

ASSERT_EQ(NodeStatus::IDLE, action_1.status());
Expand All @@ -135,7 +135,7 @@ TEST_F(SwitchTest, CaseNone)
ASSERT_EQ(NodeStatus::RUNNING, action_def.status());
ASSERT_EQ(NodeStatus::RUNNING, state);

std::this_thread::sleep_for(milliseconds(110));
std::this_thread::sleep_for(milliseconds(300));
state = root->executeTick();

ASSERT_EQ(NodeStatus::IDLE, action_1.status());
Expand All @@ -154,7 +154,7 @@ TEST_F(SwitchTest, CaseSwitchToDefault)
ASSERT_EQ(NodeStatus::IDLE, action_def.status());
ASSERT_EQ(NodeStatus::RUNNING, state);

std::this_thread::sleep_for(milliseconds(10));
std::this_thread::sleep_for(milliseconds(20));
state = root->executeTick();
ASSERT_EQ(NodeStatus::RUNNING, action_1.status());
ASSERT_EQ(NodeStatus::IDLE, action_42.status());
Expand All @@ -163,22 +163,22 @@ TEST_F(SwitchTest, CaseSwitchToDefault)

// Switch Node does not feels changes. Only when tick.
// (not reactive)
std::this_thread::sleep_for(milliseconds(10));
std::this_thread::sleep_for(milliseconds(20));
bb->set("my_var", "");
std::this_thread::sleep_for(milliseconds(10));
std::this_thread::sleep_for(milliseconds(20));
ASSERT_EQ(NodeStatus::RUNNING, action_1.status());
ASSERT_EQ(NodeStatus::IDLE, action_42.status());
ASSERT_EQ(NodeStatus::IDLE, action_def.status());
ASSERT_EQ(NodeStatus::RUNNING, root->status());

std::this_thread::sleep_for(milliseconds(10));
std::this_thread::sleep_for(milliseconds(20));
state = root->executeTick();
ASSERT_EQ(NodeStatus::IDLE, action_1.status());
ASSERT_EQ(NodeStatus::IDLE, action_42.status());
ASSERT_EQ(NodeStatus::RUNNING, action_def.status());
ASSERT_EQ(NodeStatus::RUNNING, state);

std::this_thread::sleep_for(milliseconds(110));
std::this_thread::sleep_for(milliseconds(300));
state = root->executeTick();

ASSERT_EQ(NodeStatus::IDLE, action_1.status());
Expand All @@ -198,14 +198,14 @@ TEST_F(SwitchTest, CaseSwitchToAction2)
ASSERT_EQ(NodeStatus::RUNNING, state);

bb->set("my_var", "42");
std::this_thread::sleep_for(milliseconds(10));
std::this_thread::sleep_for(milliseconds(20));
state = root->executeTick();
ASSERT_EQ(NodeStatus::IDLE, action_1.status());
ASSERT_EQ(NodeStatus::RUNNING, action_42.status());
ASSERT_EQ(NodeStatus::IDLE, action_def.status());
ASSERT_EQ(NodeStatus::RUNNING, state);

std::this_thread::sleep_for(milliseconds(110));
std::this_thread::sleep_for(milliseconds(300));
state = root->executeTick();

ASSERT_EQ(NodeStatus::IDLE, action_1.status());
Expand All @@ -226,7 +226,7 @@ TEST_F(SwitchTest, ActionFailure)
ASSERT_EQ(NodeStatus::IDLE, action_def.status());
ASSERT_EQ(NodeStatus::RUNNING, state);

std::this_thread::sleep_for(milliseconds(110));
std::this_thread::sleep_for(milliseconds(300));
state = root->executeTick();

ASSERT_EQ(NodeStatus::FAILURE, state);
Expand Down
2 changes: 1 addition & 1 deletion tests/gtest_wakeup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ TEST(WakeUp, BasicTest)
{
static const char* xml_text = R"(
<root>
<root BTCPP_format="4">
<BehaviorTree ID="MainTree">
<FastAction/>
</BehaviorTree>
Expand Down
2 changes: 1 addition & 1 deletion tests/navigation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using namespace BT;
// clang-format off
static const char* xml_text = R"(
<root main_tree_to_execute="BehaviorTree">
<root BTCPP_format="4" main_tree_to_execute="BehaviorTree">
<BehaviorTree ID="BehaviorTree">
<Fallback name="root">
Expand Down
2 changes: 1 addition & 1 deletion tests/trees/child/child/child_child_no_include.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<root main_tree_to_execute = "ChildChildNoInclude">
<root BTCPP_format="4" main_tree_to_execute = "ChildChildNoInclude">
<BehaviorTree ID="ChildChildNoInclude">
<AlwaysSuccess />
</BehaviorTree>
Expand Down
2 changes: 1 addition & 1 deletion tests/trees/child/child_include_child.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<root main_tree_to_execute = "ChildIncludeChild">
<root BTCPP_format="4" main_tree_to_execute = "ChildIncludeChild">
<include path="child/child_child_no_include.xml" />

<BehaviorTree ID="ChildIncludeChild">
Expand Down
2 changes: 1 addition & 1 deletion tests/trees/child/child_include_parent.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<root main_tree_to_execute = "ChildIncludeParent">
<root BTCPP_format="4" main_tree_to_execute = "ChildIncludeParent">
<include path="../parent_no_include.xml" />

<BehaviorTree ID="ChildIncludeParent">
Expand Down
2 changes: 1 addition & 1 deletion tests/trees/child/child_include_sibling.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<root main_tree_to_execute = "ChildIncludeSibling">
<root BTCPP_format="4" main_tree_to_execute = "ChildIncludeSibling">
<include path="child_no_include.xml" />

<BehaviorTree ID="ChildIncludeSibling">
Expand Down
2 changes: 1 addition & 1 deletion tests/trees/child/child_no_include.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<root main_tree_to_execute = "ChildNoInclude">
<root BTCPP_format="4" main_tree_to_execute = "ChildNoInclude">
<BehaviorTree ID="ChildNoInclude">
<AlwaysSuccess />
</BehaviorTree>
Expand Down
2 changes: 1 addition & 1 deletion tests/trees/parent_include_child.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<root main_tree_to_execute = "ParentIncludeChild">
<root BTCPP_format="4" main_tree_to_execute = "ParentIncludeChild">
<include path="child/child_no_include.xml" />

<BehaviorTree ID="ParentIncludeChild">
Expand Down
2 changes: 1 addition & 1 deletion tests/trees/parent_include_child_include_child.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<root main_tree_to_execute = "ParentIncludeChildIncludeChild">
<root BTCPP_format="4" main_tree_to_execute = "ParentIncludeChildIncludeChild">
<include path="child/child_include_child.xml" />

<BehaviorTree ID="ParentIncludeChildIncludeChild">
Expand Down
2 changes: 1 addition & 1 deletion tests/trees/parent_include_child_include_parent.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<root main_tree_to_execute = "ParentIncludeChildIncludeParent">
<root BTCPP_format="4" main_tree_to_execute = "ParentIncludeChildIncludeParent">
<include path="child/child_include_parent.xml" />

<BehaviorTree ID="ParentIncludeChildIncludeParent">
Expand Down
2 changes: 1 addition & 1 deletion tests/trees/parent_include_child_include_sibling.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<root main_tree_to_execute = "ParentIncludeChildIncludeSibling">
<root BTCPP_format="4" main_tree_to_execute = "ParentIncludeChildIncludeSibling">
<include path="child/child_include_sibling.xml" />

<BehaviorTree ID="ParentIncludeChildIncludeSibling">
Expand Down
2 changes: 1 addition & 1 deletion tests/trees/parent_no_include.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<root main_tree_to_execute = "ParentNoInclude">
<root BTCPP_format="4" main_tree_to_execute = "ParentNoInclude">
<BehaviorTree ID="ParentNoInclude">
<AlwaysSuccess />
</BehaviorTree>
Expand Down
2 changes: 1 addition & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5)

include_directories(${CMAKE_SOURCE_DIR}/3rdparty)
include_directories(${PROJECT_SOURCE_DIR}/3rdparty)

add_executable(bt3_log_cat bt_log_cat.cpp )
target_link_libraries(bt3_log_cat ${BEHAVIOR_TREE_LIBRARY} )
Expand Down
3 changes: 2 additions & 1 deletion tools/bt_recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ int main(int argc, char* argv[])
zmq::message_t msg;
try
{
subscriber.recv(update, zmq::recv_flags::none);
auto ret = subscriber.recv(update, zmq::recv_flags::none);
(void)ret;
}
catch (zmq::error_t& e)
{
Expand Down

0 comments on commit 41c1f2e

Please sign in to comment.