当前位置: 首页>>代码示例>>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;未经允许,请勿转载。