# D.16  Behavior Server

Source code on [Github](https://github.com/ros-planning/navigation2/tree/main/nav2_behaviors).

The Behavior Server implements the server for handling recovery behavior requests and hosting a vector of plugins implementing various C++ behaviors. It is also possible to implement independent behavior servers for each custom behavior, but this server will allow multiple behaviors to share resources such as costmaps and TF buffers to lower incremental costs for new behaviors.

Note: the wait recovery behavior has no parameters, the duration to wait is given in the action request. Note: pre-Rolling/Humble this was the Recovery server, not behavior server. Launch files, behaviors and tests were all renamed.

#### Behavior Server Parameters

<table><thead><tr><th width="218">Name</th><th width="280">Description</th><th>Type</th><th>Default</th></tr></thead><tbody><tr><td>local_costmap_topic</td><td>Raw costmap topic for collision checking on the local costmap.(costmap topic အကြမ်းမှာ collision တွေကို check လုပ်ပေးတယ် (local costmap မှာပေ့ါ)</td><td>string</td><td>“local_costmap/costmap_raw”</td></tr><tr><td>global_costmap_topic</td><td>Raw costmap topic for collision checking on the global costmap.(global costmap ပုံကြမ်းမှာ coll</td><td>string</td><td>“global_costmap/costmap_raw”</td></tr><tr><td>local_footprint_topic</td><td>Topic for footprint in the local costmap frame.( local costmap frame အတွက် footprint topic)</td><td>string</td><td>“local_costmap/published_footprint”</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>global_footprint_topic</td><td>Topic for footprint in the global costmap frame.( global costmap frame အတွက် footprint</td><td>string</td><td>“global_costmap/published_footprint”</td></tr><tr><td>cycle_frequency</td><td>Frequency to run behavior plugins. ( behavior plugin တွေ run ဖို့ အတွက် frequency)</td><td>double</td><td>10.0</td></tr><tr><td>transform_tolerance</td><td>TF transform tolerance.</td><td>Double</td><td>0.1</td></tr><tr><td>local_frame</td><td>Local reference frame.</td><td>string</td><td>"odom"</td></tr><tr><td>global_frame</td><td>Global reference frame.</td><td>string</td><td>"map"</td></tr><tr><td>robot_base_frame</td><td>Robot base frame.</td><td>string</td><td>"base_link"</td></tr><tr><td>behavior_plugins</td><td>List of plugin names to use, also matches action server names.<br>Note: Each plugin namespace defined in this list needs to have a plugin parameter defining the type of plugin to be loaded in the namespace. ( plugin တိုင်းမှာ plugin parameter သက်မှတ်ပေးရပါမယ်။ plugin တွေမှာလည်း namespace type ထည့်ပေးရမယ်ပေါ့။)</td><td>vector&#x3C;string></td><td>{“spin”, “back_up”, “drive_on_heading”, “wait”}</td></tr></tbody></table>

```yaml
behavior_server:
  ros__parameters:
    behavior_plugins: ["spin", "backup", "drive_on_heading", "wait"]
    spin:
      plugin: "nav2_behaviors/Spin"
    backup:
      plugin: "nav2_behaviors/BackUp"
    drive_on_heading:
      plugin: "nav2_behaviors/DriveOnHeading"
    wait:
      plugin: "nav2_behaviors/Wait"
```

#### Default Plugins

<figure><img src="https://2903086714-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fr9x7fOEsshA97WfbNvfL%2Fuploads%2FB4UC7pEILGZGWnTJzWP3%2Fimage.png?alt=media&#x26;token=d5bc2f95-4663-4d8f-9aeb-e48b19bfd901" alt=""><figcaption></figcaption></figure>

#### Spin Behavior Parameters

<table><thead><tr><th width="214">Name</th><th width="272">Description</th><th>Type</th><th>Default</th></tr></thead><tbody><tr><td>simulate_ahead_time</td><td>Time to look ahead for collisions (s).</td><td>double</td><td>2.00</td></tr><tr><td>max_rotational_vel</td><td>Maximum rotational velocity (rad/s).</td><td>double</td><td>1.0</td></tr><tr><td>min_rotational_vel</td><td>Minimum rotational velocity (rad/s).</td><td>double</td><td>0.4</td></tr><tr><td>rotational_acc_lim</td><td>maximum rotational acceleration (rad/s^2).</td><td>double</td><td>3.2</td></tr></tbody></table>

#### BackUp Behavior Parameters

<table><thead><tr><th width="217">Name</th><th width="238">Description</th><th>Type</th><th>Default</th></tr></thead><tbody><tr><td>simulate_ahead_time</td><td>Time to look ahead for collisions (s).</td><td>double</td><td>2.0</td></tr></tbody></table>

#### DriveOnHeading Behavior Parameters

<table><thead><tr><th width="213">Name</th><th width="253">Description</th><th>Type</th><th>Default</th></tr></thead><tbody><tr><td>simulate_ahead_time</td><td>Time to look ahead for collisions (s).</td><td>double</td><td>2.0</td></tr></tbody></table>

#### AssistedTeleop Behavior Parameters[¶](https://navigation.ros.org/configuration/packages/configuring-behavior-server.html#assistedteleop-behavior-parameters)

<table><thead><tr><th width="208">Name</th><th width="295">Description</th><th>Type</th><th>Default</th></tr></thead><tbody><tr><td>projection_time</td><td>Time to look ahead for collisions (s).</td><td>double</td><td>1.0</td></tr><tr><td>simulation_time_step</td><td>Time step for projections (s).</td><td>double</td><td>0.1</td></tr><tr><td>cmd_vel_teleop</td><td>Topic to listen for teleop messages.</td><td>string</td><td>cmd_vel_teleop</td></tr></tbody></table>

နမူနာ

```yaml
behavior_server:
  ros__parameters:
    local_costmap_topic: local_costmap/costmap_raw
    local_footprint_topic: local_costmap/published_footprint
    global_costmap_topic: global_costmap/costmap_raw
    global_footprint_topic: global_costmap/published_footprint
    cycle_frequency: 10.0
    behavior_plugins: ["spin", "backup", "drive_on_heading", "wait", "assisted_teleop"]
    spin:
      plugin: "nav2_behaviors/Spin"
    backup:
      plugin: "nav2_behaviors/BackUp"
    drive_on_heading:
      plugin: "nav2_behaviors/DriveOnHeading"
    wait:
      plugin: "nav2_behaviors/Wait"
    assisted_teleop:
      plugin: "nav2_behaviors/AssistedTeleop"
    local_frame: odom
    global_frame: map
    robot_base_frame: base_link
    transform_timeout: 0.1
    simulate_ahead_time: 2.0
    max_rotational_vel: 1.0
    min_rotational_vel: 0.4
    rotational_acc_lim: 3.2
```

