當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。