berickson / sim_car

New version of my fake_car simulator targeting ROS 2
56 stars 13 forks source link

Failed to create controller. nav2_line_following_controller::LineFollowingController does not exist. #10

Closed lukbieli closed 10 months ago

lukbieli commented 10 months ago

Hi, great project! i'm looking forward to use it as a reference for my small project.

I have a small issue with Nav2. Once I run "ros2 launch sim_car bringup.launch.py" I'm getting an error:

[component_container_isolated-7] [INFO] [1701556227.593277473] [local_costmap.local_costmap]: Initialized plugin "inflation_layer" [component_container_isolated-7] [INFO] [1701556227.618546633] [controller_server]: Created progress_checker : progress_checker of type nav2_controller::SimpleProgressChecker [component_container_isolated-7] [INFO] [1701556227.620993778] [controller_server]: Created goal checker : general_goal_checker of type nav2_controller::StoppedGoalChecker [component_container_isolated-7] [INFO] [1701556227.624161252] [controller_server]: Controller Server has general_goal_checker goal checkers available. [component_container_isolated-7] [FATAL] [1701556227.624245364] [controller_server]: Failed to create controller. Exception: According to the loaded plugin descriptions the class nav2_line_following_controller::LineFollowingController with base class type nav2_core::Controller does not exist. Declared types are dwb_core::DWBLocalPlanner nav2_mppi_controller::MPPIController nav2_regulated_pure_pursuit_controller::RegulatedPurePursuitController nav2_rotation_shim_controller::RotationShimController [component_container_isolated-7] [ERROR] [1701556227.624680359] [lifecycle_manager_navigation]: Failed to change state for node: controller_server [component_container_isolated-7] [ERROR] [1701556227.624700392] [lifecycle_manager_navigation]: Failed to bring up all requested nodes. Aborting bringup. [gzclient-2] context mismatch in svga_surface_destroy [gzclient-2] context mismatch in svga_surface_destroy

It seems that 'nav2_line_following_controller::LineFollowingController' is not found.

Simulation is working, SLAM is creating a map but navigation is dead.

Did I miss some dependencies?

lukbieli commented 10 months ago

I managed to make nav2 run by commenting

    # Line following controller
    # FollowPath:
      plugin: "nav2_line_following_controller::LineFollowingController"
     ...

and uncommenting:

    # RPP
    FollowPath:
      plugin: "nav2_regulated_pure_pursuit_controller::RegulatedPurePursuitController"
      ...

but still why LineFollowingController is not working?

berickson commented 10 months ago

That's a package I created. It's at https://github.com/berickson/nav2_line_following_controller. You can try adding that to your workspace.

lukbieli commented 10 months ago

Great. That worked!

I'm impressed how well it works in comparison to RPP đŸ’¯ RPP couldn't handle new obstacles at all, but yours works very well.

One more thing, during build I was getting an gtest errors:

[Processing: nav2_line_following_controller]                             
--- stderr: nav2_line_following_controller                               
In file included from /home/ros-humble-desktop/ackermann_test/src/nav2_line_following_controller/src/route_test.cpp:2:
/opt/ros/humble/src/gtest_vendor/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int]’:
/opt/ros/humble/src/gtest_vendor/include/gtest/gtest.h:1554:23:   required from ‘static testing::AssertionResult testing::internal::EqHelper::Compare(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int; typename std::enable_if<((! std::is_integral<_Tp>::value) || (! std::is_pointer<_Dp>::value))>::type* <anonymous> = 0]’
/home/ros-humble-desktop/ackermann_test/src/nav2_line_following_controller/src/route_test.cpp:75:3:   required from here
/opt/ros/humble/src/gtest_vendor/include/gtest/gtest.h:1527:11: error: comparison of integer expressions of different signedness: ‘const long unsigned int’ and ‘const int’ [-Werror=sign-compare]
 1527 |   if (lhs == rhs) {
      |       ~~~~^~~~~~
cc1plus: all warnings being treated as errors
gmake[2]: *** [CMakeFiles/route_test.dir/build.make:76: CMakeFiles/route_test.dir/src/route_test.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:213: CMakeFiles/route_test.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< nav2_line_following_controller [44.3s, exited with code 2]

I fixed it by adding "U" to lines that were failing. Created pull request:

https://github.com/berickson/nav2_line_following_controller/pull/7

berickson commented 10 months ago

I'm glad it worked for you. I was just using it myself because RPP wasn't working for me and my Ackermann car, especially when reversing for 3 point turns, etc. I didn't think anyone else would find and use it.

berickson commented 10 months ago

Updated README.md with instructions for including nav2_line_following_controller dependency.