行为树XML节点
nav2_behavior_tree_软件包提供了几个与导航相关的节点,这些节点已经预先注册,可以包含在行为树中。
查看此介绍_以了解行为树的工作原理以及动作、条件、控制和装饰器之间的区别。
考虑查看 Groot - 与行为树交互 教程,了解如何使用 Groot 可视化和修改行为树。
动作插件
- 等待
- Spin
- 备份
- DriveOnHeading
- 辅助遥控
- ComputePathToPose(计算路径到位姿)
- FollowPath
- NavigateToPose
- 清除整个成本地图
- ClearCostmapExceptRegion
- ClearCostmapAroundRobot
- ReinitializeGlobalLocalization(重新初始化全局定位)
- TruncatePath
- TruncatePathLocal
- PlannerSelector(规划器选择器)
- ControllerSelector
- SmootherSelector
- GoalCheckerSelector
- NavigateThroughPoses
- 计算路径通过姿势
- RemovePassedGoals(移除已通过的目标)
- CancelControl
- CancelBackUp
- CancelSpin
- 取消等待
- CancelDriveOnHeading
- CancelAssistedTeleop
- 平滑路径
条件插件
控制插件
装饰器插件
示例
该行为树以1 Hz的频率定期重新规划全局路径,并具有恢复动作。
<root main_tree_to_execute="MainTree">
<BehaviorTree ID="MainTree">
<RecoveryNode number_of_retries="6" name="NavigateRecovery">
<PipelineSequence name="NavigateWithReplanning">
<RateController hz="1.0">
<RecoveryNode number_of_retries="1" name="ComputePathToPose">
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
<ReactiveFallback name="ComputePathToPoseRecoveryFallback">
<GoalUpdated/>
<ClearEntireCostmap name="ClearGlobalCostmap-Context" service_name="global_costmap/clear_entirely_global_costmap"/>
</ReactiveFallback>
</RecoveryNode>
</RateController>
<RecoveryNode number_of_retries="1" name="FollowPath">
<FollowPath path="{path}" controller_id="FollowPath"/>
<ReactiveFallback name="FollowPathRecoveryFallback">
<GoalUpdated/>
<ClearEntireCostmap name="ClearLocalCostmap-Context" service_name="local_costmap/clear_entirely_local_costmap"/>
</ReactiveFallback>
</RecoveryNode>
</PipelineSequence>
<ReactiveFallback name="RecoveryFallback">
<GoalUpdated/>
<RoundRobin name="RecoveryActions">
<Sequence name="ClearingActions">
<ClearEntireCostmap name="ClearLocalCostmap-Subtree" service_name="local_costmap/clear_entirely_local_costmap"/>
<ClearEntireCostmap name="ClearGlobalCostmap-Subtree" service_name="global_costmap/clear_entirely_global_costmap"/>
</Sequence>
<Spin spin_dist="1.57"/>
<Wait wait_duration="5"/>
<BackUp backup_dist="0.15" backup_speed="0.025"/>
</RoundRobin>
</ReactiveFallback>
</RecoveryNode>
</BehaviorTree>
</root>