Ros2 in 5 days (python): rosject attribution error

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?

Hi @zcccccc ,

Welcome to this Community!

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:

  1. Source ROS1 : source /opt/ros/noetic/setup.bash
  2. Source ROS2 : source /opt/ros/foxy/setup.bash
  3. Now build your package from ros2_ws path :
    colcon build --packages-select <your_package_name>
  4. Source your workspace : source install/setup.bash
  5. 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.

Regards,
Girish

Thank you so much! Unfortunately, these steps were unable to fix the issue, I have attached screenshots to give a clearer picture.

Hi @zcccccc ,

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.

cd ~/ros2_ws
colcon build --packages-select <your_package_name> && source install/setup.bash
ros2 launch <package_name> <launch_file_name>.launch.py

Let me know if this fixes your problem!

Regards,
Girish

It worked!! Thank you so much! This issue bothered me for several days now.

Hi @zcccccc ,

Glad you got this working.

I must say, these instructions are clearly written in the rosject (jupyter) notebook.

Regards,
Girish

PS: Mark this problem as solved so this issue can be closed!

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