當前位置: 首頁>>代碼示例>>Python>>正文


Python srv.SpawnModel方法代碼示例

本文整理匯總了Python中gazebo_msgs.srv.SpawnModel方法的典型用法代碼示例。如果您正苦於以下問題:Python srv.SpawnModel方法的具體用法?Python srv.SpawnModel怎麽用?Python srv.SpawnModel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gazebo_msgs.srv的用法示例。


在下文中一共展示了srv.SpawnModel方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: spawn_model

# 需要導入模塊: from gazebo_msgs import srv [as 別名]
# 或者: from gazebo_msgs.srv import SpawnModel [as 別名]
def spawn_model(model_name):
    """ Spawns a model in front of the RGBD camera.

        Args: None

        Returns: None
    """
    initial_pose = Pose()
    initial_pose.position.x = 0
    initial_pose.position.y = 1
    initial_pose.position.z = 1

    # Spawn the new model #
    model_path = rospkg.RosPack().get_path('sensor_stick')+'/models/'
    model_xml = ''

    with open (model_path + model_name + '/model.sdf', 'r') as xml_file:
        model_xml = xml_file.read().replace('\n', '')

    spawn_model_prox = rospy.ServiceProxy('gazebo/spawn_sdf_model', SpawnModel)
    spawn_model_prox('training_model', model_xml, '', initial_pose, 'world') 
開發者ID:udacity,項目名稱:RoboND-Perception-Exercises,代碼行數:23,代碼來源:training_helper.py

示例2: spawn_urdf

# 需要導入模塊: from gazebo_msgs import srv [as 別名]
# 或者: from gazebo_msgs.srv import SpawnModel [as 別名]
def spawn_urdf(name, description_xml, pose, reference_frame):
    rospy.wait_for_service('/gazebo/spawn_urdf_model')
    try:
        spawn_urdf = rospy.ServiceProxy('/gazebo/spawn_urdf_model', SpawnModel)
        resp_urdf = spawn_urdf(name, description_xml, "/", pose, reference_frame)
    except rospy.ServiceException as e:
        rospy.logerr("Spawn URDF service call failed: {0}".format(e)) 
開發者ID:microsoft,項目名稱:AI-Robot-Challenge-Lab,代碼行數:9,代碼來源:gazebo_models.py

示例3: spawn_sdf

# 需要導入模塊: from gazebo_msgs import srv [as 別名]
# 或者: from gazebo_msgs.srv import SpawnModel [as 別名]
def spawn_sdf(name, description_xml, pose, reference_frame):
    rospy.wait_for_service('/gazebo/spawn_sdf_model')
    try:
        spawn_sdf = rospy.ServiceProxy('/gazebo/spawn_sdf_model', SpawnModel)
        resp_sdf = spawn_sdf(name, description_xml, "/", pose, reference_frame)
    except rospy.ServiceException as e:
        rospy.logerr("Spawn SDF service call failed: {0}".format(e)) 
開發者ID:microsoft,項目名稱:AI-Robot-Challenge-Lab,代碼行數:9,代碼來源:gazebo_models.py

示例4: respawnModel

# 需要導入模塊: from gazebo_msgs import srv [as 別名]
# 或者: from gazebo_msgs.srv import SpawnModel [as 別名]
def respawnModel(self):
        while True:
            if not self.check_model:
                rospy.wait_for_service('gazebo/spawn_sdf_model')
                spawn_model_prox = rospy.ServiceProxy('gazebo/spawn_sdf_model', SpawnModel)
                spawn_model_prox(self.modelName, self.model, 'robotos_name_space', self.goal_position, "world")
                rospy.loginfo("Goal position : %.1f, %.1f", self.goal_position.position.x,
                              self.goal_position.position.y)
                break
            else:
                pass 
開發者ID:ROBOTIS-GIT,項目名稱:turtlebot3_machine_learning,代碼行數:13,代碼來源:respawnGoal.py


注:本文中的gazebo_msgs.srv.SpawnModel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。