行为树 XML 节点
nav2_behavior_tree 包提供了几个预先注册的导航特定节点,可以包含在行为树中。
查看此介绍以了解行为树的工作原理以及动作、条件、控制和装饰器之间的区别。
考虑查看:ref:groot_introduction 教程,了解如何使用 Groot 来可视化和修改行为树。
动作插件
- Wait
- Spin
- BackUp
- DriveOnHeading
- AssistedTeleop
- ComputePathToPose
- FollowPath
- NavigateToPose
- ClearEntireCostmap
- ClearCostmapExceptRegion
- ClearCostmapAroundRobot
- ReinitializeGlobalLocalization
- TruncatePath
- TruncatePathLocal
- PlannerSelector
- ControllerSelector
- SmootherSelector
- GoalCheckerSelector
- ProgressCheckerSelector
- NavigateThroughPoses
- ComputePathThroughPoses
- ComputeCoveragePath
- CancelCoverage
- RemovePassedGoals
- RemoveInCollisionGoals
- CancelControl
- CancelBackUp
- CancelSpin
- CancelWait
- CancelDriveOnHeading
- CancelAssistedTeleop
- SmoothPath
- GetPoseFromPath
- DockRobot
- UndockRobot
条件插件
控制插件
装饰器插件
例子
该行为树以 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>