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


Python msg.Quaternion方法代码示例

本文整理汇总了Python中geometry_msgs.msg.Quaternion方法的典型用法代码示例。如果您正苦于以下问题:Python msg.Quaternion方法的具体用法?Python msg.Quaternion怎么用?Python msg.Quaternion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在geometry_msgs.msg的用法示例。


在下文中一共展示了msg.Quaternion方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: compute_grasp_pose_offset

# 需要导入模块: from geometry_msgs import msg [as 别名]
# 或者: from geometry_msgs.msg import Quaternion [as 别名]
def compute_grasp_pose_offset(self, pose):
        """
        :param pose:
        :return:
        """

        yrot = tf.transformations.quaternion_from_euler(0, math.pi, 0)

        cubeorientation = [pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w]
        # oorient = [overhead_orientation.x,overhead_orientation.y,overhead_orientation.z,overhead_orientation.w]

        # resultingorient = tf.transformations.quaternion_multiply(cubeorientation, tf.transformations.quaternion_conjugate(oorient))
        resultingorient = tf.transformations.quaternion_multiply(cubeorientation, yrot)

        # resultingorient = cubeorientation


        pose.orientation = Quaternion(x=resultingorient[0], y=resultingorient[1], z=resultingorient[2],
                                      w=resultingorient[3])

        pose.position.x += 0
        pose.position.y += 0
        pose.position.z = demo_constants.TABLE_HEIGHT + demo_constants.CUBE_EDGE_LENGTH
        return pose 
开发者ID:microsoft,项目名称:AI-Robot-Challenge-Lab,代码行数:26,代码来源:task_planner.py

示例2: state_to_pose

# 需要导入模块: from geometry_msgs import msg [as 别名]
# 或者: from geometry_msgs.msg import Quaternion [as 别名]
def state_to_pose(xyz, quat):
    """
    :param xyz: desired pose xyz
    :param quat: quaternion around z angle in [w, x, y, z] format
    :return: stamped pose
    """
    quat = Quaternion_msg(
        w=quat[0],
        x=quat[1],
        y=quat[2],
        z=quat[3]
    )

    desired_pose = inverse_kinematics.get_pose_stamped(xyz[0],
                                                       xyz[1],
                                                       xyz[2],
                                                       quat)
    return desired_pose 
开发者ID:SudeepDasari,项目名称:visual_foresight,代码行数:20,代码来源:control_util.py

示例3: _CreateMoveBaseGoal

# 需要导入模块: from geometry_msgs import msg [as 别名]
# 或者: from geometry_msgs.msg import Quaternion [as 别名]
def _CreateMoveBaseGoal(self, goal):
		'''
		Creates an instance of MoveBaseGoal based on a simple goal in the form of a (x,y,theta) tuple
		'''
		
		x,y,theta = goal
		
		moveBaseGoal = MoveBaseGoal()
		moveBaseGoal.target_pose.header.frame_id = self._GoalFrameId
		moveBaseGoal.target_pose.header.stamp = rospy.Time.now()

		moveBaseGoal.target_pose.pose.position.x = x
		moveBaseGoal.target_pose.pose.position.y = y
		
		quaternionArray = tf.transformations.quaternion_about_axis(theta, (0,0,1))
		# quaternion_about_axis offers a convenient way for calculating the members of a quaternion.
		# In order to use it we need to convert it to a Quaternion message structure
		moveBaseGoal.target_pose.pose.orientation = self.array_to_quaternion(quaternionArray)

		print(moveBaseGoal)
		return moveBaseGoal 
开发者ID:PacktPublishing,项目名称:ROS-Programming-Building-Powerful-Robots,代码行数:23,代码来源:GoalsSequencer.py

示例4: _add_coke_can

# 需要导入模块: from geometry_msgs import msg [as 别名]
# 或者: from geometry_msgs.msg import Quaternion [as 别名]
def _add_coke_can(self, name):
        p = PoseStamped()
        p.header.frame_id = self._robot.get_planning_frame()
        p.header.stamp = rospy.Time.now()

        p.pose.position.x = 0.25   
        p.pose.position.y = 0
        p.pose.position.z = 0.32

        q = quaternion_from_euler(0.0, 0.0, 0.0)
        p.pose.orientation = Quaternion(*q)

        # Coke can size from ~/.gazebo/models/coke_can/meshes/coke_can.dae,
        # using the measure tape tool from meshlab.
        # The box is the bounding box of the coke cylinder.
        # The values are taken from the cylinder base diameter and height.
        self._scene.add_box(name, p, (0.01, 0.01, 0.005))

        return p.pose 
开发者ID:PacktPublishing,项目名称:ROS-Programming-Building-Powerful-Robots,代码行数:21,代码来源:pick_and_place_pick_working.py

示例5: _add_table

# 需要导入模块: from geometry_msgs import msg [as 别名]
# 或者: from geometry_msgs.msg import Quaternion [as 别名]
def _add_table(self, name):
        p = PoseStamped()
        p.header.frame_id = self._robot.get_planning_frame()
        p.header.stamp = rospy.Time.now()

        p.pose.position.x = 0.5
        p.pose.position.y = 0.0
        p.pose.position.z = 0.22

        q = quaternion_from_euler(0.0, 0.0, numpy.deg2rad(90.0))
        p.pose.orientation = Quaternion(*q)

        # Table size from ~/.gazebo/models/table/model.sdf, using the values
        # for the surface link.
        self._scene.add_box(name, p, (0.5, 0.4, 0.02))

        return p.pose 
开发者ID:PacktPublishing,项目名称:ROS-Programming-Building-Powerful-Robots,代码行数:19,代码来源:pick_and_place_working_1.py

示例6: _add_coke_can

# 需要导入模块: from geometry_msgs import msg [as 别名]
# 或者: from geometry_msgs.msg import Quaternion [as 别名]
def _add_coke_can(self, name):
        p = PoseStamped()
        p.header.frame_id = self._robot.get_planning_frame()
        p.header.stamp = rospy.Time.now()

        p.pose.position.x = 0.25   
        p.pose.position.y = 0
        p.pose.position.z = 0.32

        q = quaternion_from_euler(0.0, 0.0, 0.0)
        p.pose.orientation = Quaternion(*q)

        # Coke can size from ~/.gazebo/models/coke_can/meshes/coke_can.dae,
        # using the measure tape tool from meshlab.
        # The box is the bounding box of the coke cylinder.
        # The values are taken from the cylinder base diameter and height.
        self._scene.add_box(name, p, (0.01, 0.01, 0.009))

        return p.pose 
开发者ID:PacktPublishing,项目名称:ROS-Programming-Building-Powerful-Robots,代码行数:21,代码来源:pick_and_place_working_1.py

示例7: _add_grasp_block_

# 需要导入模块: from geometry_msgs import msg [as 别名]
# 或者: from geometry_msgs.msg import Quaternion [as 别名]
def _add_grasp_block_(self, name):
        p = PoseStamped()
        p.header.frame_id = self._robot.get_planning_frame()
        p.header.stamp = rospy.Time.now()

        p.pose.position.x = 0.25   
        p.pose.position.y = 0.05
        p.pose.position.z = 0.32

        q = quaternion_from_euler(0.0, 0.0, 0.0)
        p.pose.orientation = Quaternion(*q)

        # Coke can size from ~/.gazebo/models/coke_can/meshes/coke_can.dae,
        # using the measure tape tool from meshlab.
        # The box is the bounding box of the coke cylinder.
        # The values are taken from the cylinder base diameter and height.
        self._scene.add_box(name, p, (0.03, 0.03, 0.09))

        return p.pose 
开发者ID:PacktPublishing,项目名称:ROS-Programming-Building-Powerful-Robots,代码行数:21,代码来源:pick_and_place.py

示例8: _add_coke_can

# 需要导入模块: from geometry_msgs import msg [as 别名]
# 或者: from geometry_msgs.msg import Quaternion [as 别名]
def _add_coke_can(self, name):
        p = PoseStamped()
        p.header.frame_id = self._robot.get_planning_frame()
        p.header.stamp = rospy.Time.now()

        p.pose.position.x = 0.25   
        p.pose.position.y = 0.05
        p.pose.position.z = 0.32

        q = quaternion_from_euler(0.0, 0.0, 0.0)
        p.pose.orientation = Quaternion(*q)

        # Coke can size from ~/.gazebo/models/coke_can/meshes/coke_can.dae,
        # using the measure tape tool from meshlab.
        # The box is the bounding box of the coke cylinder.
        # The values are taken from the cylinder base diameter and height.
        self._scene.add_box(name, p, (0.03, 0.03, 0.009))

        return p.pose 
开发者ID:PacktPublishing,项目名称:ROS-Programming-Building-Powerful-Robots,代码行数:21,代码来源:pick_and_place_both_working_good.py

示例9: _add_table

# 需要导入模块: from geometry_msgs import msg [as 别名]
# 或者: from geometry_msgs.msg import Quaternion [as 别名]
def _add_table(self, name):
        p = PoseStamped()
        p.header.frame_id = self._robot.get_planning_frame()
        p.header.stamp = rospy.Time.now()

        p.pose.position.x = 0.4
        p.pose.position.y = 0.0
        p.pose.position.z = 0.26

        q = quaternion_from_euler(0.0, 0.0, numpy.deg2rad(90.0))
        p.pose.orientation = Quaternion(*q)

        # Table size from ~/.gazebo/models/table/model.sdf, using the values
        # for the surface link.
        self._scene.add_box(name, p, (0.5, 0.4, 0.02))

        return p.pose 
开发者ID:PacktPublishing,项目名称:ROS-Programming-Building-Powerful-Robots,代码行数:19,代码来源:pick_and_place_ew.py

示例10: _add_coke_can

# 需要导入模块: from geometry_msgs import msg [as 别名]
# 或者: from geometry_msgs.msg import Quaternion [as 别名]
def _add_coke_can(self, name):
        p = PoseStamped()
        p.header.frame_id = self._robot.get_planning_frame()
        p.header.stamp = rospy.Time.now()

        p.pose.position.x = 0.25   
        p.pose.position.y = 0.05
        p.pose.position.z = 0.32

        q = quaternion_from_euler(0.0, 0.0, 0.0)
        p.pose.orientation = Quaternion(*q)

        # Coke can size from ~/.gazebo/models/coke_can/meshes/coke_can.dae,
        # using the measure tape tool from meshlab.
        # The box is the bounding box of the coke cylinder.
        # The values are taken from the cylinder base diameter and height.
        self._scene.add_box(name, p, (0.03, 0.03, 0.09))

        return p.pose 
开发者ID:PacktPublishing,项目名称:ROS-Programming-Building-Powerful-Robots,代码行数:21,代码来源:pick_and_place_ew.py

示例11: _add_table

# 需要导入模块: from geometry_msgs import msg [as 别名]
# 或者: from geometry_msgs.msg import Quaternion [as 别名]
def _add_table(self, name):
        p = PoseStamped()
        p.header.frame_id = self._robot.get_planning_frame()
        p.header.stamp = rospy.Time.now()

        p.pose.position.x = 0.45
        p.pose.position.y = 0.0
        p.pose.position.z = 0.22

        q = quaternion_from_euler(0.0, 0.0, numpy.deg2rad(90.0))
        p.pose.orientation = Quaternion(*q)

        # Table size from ~/.gazebo/models/table/model.sdf, using the values
        # for the surface link.
        self._scene.add_box(name, p, (0.5, 0.4, 0.02))

        return p.pose 
开发者ID:PacktPublishing,项目名称:ROS-Programming-Building-Powerful-Robots,代码行数:19,代码来源:pick_and_place.py


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