{
  "id": "ros2/nav2-planner-failed-to-initialize-costmap-layer",
  "signature": "[nav2_planner] Failed to initialize costmap layer: 'obstacle_layer' - plugin not found or failed to load",
  "signature_zh": "[nav2_planner] 初始化代价地图层失败：'obstacle_layer' - 未找到插件或加载失败",
  "regex": "Failed to initialize costmap layer.*plugin not found|Failed to load plugin.*costmap_2d",
  "domain": "ros2",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "The nav2 costmap layer plugin (e.g., obstacle_layer) is not registered in the pluginlib system, either because the package is not built, the plugin description XML is missing, or the plugin name is misspelled in the costmap configuration.",
  "root_cause_type": "generic",
  "root_cause_zh": "nav2代价地图层插件（如obstacle_layer）未在pluginlib系统中注册，原因可能是包未构建、缺少插件描述XML，或代价地图配置中插件名称拼写错误。",
  "versions": [
    {
      "version": "Humble",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Iron",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Rolling",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The plugin name must match exactly what is registered in the plugin description XML. A typo or missing package will cause the same error.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the plugin is from a custom package, apt-get won't help. You need to build your custom package with colcon and source the workspace.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Verify the plugin is registered: run 'ros2 pkg list | grep nav2_costmap_2d' and check the plugin description file in the package share directory: cat $(ros2 pkg prefix nav2_costmap_2d)/share/nav2_costmap_2d/plugins.xml. Ensure the plugin name matches your config.",
      "success_rate": 0.9,
      "how": "Verify the plugin is registered: run 'ros2 pkg list | grep nav2_costmap_2d' and check the plugin description file in the package share directory: cat $(ros2 pkg prefix nav2_costmap_2d)/share/nav2_costmap_2d/plugins.xml. Ensure the plugin name matches your config.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If the plugin is from a custom package, ensure the plugin description XML is correctly set up. In the package's CMakeLists.txt: pluginlib_export_plugin_description_file(nav2_costmap_2d plugins.xml). Then rebuild: colcon build --packages-select my_costmap_plugins",
      "success_rate": 0.85,
      "how": "If the plugin is from a custom package, ensure the plugin description XML is correctly set up. In the package's CMakeLists.txt: pluginlib_export_plugin_description_file(nav2_costmap_2d plugins.xml). Then rebuild: colcon build --packages-select my_costmap_plugins",
      "condition": "",
      "sources": []
    },
    {
      "action": "In the costmap configuration YAML, use the exact plugin name from the plugins.xml. For example: plugins: [obstacle_layer] and obstacle_layer: {plugin: 'nav2_costmap_2d::ObstacleLayer', ...}. Restart the planner node.",
      "success_rate": 0.8,
      "how": "In the costmap configuration YAML, use the exact plugin name from the plugins.xml. For example: plugins: [obstacle_layer] and obstacle_layer: {plugin: 'nav2_costmap_2d::ObstacleLayer', ...}. Restart the planner node.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Verify the plugin is registered: run 'ros2 pkg list | grep nav2_costmap_2d' and check the plugin description file in the package share directory: cat $(ros2 pkg prefix nav2_costmap_2d)/share/nav2_costmap_2d/plugins.xml. Ensure the plugin name matches your config.",
    "If the plugin is from a custom package, ensure the plugin description XML is correctly set up. In the package's CMakeLists.txt: pluginlib_export_plugin_description_file(nav2_costmap_2d plugins.xml). Then rebuild: colcon build --packages-select my_costmap_plugins",
    "In the costmap configuration YAML, use the exact plugin name from the plugins.xml. For example: plugins: [obstacle_layer] and obstacle_layer: {plugin: 'nav2_costmap_2d::ObstacleLayer', ...}. Restart the planner node."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.nav2.org/configuration/packages/costmap-plugins/index.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.84,
  "resolvable": "true",
  "first_seen": "2024-09-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}