Skip to content
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

Syncs fork with upstream #1

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7a13207
Fixed linking with BehaviorTrees already installed on the system. (#167)
patrykcieslak Sep 8, 2022
8eec90b
fix node style for idle trail (#161)
MozgovoyOleg Sep 8, 2022
eb0a1f2
No need for line ending as the xml_text already contains it (#164)
Timple Sep 8, 2022
db69e85
Added check for nullptr when expanding SubTree (#136)
isactornberg Oct 9, 2022
417428b
Fix references to RetryUntilSuccesful (#168)
Affonso-Gui Oct 9, 2022
2515530
Cleaning up minor warnings (#123)
kogut Oct 9, 2022
063af79
Update README.md
facontidavide Oct 9, 2022
b235419
readme modified
facontidavide Nov 4, 2022
0164772
README
facontidavide Nov 4, 2022
613eadb
typo
facontidavide Nov 4, 2022
e976bc4
use unordered_map instead of set when calling BT::VerifyXML (#180)
ejalaa12 Nov 7, 2022
ee66489
use the correct BehaviorTree.CPP submodule
facontidavide Nov 11, 2022
ff374ca
Update README.md (#175)
lyrakisk Nov 11, 2022
14f9fca
Update to linking for ROS2 compile (#163)
austin-InDro Nov 11, 2022
de7ab0a
Fix build on macOS (#142)
nkalupahana Nov 11, 2022
1604145
added a check for catkin similar to ament to make the package compile…
dignakov Nov 11, 2022
8af9a07
Fixed CMake command API error. (#122)
kogut Nov 11, 2022
2ce24c4
Recenter view and set focus when initialized (#176)
Affonso-Gui Nov 11, 2022
d897a05
Change tab scope if the user double-clicks on a subtree (#146)
fultoncjb Nov 11, 2022
3cd0c33
Add missing dep to package.xml (#182)
impala454 Nov 17, 2022
4b8f5d3
Update README.md
facontidavide Nov 22, 2022
7c7ba71
Update README.md
facontidavide Feb 1, 2023
89ba053
Add publisher/server and autoconnect args to BT Monitor (#170)
sea-bass Feb 7, 2023
f7fac39
Add button to save svg files (#186)
Timple Jun 9, 2023
ca6c8f2
Simplify clone with recursion and use cmake for compile (#194)
Ryanf55 Oct 10, 2023
33a2fc4
Link with ncurses instead of curses (#200)
hacker1024 Feb 10, 2024
66aee17
fix typo (#197)
antonkesy Feb 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 32 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ endif()

#############################################################
find_package(ament_cmake QUIET)
find_package(catkin QUIET)

if(ament_cmake_FOUND)
find_package(ament_index_cpp REQUIRED)
Expand All @@ -29,19 +30,19 @@ if(ament_cmake_FOUND)
behaviortree_cpp_v3
)

message(STATUS "------------------------------------------------")
message(STATUS "BehaviourTreeEditor is being built using AMENT.")
message(STATUS "------------------------------------------------")
elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)
message(STATUS "---------------------")
message(STATUS "Compiling with AMENT.")
message(STATUS "---------------------")
elseif(catkin_FOUND OR CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE )
# http://answers.ros.org/question/230877/optionally-build-a-package-with-catkin/
set(catkin_FOUND 1)
# add_definitions( -DUSING_ROS )

find_package(catkin REQUIRED COMPONENTS behaviortree_cpp_v3)

message(STATUS "------------------------------------------------")
message(STATUS "BehaviourTreeEditor is being built using CATKIN.")
message(STATUS "------------------------------------------------")
message(STATUS "----------------------")
message(STATUS "Compiling with CATKIN.")
message(STATUS "----------------------")

catkin_package(
INCLUDE_DIRS
Expand Down Expand Up @@ -82,13 +83,24 @@ set(BUILD_TESTING OFF CACHE BOOL "")
set(CATKIN_ENABLE_TESTING OFF CACHE BOOL "")

if(NOT catkin_FOUND AND NOT ament_cmake_FOUND)
# look for BehaviorTree.CPP on the system
find_package(BehaviorTreeV3)
if (NOT BehaviorTree_FOUND)
# use git submodule only if you are not compiling with catkin
add_subdirectory( depend/BehaviorTree.CPP )
include_directories( depend/BehaviorTree.CPP/include )

if(NOT EXISTS depend/BehaviorTree.CPP)
message("Can't find the submodule BehaviorTree.CPP")
message("Run [git submodule update --init --recursive]")
endif()

SET(BUILD_EXAMPLES OFF CACHE BOOL "Build tutorials and examples" FORCE)
SET(BUILD_UNIT_TESTS OFF CACHE BOOL "Build the unit tests" FORCE)
SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)

# look for BehaviorTree.CPP as submodule
# use git submodule only if you are not compiling with catkin
add_subdirectory( depend/BehaviorTree.CPP )
include_directories( depend/BehaviorTree.CPP/include )

message(STATUS "----------------------------------")
message(STATUS "BehaviourTree.CPP submodule found.")
message(STATUS "----------------------------------")
endif()

##########################################
Expand Down Expand Up @@ -147,7 +159,7 @@ add_library(behavior_tree_editor SHARED
${FORMS_HEADERS}
)

SET(GROOT_DEPENDENCIES QtNodeEditor )
SET(GROOT_DEPENDENCIES QtNodeEditor ncurses ncursesw tinfo )

if(ament_cmake_FOUND)
ament_target_dependencies(behavior_tree_editor ${dependencies})
Expand All @@ -158,7 +170,12 @@ else()
endif()

if( ZMQ_FOUND )
SET(GROOT_DEPENDENCIES ${GROOT_DEPENDENCIES} zmq)
if (APPLE)
find_package(cppzmq)
SET(GROOT_DEPENDENCIES ${GROOT_DEPENDENCIES} cppzmq)
else()
SET(GROOT_DEPENDENCIES ${GROOT_DEPENDENCIES} zmq)
endif()
endif()

target_link_libraries(behavior_tree_editor ${GROOT_DEPENDENCIES} )
Expand Down
3 changes: 1 addition & 2 deletions QtNodeEditor/src/NodeState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ NodeState::
connections(PortType portType, PortIndex portIndex) const
{
auto const &connections = getEntries(portType);
if( portIndex < 0 || portIndex >= connections.size() )
if( portIndex < 0 || static_cast<unsigned long>(portIndex) >= connections.size() )
{
return NodeState::ConnectionPtrSet();
}
Expand Down Expand Up @@ -139,4 +139,3 @@ resizing() const
{
return _resizing;
}

57 changes: 34 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
[![Build Status](https://travis-ci.org/BehaviorTree/Groot.svg?branch=master)](https://travis-ci.org/BehaviorTree/Groot)

# DEPRECATION notice

Groot is being rewritten from the ground up (https://www.behaviortree.dev/groot).
This repository will be in "maintenance mode" and won't receive any significant update.
Issues will **not** be addressed by the main author but, occasionally, Pull Requests **might** be checked and merged.

**Groot 1.0 is compatible only with BehaviorTree.CPP 3.8.x**, and it is not expected to
work correctly with BehaviorTree.CPP 4.x.

Groot 2.0 introduces many new functionalities and compatibility with BT.CPP 4.0.

**If you use Groot at work** and you want to know how we are redesigning it to be more flexible,
reliable, fast and scalable, get in touch with the main author: [email protected].

# Groot

**Groot** is a Graphical Editor, written in C++ and Qt, to create [BehaviorTrees](https://en.wikipedia.org/wiki/Behavior_tree).
Expand All @@ -15,13 +29,6 @@ the graphic user interface are used to design and monitor a Behavior Tree.
[![MOOD2Be](video_MOOD2Be.png)](https://vimeo.com/304651183)


# Does your company use BehaviorTree.CPP and Groot?

No company, institution or public/private funding is currently supporting the development of BehaviorTree.CPP and Groot. As a consequence, my time to support **BehaviorTree.CPP** is very limited and I decided that I won't spend any time at all supporting **Groot**.
Pull Requests are welcome and will be reviewed, even if with some delay.

If your company use this software, consider becoming a **sponsor** to support bug fixing and development of new features. You can find contact details in [package.xml](package.xml).

# Dependencies, Installation, and Usage

To compile the project you need:
Expand All @@ -34,27 +41,31 @@ On Ubuntu Xenial or later, you can install the dependencies with:
sudo apt install qtbase5-dev libqt5svg5-dev libzmq3-dev libdw-dev

Some functionalities of the code related to ROS will work __only__ if the
project is compiled with with _catkin_.
project is compiled with _catkin_.

# Compilation instructions (Linux)
## Compilation instructions (Linux)

git clone https://github.com/BehaviorTree/Groot.git
cd Groot
git submodule update --init --recursive
mkdir build; cd build
cmake ..
make
```
git clone --recurse-submodules https://github.com/BehaviorTree/Groot.git
cd Groot
cmake -S . -B build
cmake --build build
```

Note compiling "in-source" is not allowed.

# Compilation instructions (ROS)

mkdir -p catkin_ws/src
cd catkin_ws/src
git clone https://github.com/BehaviorTree/Groot.git
cd ..
rosdep install --from-paths src --ignore-src
catkin_make
## Compilation instructions (ROS/ROS2)

**Discouraged**

If you want to compile using `catkin build`(ROS) or `colcon_build` (ROS2)
then you must be sure that version 3.8.x is used (branch V3.8).

You may probably want to compile BehaviorTree.CPP in the same workspace.

```
git clone --branch v3.8 https://github.com/BehaviorTree/BehaviorTree.CPP.git
```

# Licence

Expand Down
10 changes: 7 additions & 3 deletions bt_editor/XML_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
#include "utils.h"

#include "models/SubtreeNodeModel.hpp"
#include <behaviortree_cpp_v3/basic_types.h>
#include <behaviortree_cpp_v3/xml_parsing.h>
#include <QMessageBox>
#include <QtDebug>
#include <QLineEdit>
#include <unordered_map>

using namespace QtNodes;

Expand Down Expand Up @@ -189,11 +191,13 @@ bool VerifyXML(QDomDocument &doc,
error_messages.clear();
try {
std::string xml_text = doc.toString().toStdString();
std::set<std::string> registered_nodes;

std::unordered_map<std::string, BT::NodeType> registered_nodes;

BT::NodeType node_type;
for(const auto& str: registered_ID)
{
registered_nodes.insert( str.toStdString() );
node_type = BT::convertFromString<BT::NodeType>(str.toStdString());
registered_nodes.insert( {str.toStdString(), node_type});
}

BT::VerifyXML(xml_text, registered_nodes); // may throw
Expand Down
20 changes: 15 additions & 5 deletions bt_editor/graphic_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <QMessageBox>
#include <QApplication>
#include <QInputDialog>
#include <QSvgGenerator>

using namespace QtNodes;

Expand Down Expand Up @@ -137,17 +138,16 @@ void GraphicContainer::lockSubtreeEditing(Node &root_node, bool locked, bool cha
}
}
//--------------------------------
QtNodes::NodeStyle style;

if( locked && change_style )
{
QtNodes::NodeStyle style;
style.GradientColor0.setBlue(120);
style.GradientColor1.setBlue(100);
style.GradientColor2.setBlue(90);
style.GradientColor3.setBlue(90);
node->nodeDataModel()->setNodeStyle( style );
}
node->nodeGraphicsObject().setGeometryChanged();
node->nodeDataModel()->setNodeStyle( style );
node->nodeGraphicsObject().update();
}
}
Expand All @@ -163,6 +163,18 @@ void GraphicContainer::nodeReorder()
emit undoableChange();
}

void GraphicContainer::saveSvgFile(const QString path)
{
QSvgGenerator generator;
QRectF rect = _scene->itemsBoundingRect();
generator.setFileName(path);
generator.setSize(QSize(rect.width(), rect.height()));
generator.setViewBox(rect);
QPainter painter;
painter.begin(&generator);
_scene->render(&painter, rect, rect);
}

void GraphicContainer::zoomHomeView()
{
QRectF rect = _scene->itemsBoundingRect();
Expand Down Expand Up @@ -721,5 +733,3 @@ void GraphicContainer::loadFromJson(const QByteArray &data)
clearScene();
scene()->loadFromMemory( data );
}


2 changes: 2 additions & 0 deletions bt_editor/graphic_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class GraphicContainer : public QObject

void nodeReorder();

void saveSvgFile(const QString path);

void zoomHomeView();

bool containsValidTree() const;
Expand Down
27 changes: 26 additions & 1 deletion bt_editor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ main(int argc, char *argv[])
"Start in one of these modes: [editor,monitor,replay]",
"mode");
parser.addOption(mode_option);

QCommandLineOption address_option(QStringList() << "address",
"Address to connect to (defaults to localhost)",
"address");
parser.addOption(address_option);
QCommandLineOption pub_port_option(QStringList() << "publisher_port",
"Publisher port number (defaults to 1666)",
"publisher_port");
parser.addOption(pub_port_option);
QCommandLineOption srv_port_option(QStringList() << "server_port",
"Server port number (defaults to 1667)",
"server_port");
parser.addOption(srv_port_option);
QCommandLineOption autoconnect_option(QStringList() << "autoconnect",
"Autoconnect to monitor");
parser.addOption(autoconnect_option);

parser.process( app );

QFile styleFile( ":/stylesheet.qss" );
Expand Down Expand Up @@ -88,7 +105,15 @@ main(int argc, char *argv[])
mode = dialog.getGraphicMode();
}

MainWindow win( mode );
// Get the monitor options.
const QString monitor_address = parser.value(address_option);
const QString monitor_pub_port = parser.value(pub_port_option);
const QString monitor_srv_port = parser.value(srv_port_option);
const bool monitor_autoconnect = parser.isSet(autoconnect_option);

// Start the main application.
MainWindow win( mode, monitor_address, monitor_pub_port,
monitor_srv_port, monitor_autoconnect );
win.show();
return app.exec();
}
Expand Down
Loading