ROS Developers Open Class n.165

Hey Construct team,

i followed your tutorial on Open Class n.165
After colcon build i got this error:

Starting >>> nav2_gradient_costmap_plugin
--- stderr: nav2_gradient_costmap_plugin                             
/home/nartmangnourt/follower_ws/src/nav2_gradient_costmap_plugin/src/gradient_layer.cpp: In member function ‘virtual void nav2_gradient_costmap_plugin::GradientLayer::onInitialize()’:
/home/nartmangnourt/follower_ws/src/nav2_gradient_costmap_plugin/src/gradient_layer.cpp:70:21: error: ‘using SharedPtr = class std::shared_ptr<rclcpp_lifecycle::LifecycleNode>’ {aka ‘class std::shared_ptr<rclcpp_lifecycle::LifecycleNode>’} has no member named ‘lock’
   70 |   auto node = node_.lock();
      |                     ^~~~
make[2]: *** [CMakeFiles/nav2_gradient_costmap_plugin_core.dir/build.make:76: CMakeFiles/nav2_gradient_costmap_plugin_core.dir/src/gradient_layer.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/nav2_gradient_costmap_plugin_core.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
---
Failed   <<< nav2_gradient_costmap_plugin [2.41s, exited with code 2]

So i commented out the lock() method in the gradien_layer.cpp:

//auto node = node_.lock();
  auto node = node_;

After this change, colcon build works.
Unfortunately the robot can still move although the costmap is set to max do you know why?:

i using Ubuntu 20.04 foxy.

Thank you so much for any help.

Hi Nam,

It’s quite hard to debug this kind of problem on your local PC since we don’t have access to it, and it can be many things.

Were you able to run the rosject properly on The Construct? If so, then that would be something missing on your local PC.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.