0
$\begingroup$

I followed this nav2 getting started guide without issue: I am now following this nav2 custom planner plugin tutorial

I have created a new plugin nav2_straightline_planner in my ws/src directory. And I have confirmed there are no typos between the sample code and mine. When trying to run

$ ros2 launch nav2_bringup tb3_simulation_launch.py params_file:=/ws/src/navigation2_tutorials/nav2_straightline_planner/nav2_params.yaml

I get the following error:

Failed to create global planner. Exception: According to the loaded plugin descriptions the class nav2_straightline_planner/StraightLine with base class type nav2_core::GlobalPlanner does not exist. Declared types are nav2_navfn_planner/NavfnPlanner

I have checked my CMAKELists has pluginlib_export_plugin_description_file(nav2_core global_planner_plugin.xml)

my global_planner_plugin.xml is the following

<library path="nav2_straightline_planner">
    <class name="nav2_straightline_planner/StraightLine" type="nav2_straightline_planner::StraightLine" base_class_type="nav2_core::GlobalPlanner">
      <description>This is an example plugin which produces straight path.</description>
    </class>
</library>

And in my params.xml I have the following:

 planner_server:
  ros__parameters:
    plugins: ["GridBased"]
    use_sim_time: True
    GridBased:
      plugin: "nav2_straightline_planner/StraightLine"
      interpolation_resolution: 0.1
$\endgroup$

1 Answer 1

0
$\begingroup$

Did you re-source your workspace's install directory?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.