当前位置: 首页>>代码示例>>Python>>正文


Python srv.DeleteModel方法代码示例

本文整理汇总了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 
开发者ID:osrf,项目名称:uctf,代码行数:24,代码来源:__init__.py

示例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)) 
开发者ID:microsoft,项目名称:AI-Robot-Challenge-Lab,代码行数:14,代码来源:gazebo_models.py

示例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') 
开发者ID:udacity,项目名称:RoboND-Perception-Exercises,代码行数:35,代码来源:training_helper.py

示例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') 
开发者ID:udacity,项目名称:RoboND-Perception-Exercises,代码行数:6,代码来源:training_helper.py

示例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"]) 
开发者ID:jhu-lcsr,项目名称:costar_plan,代码行数:17,代码来源:experiment.py

示例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 
开发者ID:ROBOTIS-GIT,项目名称:turtlebot3_machine_learning,代码行数:11,代码来源:respawnGoal.py


注:本文中的gazebo_msgs.srv.DeleteModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。