本机环境:
ubuntu20.04 amd64 ros-notice-desktop-full ros2
安装BehaviorTree_V3
1、先安装一些工具依赖
sudo apt-get install libzmq3-dev libboost-dev
2、下载代码编译
源码GitHub地址: https://github.com/BehaviorTree/BehaviorTree.CPP
git clone https://ghproxy.com/https://github.com/BehaviorTree/BehaviorTree.CPP
cd BehaviorTree.CPP/
mkdir build
cd build/
cmake ..
make -j$(nproc)
sudo make install
这里使用了代理访问加速下载
make -j$(nproc) 可以最大化利用cpu性能去编译,加快make速度
安装Groot
1、先安装一些工具依赖
sudo apt install qtbase5-dev libqt5svg5-dev libzmq3-dev libdw-dev
2、下载编译安装代码
源码GitHub地址:https://github.com/BehaviorTree/Groot.git
这里使用了代理访问加速下载
git clone https://ghproxy.com/https://github.com/BehaviorTree/Groot.git
git submodule update --init --recursive
mkdir build
cd build/
cmake ..
make -j$(nproc)
sudo make install
这里注意在执行 git submodule update --init --recursive 时需要看本地网络情况了,配置github加速参考
稳定可靠的github加速神器 FastGithub - 知乎
当使用git clone下来的工程中带有submodule时,初始的时候,submodule的内容并不会自动下载下来的,此时,只需执行如下命令:
git submodule update --init --recursive
即可将子模块内容下载下来后工程才不会缺少相应的文件。
修改库的加载
1、如果直接运行 Groot
会报以下错误,找不到BehaviorTree库
Groot: error while loading shared libraries: libbehavior_tree_editor.so: cannot open shared object file: No such file or directory
2、此时需要操作
sudo vim /etc/ld.so.conf
在里面加上库的路径
3、然后更新
sudo ldconfig
4、再次运行Groot
Groot
出现上面图标即可
跑一下例子程序
1、在下载的BehaviorTree.CPP/build/examples 目录下面,会有一些编译好的例程,
运行 注意后面有loop,不然只会执行一下就没有了
./t05_crossdoor loop
2、另起一个终端,使用 Groot 命令打开Groot
点击start
进去默认是Edit Mode,
3、切换模式 左上角 tools ---- Switch-Mode ------- 选择Realt_ime Montor..
选择ok
connect为绿色表示连接成功