本文整理汇总了Python中gazebo_msgs.srv.DeleteModel方法的典型用法代码示例。如果您正苦于以下问题:Python srv.DeleteModel方法的具体用法?Python srv.DeleteModel怎么用?Python srv.DeleteModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gazebo_msgs.srv
的用法示例。
在下文中一共展示了srv.DeleteModel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_model
# 需要导入模块: from gazebo_msgs import srv [as 别名]
# 或者: from gazebo_msgs.srv import DeleteModel [as 别名]
def delete_model(mav_sys_id, vehicle_type, ros_master_uri=None):
if ros_master_uri:
original_uri = os.environ[ROS_MASTER_URI]
os.environ[ROS_MASTER_URI] = ros_master_uri
srv = ServiceProxy('/gazebo/delete_model', DeleteModel)
req = DeleteModelRequest()
unique_name = vehicle_type + '_' + str(mav_sys_id)
req.model_name = unique_name
resp = srv(req)
if ros_master_uri:
os.environ[ROS_MASTER_URI] = original_uri
if resp.success:
print(resp.status_message, '(%s)' % unique_name)
return 0
else:
print("failed to delete model [%s]: %s" %
(unique_name, resp.status_message), file=sys.stderr)
return 1
示例2: delete_gazebo_models
# 需要导入模块: from gazebo_msgs import srv [as 别名]
# 或者: from gazebo_msgs.srv import DeleteModel [as 别名]
def delete_gazebo_models(model_list):
# This will be called on ROS Exit, deleting Gazebo models
# Do not wait for the Gazebo Delete Model service, since
# Gazebo should already be running. If the service is not
# available since Gazebo has been killed, it is fine to error out
try:
delete_model = rospy.ServiceProxy('/gazebo/delete_model', DeleteModel)
for model in model_list:
resp_delete = delete_model(model)
except rospy.ServiceException as e:
print("Delete Model service call failed: {0}".format(e))
示例3: initial_setup
# 需要导入模块: from gazebo_msgs import srv [as 别名]
# 或者: from gazebo_msgs.srv import DeleteModel [as 别名]
def initial_setup():
""" Prepares the Gazebo world for generating training data.
In particular, this routine turns off gravity, so that the objects
spawned in front of the RGBD camera will not fall. It also deletes
the ground plane, so that the only depth points produce will
correspond to the object of interest (eliminating the need for
clustering and segmentation as part of the trianing process)
Args: None
Returns: None
"""
rospy.wait_for_service('gazebo/get_model_state')
rospy.wait_for_service('gazebo/set_model_state')
rospy.wait_for_service('gazebo/get_physics_properties')
rospy.wait_for_service('gazebo/set_physics_properties')
rospy.wait_for_service('gazebo/spawn_sdf_model')
get_physics_properties_prox = rospy.ServiceProxy('gazebo/get_physics_properties', GetPhysicsProperties)
physics_properties = get_physics_properties_prox()
physics_properties.gravity.z = 0
set_physics_properties_prox = rospy.ServiceProxy('gazebo/set_physics_properties', SetPhysicsProperties)
set_physics_properties_prox(physics_properties.time_step,
physics_properties.max_update_rate,
physics_properties.gravity,
physics_properties.ode_config)
delete_model_prox = rospy.ServiceProxy('gazebo/delete_model', DeleteModel)
delete_model_prox('ground_plane')
示例4: delete_model
# 需要导入模块: from gazebo_msgs import srv [as 别名]
# 或者: from gazebo_msgs.srv import DeleteModel [as 别名]
def delete_model():
# Delete the old model if it's stil around
delete_model_prox = rospy.ServiceProxy('gazebo/delete_model', DeleteModel)
delete_model_prox('training_model')
示例5: reset
# 需要导入模块: from gazebo_msgs import srv [as 别名]
# 或者: from gazebo_msgs.srv import DeleteModel [as 别名]
def reset(self):
rospy.wait_for_service("gazebo/set_model_configuration")
configure = rospy.ServiceProxy("gazebo/set_model_configuration", SetModelConfiguration)
configure(model_name=self.model_name,
joint_names=self.joint_names,
joint_positions=self.joint_positions)
rospy.wait_for_service("gazebo/delete_model")
delete_model = rospy.ServiceProxy("gazebo/delete_model", DeleteModel)
delete_model("gbeam_soup")
res = subprocess.call([
"roslaunch",
"costar_simulation",
self.experiment_file,
"experiment:=%s"%self.case])
res = subprocess.call(["rosservice","call","publish_planning_scene"])
示例6: deleteModel
# 需要导入模块: from gazebo_msgs import srv [as 别名]
# 或者: from gazebo_msgs.srv import DeleteModel [as 别名]
def deleteModel(self):
while True:
if self.check_model:
rospy.wait_for_service('gazebo/delete_model')
del_model_prox = rospy.ServiceProxy('gazebo/delete_model', DeleteModel)
del_model_prox(self.modelName)
break
else:
pass