After setting up the wall_follower package correctly, “ros2 launch wall_follower start_wall_following.launch.py” failed with the message “AttributeError: type object ‘type’ has no attribute’_TYPE_SUPPORT’ This might be a ROS 1 message type but it should be a ROS 2 message type. Make sure to source your ROS 2 workspace after yourROS 1 workspace.”
Note the launch command is only executed with the bridge running in another terminal and after executing “source /opt/ros/noetic/setup.bash” and “source ~/simulation_ws/devel/setup.bash” in a new terminal. Teleop is terminated at the time of launch (but runs correctly). Could anyone help please?
This is a common problem which you can find in the forums.
The solution is to source ROS1 and then ROS2.
So the steps are:
Source ROS1 : source /opt/ros/noetic/setup.bash
Source ROS2 : source /opt/ros/foxy/setup.bash
Now build your package from ros2_ws path : colcon build --packages-select <your_package_name>
Source your workspace : source install/setup.bash
Now you can run your program : ros2 launch wall_follower start_wall_following.launch.py
Don’t forget to have your simulation running in one of the shells.
Since your are working on ROS2, you need to have these running in terminals:
Teminal 1 : Simulation
Terminal 2 : ROS Bridge
Terminal 3 : This is where you launch your program.
Hope this helps you. Let me know if this dis not work.
The terminals that you get on ROS2’s rosject are by default sourced with ROS2.
So you don’t have to source ROS1 and ROS2 in a new terminal - only on ROS2 rosjects (Python / C++).
You can directly build your packages.
You must be in ~/ros2_ws before building a package.