ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

ImportError: No module named gazebo_msgs.msg

asked 2015-02-12 07:04:59 -0600

EMP gravatar image


Having installed and using the gazebo simulator environment for a while now I was wondering why when I try to import from a related package I get an error.

from geometry_msgs.msg import Pose,Twist #works fine
from gazebo_msgs.msg import ModelState

ImportError: No module named gazebo_msgs.msg
Looking through folders there doesn’t seem to be a difference between geometry_msgs and gazebo_msgs files/structure.

I want to then subscribe to the listed topic

rostopic list:

Then: self.subModelState = rospy.Subscriber("/gazebo/model_states",ModelState,self.DroneState)

Cheers, EMP

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-02-13 02:47:56 -0600

Which ROS distro are you using?

On Hydro and later, this works for me:

import rospy
from gazebo_msgs.msg import ModelState

On Fuerte, you need to import roslib, like this:

import rospy
import roslib
from gazebo_msgs.msg import ModelState

And before you do that, you have to make sure that in my_pkg/manifest.xml, you have the line:

<depend package="gazebo_msgs"/>

Of course, in any distro you also need to have gazebo_msgs installed and on your ROS_PACKAGE_PATH; you can check by running roscd gazebo_msgs.

edit flag offensive delete link more


Thanks, I forgot about the package dependencies: I added <depend package="gazebo_msgs"/> and it worked obviously.
Thanks again

EMP gravatar image EMP  ( 2015-02-14 10:53:20 -0600 )edit

Question Tools


Asked: 2015-02-12 07:04:59 -0600

Seen: 3,520 times

Last updated: Feb 13 '15