aniskoubaa / rosgpt

ROSGPT is a pioneering approach that combines the power of ChatGPT and ROS (Robot Operating System) to redefine human-robot interaction. By leveraging large language models like ChatGPT, ROSGPT enables the conversion of unstructured human language into actionable robotic commands. T
287 stars 63 forks source link

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. #8

Open YY-GX opened 9 months ago

YY-GX commented 9 months ago

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!

fatemeh-mohseni-AI commented 3 months ago

have you find any solution ?

adijams01 commented 3 months ago

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.