本文整理汇总了Python中geometry_msgs.msg.PointStamped.frame_id方法的典型用法代码示例。如果您正苦于以下问题:Python PointStamped.frame_id方法的具体用法?Python PointStamped.frame_id怎么用?Python PointStamped.frame_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geometry_msgs.msg.PointStamped
的用法示例。
在下文中一共展示了PointStamped.frame_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import frame_id [as 别名]
def execute(self, userdata):
bl = userdata.bl
br = userdata.br
tl = userdata.tl
tr = userdata.tr
center = bl
center.point.x = (bl.point.x + tl.point.x + br.point.x + tr.point.x) / 4
center.point.y = (bl.point.y + tl.point.y + br.point.y + tr.point.y) / 4
center.point.z = (bl.point.z + tl.point.z + br.point.z + tr.point.z) / 4
# calculate width
rightTip = PointStamped()
rightTip.header.stamp = rospy.Time()
rightTip.frame_id = "r_tip_frame"
rFromL = self.listener.transformPoint("l_tip_frame", rightTip)
width = math.sqrt(
rFromL.point.x ** 2 + rFromL.point.y ** 2 + rFromL.point.z ** 2
) # distance from right to left
# set point_l and point_r (remember to set z to the height of the table)
point_l = br
point_l.x = center.point.x
point_l.y = center.point.y + width / 2
point_l.z = TABLE_HEIGHT # is this wrong? what frame are bl, br, tl, and tr given in?
point_r = tl
point_r.x = center.point.x
point_r.y = center.point.y - width / 2
point_r.z = TABLE_HEIGHT # is this wrong? what frame are bl, br, tl, and tr given in?
if not GripUtils.go_to_pts(
point_l,
pi / 2,
pi / 4,
-pi / 2,
True,
point_r,
-pi / 2,
pi / 4,
pi / 2,
True,
z_offset_l=0.4,
z_offset_r=0.4,
):
return FAILURE
numTowelsInStack = 0
try:
numTowelsInStack = userdata.stackNum
except KeyError:
pass
z_offset = -0.4 + 0.02 * numTowelsInStack
if not GripUtils.go_to_relative_multi(0, 0, z_offset, True, 0, 0, z_offset, True, "base_footprint"):
return FAILURE
if not GripUtils.open_grippers():
return FAILURE
userdata.stackNum = numTowelsInStack + 1
return SUCCESS