Error working on Rosject Part 1: wall_follower package

I am working on the wall_follower package of the Rosject (Part 1). I think my problem is related on how to source my workspace (according to the error message I get). Also, I tried changing my code in different ways, however, the error is still pointing to the same line even if there is nothing on that line. Maybe I am missing a small detail, but I tried for hours and I still don’t get what it is. I get the following error message.

Best regards.

Hi ,

Welcome to this Community!

This is the most posted issue in this forum from ROS2 beginners.

The solution is very simple. You need to source ROS2 after sourcing ROS1.
This is the procedure. You cannot do this in reverse. First ROS1, second ROS2 - always!

To source ROS1 : source /opt/ros/noetic/setup.bash
To source ROS2 : source /opt/ros/foxy/setup.bash

Rosjects that work with ROS2 has Foxy as the current version [as of 18/01/2023].
Every new terminal that you open on ROS2 rosjects, they come pre-sourced with ROS2 workspace.

So, whenever you get this error in the future, source ROS2 and try the same command again.
Therefore, in your case, you would do:

cd ~
source /opt/ros/foxy/setup.bash
cd ~/ros2_ws
colcon build --packages-select wall_follower
source install/setup.bash
ros2 launch wall_follower

This should fix your issue. Let me know if this does not fix your issue!


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