ImportError: cannot import name 'ModelStates' from 'gazebo_msgs.msg' (unknown location)

asked 2023-05-17 17:16:49 -0500

whazzv gravatar image

Hi, I'm using Ros Noetic and Gazebo 11.11 and I'm trying to adapt the youbot_description package on it. I've already created package.xml, wrote the CMakeList and I've correct all the issues about the files contained in the package. Now, when I try to launch my youbot_publisher.launch, I've the error in the title; the error is in spawn_model file:

import rospy import sys import os import argparse import xml try: # Python 3.x from urllib.parse import urlsplit, SplitResult except ImportError: # Python 2.x from urlparse import urlsplit, SplitResult from gazebo_ros import gazebo_interface from gazebo_msgs.msg import ModelStates from gazebo_msgs.srv import DeleteModel from std_srvs.srv import Empty from geometry_msgs.msg import Pose, Quaternion from tf.transformations import quaternion_from_euler

When I launch, I receive the error:

Traceback (most recent call last): File "/opt/ros/noetic/lib/gazebo_ros/spawn_model", line 30, in <module> from gazebo_msgs.msg import ModelStates ImportError: cannot import name 'ModelStates' from 'gazebo_msgs.msg' (unknown location) [youbot_gazebo_model-3] process has died [pid 2336, exit code 1, cmd /opt/ros/noetic/lib/gazebo_ros/spawn_model -param robot_description -urdf -model youBot -x 0.0 -y 0.0 -z 0.1 __name:=youbot_gazebo_model __log:=/home/whazzv/.ros/log/b753b5c4-f4fa-11ed-b8de-00155d0e6858/youbot_gazebo_model-3.log]. log file: /home/whazzv/.ros/log/b753b5c4-f4fa-11ed-b8de-00155d0e6858/youbot_gazebo_model-3*.log

It can import everything except gazebo_msgs, I tried already to execute the example about the Coke Can and i receive the same error, I've tried to add gazebo_ros and gazebo_msgs in my package and in my CMakeList, what can I do? Thanks to everyone.

edit retag flag offensive close merge delete