rosgpt icon indicating copy to clipboard operation
rosgpt copied to clipboard

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 your ROS 1 workspace.

Open YY-GX opened this issue 1 year ago • 2 comments

Hi, I'm now using ros2 foxy. When I run the command ros2 run rosgpt rosgptparser_turtlesim, I got the following error:

Traceback (most recent call last):
  File "myfolder/rosgpt/install/rosgpt/lib/rosgpt/rosgptparser_turtlesim", line 33, in <module>
    sys.exit(load_entry_point('rosgpt==0.0.1', 'console_scripts', 'rosgptparser_turtlesim')())
  File "myfolder/rosgpt/install/rosgpt/lib/python3.8/site-packages/rosgpt/rosgptparser_turtlesim.py", line 179, in main
    node = TurtlesimController()
  File "myfolder/rosgpt/install/rosgpt/lib/python3.8/site-packages/rosgpt/rosgptparser_turtlesim.py", line 32, in __init__
    self.create_subscription(String,'/voice_cmd',self.voice_cmd_callback,10)
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/node.py", line 1205, in create_subscription
    check_for_type_support(msg_type)
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/type_support.py", line 20, in check_for_type_support
    ts = msg_type.__class__._TYPE_SUPPORT
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 your ROS 1 workspace.

Could you help check what leads to this issue? Thank you!

YY-GX avatar Oct 04 '23 20:10 YY-GX

have you find any solution ?

fatemeh-mohseni-AI avatar Mar 16 '24 07:03 fatemeh-mohseni-AI

Previously, I encountered a similar error. I had set up the "noettic" source in my .bashrc file. Consequently, whenever I opened a new terminal and attempted to run a command directly, I received the same error.

The solution is to either change the source from "noetic" to "foxy" in the .bashrc file or to source "foxy" in every terminal session.

adijams01 avatar Mar 31 '24 05:03 adijams01