diff --git a/gazebo_ros/scripts/spawn_entity.py b/gazebo_ros/scripts/spawn_entity.py index 5a7360b22..49c1fee03 100755 --- a/gazebo_ros/scripts/spawn_entity.py +++ b/gazebo_ros/scripts/spawn_entity.py @@ -72,7 +72,7 @@ def __init__(self, args): parser.add_argument('-robot_namespace', type=str, default=self.get_namespace(), help='change ROS namespace of gazebo-plugins') parser.add_argument('-timeout', type=float, default=30.0, - help='Number of seconds to wait for the spawn entity service to \ + help='Number of seconds to wait for the spawn and delete services to \ become available') parser.add_argument('-unpause', action='store_true', help='unpause physics after spawning entity') @@ -257,7 +257,7 @@ def entity_xml_cb(msg): def _spawn_entity(self, entity_xml, initial_pose): self.get_logger().info('Waiting for service %s/spawn_entity' % self.args.gazebo_namespace) client = self.create_client(SpawnEntity, '%s/spawn_entity' % self.args.gazebo_namespace) - if client.wait_for_service(timeout_sec=5.0): + if client.wait_for_service(timeout_sec=self.args.timeout): req = SpawnEntity.Request() req.name = self.args.entity req.xml = str(entity_xml, 'utf-8') @@ -282,7 +282,7 @@ def _delete_entity(self): self.get_logger().info('Deleting entity [{}]'.format(self.args.entity)) client = self.create_client( DeleteEntity, '%s/delete_entity' % self.args.gazebo_namespace) - if client.wait_for_service(timeout_sec=5.0): + if client.wait_for_service(timeout_sec=self.args.timeout): req = DeleteEntity.Request() req.name = self.args.entity self.get_logger().info(