Home

翻译自:https://www.behaviortree.dev

Home

About this library [关于此库]

This C++ library provides a framework to create BehaviorTrees.It was designed to be flexible, easy to use and fast. [这个 C++ 库提供了一个创建行为树的框架。它被设计为灵活、易于使用和快速。]

Even if our main use-case is robotics, you can use this library to build AI for games, or to replace Finite State Machines in you application. [即使我们的主要用例是__机器人__,您也可以使用此库构建__游戏AI__,或替换应用程序中的有限状态机。]

BehaviorTree.CPP has many interesting features, when compared to other implementations: [与其他实现相比,BehaviorTree.CPP 有许多有趣的特性:]

  • It makes asynchronous Actions, i.e. non-blocking routines, a first-class citizen. [它使异步操作(即非阻塞例程)成为一等公民。]
  • It allows the creation of trees at run-time, using a textual representation (XML). [它允许在运行时使用文本表示 (XML) 创建树。]
  • You can link staticaly your custom TreeNodes or convert them into plugins
    which are loaded at run-time. [您可以静态链接您的自定义 TreeNode 或将它们转换为在运行时加载的插件。]
  • It includes a logging/profiling infrastructure that allows the user to visualize, record, replay and analyze state transitions. [它包括一个__日志/分析__基础设施,允许用户可视化、记录、回放和分析状态转换。]

在这里插入图片描述

Community [社区]

If this documentation doesn’t answer your questions or if you simply want to connect with the community of BT.CPP users, visit discourse.behaviortree.dev. [如果本文档没有回答您的问题,或者您只是想与 BT.CPP 用户社区建立联系,请访问 discourse.behaviortree.dev]

What is a Behavior Tree? [什么是行为树?]

A Behavior Tree (BT) is a way to structure the switching between different tasks in an autonomous agent, such as a robot or a virtual entity in a computer game. [行为树 (BT) 是一种在自主代理中构建不同任务之间切换的方法,例如计算机游戏中的机器人或虚拟实体。]

BTs are a very efficient way of creating complex systems that are both modular and reactive. These properties are crucial in many applications, which has led to the spread of BT from computer game programming to many branches of AI and Robotics. [BT 是创建模块化和反应式的复杂系统的一种非常有效的方法。这些属性在许多应用中至关重要,这导致 BT 从计算机游戏编程扩展到 AI 和机器人技术的许多分支。]

If you are already familiar with Finite State Machines (FSM), you will easily grasp most of the concepts but, hopefully, you will find that BTs are more expressive and easier to reason about.[如果您已经熟悉有限状态机 (FSM),您将轻松掌握大部分概念,但希望您会发现 BT 更具表现力且更易于推理。]

The main advantages of Behavior Trees, when compared to FSMs are: [与 FSM 相比,行为树的主要优点是:]

  • They are intrinsically Hierarchical: this means that we can compose complex behaviors including entire trees as sub-branches of a bigger tree. For instance, the behavior “Fetch Beer” may reuse the tree “Grasp Object”. [它们本质上是分层的:这意味着我们可以组合复杂的行为,包括整个树作为更大树的子分支。例如,行为“Fetch Beer”可以重用树“Grasp Object”。]

  • Their graphical representation has a semantic meaning: it is easier to “read” a BT and understand the corresponding workflow. State transitions in FSMs, by comparisons, are harder to understand both in their textual and graphical representation. [它们的图形表示具有语义含义:更容易“阅读”BT 并理解相应的工作流程。相比之下,FSM 中的状态转换在文本和图形表示中都更难理解。]

  • They are more expressive: Ready to use ControlNodes and DecoratorNodes make possible to express more complex control flows. The user can extend the “vocabulary” with his/her own custom nodes. [它们更具表现力:准备使用 ControlNodes 和 DecoratorNodes 可以表达更复杂的控制流。用户可以用他/她自己的自定义节点扩展“词汇表”。]

“Ok, but WHY do we need BehaviorTrees (or FSM)?” [“好的,但是为什么我们需要 BehaviorTrees(或 FSM)?”]

Many software systems, robotics being a notable example, are inherently complex. [许多软件系统,机器人技术就是一个显着的例子,本质上是复杂的。]

The usual approach to manage complexity, heterogeneity and scalability is to use the concept of Component Based Software Engineering. [管理复杂性、异构性和可扩展性的常用方法是使用基于组件的软件工程的概念。]

Any existing middleware for robotics took this approach either informally or formally, being ROS, YARP and SmartSoft some notable examples. [任何现有的机器人中间件都以非正式或正式的方式采用这种方法,如 ROSYARPSmartSoft 一些值得注意的例子。]

A “good” software architecture should have the following characteristics: [一个“好的”软件架构应该具有以下特征:]

  • Modularity. [模块化]
  • Reusability of components. [组件的可重用性]
  • Composability. [可组合性]
  • Good separation of concerns. [良好的关注点分离]

If we don’t keep these concepts in mind from the very beginning, we create software modules/components which are highly coupled to a particular application, instead of being reusable. [如果我们从一开始就没有牢记这些概念,我们就会创建与特定应用程序高度耦合的软件模块/组件,而不是可重用的。]

Frequently, the business logic is “spread” in many locations and it is hard for the developer to reason about it and to debug errors in the control flow. [通常,业务逻辑“散布”在许多地方,开发人员很难对其进行推理并调试控制流中的错误]

To achieve strong separation of concerns it is better to centralize the business logic in a single location. [为了实现关注点的强分离,最好将业务逻辑集中在一个位置。]

Finite State Machines were created specifically with this goal in mind, but in the recent years Behavior Trees gained popularity, especially in the game industry. [__有限状态机__是专门为这一目标而创建的,但近年来__行为树__越来越受欢迎,尤其是在游戏行业。]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装Home Assistant在Ubuntu上可以按照以下步骤进行: 1. 在Ubuntu系统上安装Python和pip(如果还没有安装)。 ``` sudo apt-get update sudo apt-get install python3 python3-pip ``` 2. 安装Home Assistant。 ``` sudo pip3 install homeassistant ``` 3. 启动Home Assistant。 ``` hass ``` 在第一次启动时,Home Assistant会安装所需的依赖项并生成配置文件。请耐心等待一段时间。 4. 访问Home Assistant。 在Web浏览器中输入以下URL: ``` http://<ip_address>:8123 ``` 其中,`<ip_address>`是运行Home Assistant的Ubuntu机器的IP地址。 如果您使用的是本地计算机,请在浏览器中输入以下URL: ``` http://localhost:8123 ``` 这将带您到Home Assistant的配置向导,您可以在其中设置语言、地点和其他选项。 完成上述步骤后,您就可以使用Home Assistant来控制智能设备、创建自动化规则等了。好的,以下是安装Home Assistant在Ubuntu系统上的步骤: 1. 打开终端,更新apt软件包列表: ``` sudo apt-get update ``` 2. 安装必要的软件包: ``` sudo apt-get install -y python3 python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 ``` 3. 创建一个名为"homeassistant"的用户,并切换到该用户: ``` sudo useradd -rm homeassistant sudo su -s /bin/bash homeassistant ``` 4. 创建一个名为"homeassistant"的虚拟环境: ``` python3 -m venv homeassistant ``` 5. 激活虚拟环境: ``` source homeassistant/bin/activate ``` 6. 安装Home Assistant: ``` pip3 install wheel homeassistant ``` 7. 退出虚拟环境: ``` deactivate ``` 8. 创建一个Systemd服务: ``` sudo nano /etc/systemd/system/homeassistant.service ``` 9. 在编辑器中添加以下内容: ``` [Unit] Description=Home Assistant After=network.target [Service] Type=simple User=%i ExecStart=/home/homeassistant/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant" [Install] WantedBy=multi-user.target ``` 10. 保存并退出编辑器。 11. 重新加载Systemd服务: ``` sudo systemctl --system daemon-reload ``` 12. 启动Home Assistant服务: ``` sudo systemctl start homeassistant ``` 13. 验证服务是否已经启动: ``` sudo systemctl status homeassistant ``` 14. 如果一切正常,设置Home Assistant服务自动启动: ``` sudo systemctl enable homeassistant ``` 现在你已经成功地在Ubuntu系统上安装了Home Assistant。你可以通过在Web浏览器中输入"http://<ubuntu IP address>:8123"来访问Home Assistant的Web界面,并开始配置和使用它。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值