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

Revision history [back]

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
roslib.load_manifest('my_pkg')
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.