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

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

  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:
      wait_spawn.py <param name> <model name> <namespace> <topic name> <initial pose: x y z R P Y>
      '''
      sys.exit(1)

  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/wait_spawn.py 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/wait_spawn.py:43: 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/wait_spawn.py", line 26, in <module>
      from gazebo_plugins import gazebo_plugins_interface
    File "/opt/ros/fuerte/stacks/simulator_gazebo/gazebo_plugins/src/gazebo_plugins/gazebo_plugins_interface.py", line 9, in <module>
      from gazebo_plugins.msg import GazeboModel
  ImportError: cannot import name GazeboModel
  sam@sam:~/code/ros/plug/pr2_plugs_gazebo_demo$

I found that it seems a line failed:

  from gazebo_plugins.msg import GazeboModel

I also find the script has the same problem:

   /opt/ros/fuerte/stacks/simulator_gazebo/gazebo_plugins/scripts/gazebo_model

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 http://wiki.ros.org/Support for more details. by 130s
close date 2013-01-15 11:38:07

1 Answer

Sort by ยป oldest newest most voted
0

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

Stats

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

Seen: 594 times

Last updated: Jan 15 '13