Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Resetting gazebo simulation gives problems

Hi all,

I am try to perform quadcoptor simulation using the hector_quadcoptor package. I am trying to reset the simulation after after the quad falls down. Resetting the simulation is successful but it requires a lot of time for the messages to be published on topics after the reset.

The code snippet below shows the function where I am calling the services.

def resetSim(self):
    rospy.wait_for_service('/gazebo/reset_world')
    rospy.wait_for_service('/gazebo/reset_simulation')
    try:
        self.reset_proxy()
    except rospy.ServiceException as e:
        print ("/gazebo/reset_simulation service call failed")

Following is the node snippet where I am waiting for messages from some topics:

    while poseData is None:
      try:
          # poseData = rospy.wait_for_message('/ground_truth_to_tf/pose', PoseStamped, timeout=5)
          poseData = rospy.wait_for_message('/ground_truth/state', Odometry, timeout=5)
      except:
          rospy.loginfo("Current drone pose not ready yet, retrying to get robot pose")

Following is the truncated output on the terminal:

[INFO] [WallTime: 1521825344.499104] [6.823000] Current drone pose not ready yet, retrying to get robot pose [INFO] [WallTime: 1521825349.504447] [11.730000] Current drone pose not ready yet, retrying to get robot pose [INFO] [WallTime: 1521825354.518395] [16.698000] Current drone pose not ready yet, retrying to get robot pose [INFO] [WallTime: 1521825359.533711] [21.572000] Current drone pose not ready yet, retrying to get robot pose [INFO] [WallTime: 1521825364.546936] [26.371000] Current drone pose not ready yet, retrying to get robot pose [INFO] [WallTime: 1521825369.559794] [31.289000] Current drone pose not ready yet, retrying to get robot pose

There are times when it takes upto 100 seconds to get the drone pose. Does anyone have any suggestions on what I should do differently to do an iterative learning process using Gazebo? I have seen other questions where someone suggested using Gazebo 7 for iterative learning but I'm not completely sure why that would be the case.

I am using Gazebo 2.2 with ROS Indigo on Ubuntu 14.04.

Any help will be much appreciated!