Ask Your Question

How to solve cannot import name GazeboModel? [closed]

asked 2012-12-11 15:41:46 -0500

sam gravatar image

When I run this script:

  #!/usr/bin/env python
  #  testing, do not use 
  # spawning things "in sequence"
  # This quick hack waits for a topic to be published (presumably by the model we are waiting for)
  # then it accesses the factory service exposed by gazebo_ros_factory plugin for spawning models
  # a better way to do this is by specifying
  # a list of model spawning dependencies, i.e. don't spawn cup unless table is present
  # to do this, we must make gazeob expose
  #   * service call to access all models
  #   * service call to access info about each model
  #   * service call to ping, create, kill, modify (pose) models
  # I guess one can construct this similar to rostopic or rosnode

  import roslib, time

  import rospy, sys
  import string
  import math

  from gazebo_plugins import gazebo_plugins_interface
  from gazebo_plugins.msg import GazeboModel
  from geometry_msgs.msg import Pose, Point, Quaternion
  import tf.transformations as tft

  wait_topic_initialized = False
  def usage():
      print '''Commands: <param name> <model name> <namespace> <topic name> <initial pose: x y z R P Y>

  def waitForTopic(any):
      global wait_topic_initialized
      wait_topic_initialized = True

  if __name__ == "__main__":
      global wait_topic_initialized
      print len(sys.argv) 
      if len(sys.argv) < 11:
          print usage()

      rospy.init_node("spawn_wait", anonymous=True)

It shows:

  sam@sam:~/code/ros/plug/pr2_plugs_gazebo_demo$ /home/sam/code/ros/plug/pr2_plugs_gazebo_demo/scripts/ plug_description plug plug base_pose_ground_truth 0.09 0.0 0.31 0.0 1.57 0.0 __name:=spawn_plug __log:=/home/sam/.ros/log/93369d2e-440b-11e2-98a0-e0b9a5f829db/spawn_plug-4.log
  /home/sam/code/ros/plug/pr2_plugs_gazebo_demo/scripts/ SyntaxWarning: name 'wait_topic_initialized' is assigned to before global declaration
    global wait_topic_initialized
  Traceback (most recent call last):
    File "/home/sam/code/ros/plug/pr2_plugs_gazebo_demo/scripts/", line 26, in <module>
      from gazebo_plugins import gazebo_plugins_interface
    File "/opt/ros/fuerte/stacks/simulator_gazebo/gazebo_plugins/src/gazebo_plugins/", line 9, in <module>
      from gazebo_plugins.msg import GazeboModel
  ImportError: cannot import name GazeboModel

I found that it seems a line failed:

  from gazebo_plugins.msg import GazeboModel

I also find the script has the same problem:


How to solve it?

Thank you~

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see for more details. by 130s
close date 2013-01-15 11:38:07

1 Answer

Sort by ยป oldest newest most voted

answered 2013-01-15 11:37:22 -0500

130s gravatar image

As announced by the developers in Sep 2012, all gazebo related questions should be asked on new gazebo specific QA community. Thank you for your cooperation!

See also this thread.

Apologies that I close as "off-topic" although it's actually very related - there isn't more suitable label.

edit flag offensive delete link more

Question Tools


Asked: 2012-12-11 15:41:46 -0500

Seen: 399 times

Last updated: Jan 15 '13