本文整理汇总了Python中geometry_msgs.msg.PointStamped.point方法的典型用法代码示例。如果您正苦于以下问题:Python PointStamped.point方法的具体用法?Python PointStamped.point怎么用?Python PointStamped.point使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geometry_msgs.msg.PointStamped
的用法示例。
在下文中一共展示了PointStamped.point方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GenPlane
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def GenPlane(self, point1, point2, point3):
point1_stamped = PointStamped();
point1_stamped.header.frame_id = self.tf_name
point1_stamped.point = point1
point2_stamped = PointStamped();
point2_stamped.header.frame_id = self.tf_name
point2_stamped.point = point2
point3_stamped = PointStamped();
point3_stamped.header.frame_id = self.tf_name
point3_stamped.point = point3
point1_world = self.tf_listener.transformPoint("/map", point1_stamped)
point2_world = self.tf_listener.transformPoint("/map", point2_stamped)
point3_world = self.tf_listener.transformPoint("/map", point3_stamped)
scale2 = 1 # -2/ (point2_world.point.z - point1_world.point.z)
point2_scaled = Point( point1_world.point.x + (point2_world.point.x - point1_world.point.x) * scale2,
point1_world.point.y + (point2_world.point.y - point1_world.point.y) * scale2,
point1_world.point.z + (point2_world.point.z - point1_world.point.z) * scale2)
if( not math.isnan(point2_scaled.x) ):
marker.points.append(point1_world.point)
marker.points.append(point2_scaled)
# marker.points.append(point1_world.point)
# marker.points.append(point2_world.point)
# marker.points.append(point1_world.point)
# marker.points.append(point3_world.point)
return self.GenPlaneFromWorldPoints(point1_world.point, point2_world.point, point3_world.point)
示例2: pose_cb
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def pose_cb(self, pose):
m_pose = PointStamped()
m_pose.header = pose.header
m_pose.point = pose.pose.position
m_pose = self.listener.transformPoint(self.reference_frame,m_pose)
self.goal_x = m_pose.point.x
self.goal_y = m_pose.point.y
print "New goal: %.2f %.2f" % (self.goal_x, self.goal_y)
marker = Marker()
marker.header = pose.header
marker.ns = "goal_marker"
marker.id = 10
marker.type = Marker.CYLINDER
marker.action = Marker.ADD
marker.pose = pose.pose
marker.scale.x = 0.1
marker.scale.y = 0.1
marker.scale.z = 0.5;
marker.color.a = 1.0;
marker.color.r = 1.0;
marker.color.g = 1.0;
marker.color.b = 0.0;
marker.lifetime.secs=-1.0
self.marker_pub.publish(marker)
示例3: convertStereo
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def convertStereo(self, u, v, disparity):
"""
Converts two pixel coordinates u and v along with the disparity to give PointStamped
This code was taken from stereo_click package
"""
if not self.canProcess():
return None
for key in self.locks.keys():
self.locks[key].acquire()
stereoModel = image_geometry.StereoCameraModel()
stereoModel.fromCameraInfo(self.leftInfo, self.rightInfo)
(x,y,z) = stereoModel.projectPixelTo3d((u,v), disparity)
cameraPoint = PointStamped()
cameraPoint.header.frame_id = self.leftInfo.header.frame_id
cameraPoint.header.stamp = rospy.Time.now()
cameraPoint.point = Point(x,y,z)
self.listener.waitForTransform(self.outputFrame, cameraPoint.header.frame_id, rospy.Time.now(), rospy.Duration(4.0))
outputPoint = self.listener.transformPoint(self.outputFrame, cameraPoint)
for key in self.locks.keys():
self.locks[key].release()
return outputPoint
示例4: euroc_object_to_odom_combined
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def euroc_object_to_odom_combined(euroc_object):
header = Header(0, rospy.Time(0), euroc_object.frame_id)
# Convert the centroid
camera_point = PointStamped()
camera_point.header = header
camera_point.point = euroc_object.c_centroid
odom_point = manipulation.transform_to(camera_point, '/odom_combined')
euroc_object.c_centroid = odom_point.point
euroc_object.frame_id = '/odom_combined'
# Convert the cuboid
if euroc_object.c_cuboid_success:
cuboid_posestamped = PoseStamped(header, euroc_object.object.primitive_poses[0])
cuboid_posestamped = manipulation.transform_to(cuboid_posestamped, '/odom_combined')
euroc_object.object.primitive_poses[0] = cuboid_posestamped.pose
euroc_object.object.header.frame_id = '/odom_combined'
# Convert the mpe_object
if euroc_object.mpe_success:
for i in range(0, len(euroc_object.mpe_object.primitive_poses)):
posestamped = PoseStamped(header, euroc_object.mpe_object.primitive_poses[i])
posestamped = manipulation.transform_to(posestamped, '/odom_combined')
euroc_object.mpe_object.primitive_poses[i] = posestamped.pose
euroc_object.mpe_object.header.frame_id = '/odom_combined'
示例5: estimation
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def estimation(msg):
uwbdis = msg.distance
point = PointStamped()
point.header = Header()
point.header.frame_id = "vicon"
point.header.stamp = rospy.Time.now()
point.point = msg.position
listener.waitForTransform("ned", "vicon", rospy.Time.now(), rospy.Duration(0.05))
point_tf = listener.transformPoint("ned", point)
uwbanchor = array([point_tf.point.x, point_tf.point.y, point_tf.point.z])
imp = array(msg.point)
global q,a,r,xe
#xe, _ = uwb.locate(xe, Q, 1.0/100, uwbdis, uwbanchor, q, a, r)
xe, _ = vision.locate(xe, Q, 1.0/100, imp, visionanchor, q, a, r)
x_msg = state()
x_msg.state.header = Header()
x_msg.state.header.frame_id = "ned"
x_msg.state.header.stamp = rospy.Time.now()
x_msg.state.pose.position = Point(xe[0], xe[1], xe[2])
x_msg.state.pose.orientation = Quaternion(xe[3], xe[4], xe[5], xe[6])
x_msg.velocity = Vector3(xe[7], xe[8], xe[9])
x_msg.bias = xe[10]
pub.publish(x_msg)
示例6: runFilter
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def runFilter(self):
r = rospy.Rate(self.filterRate)
while not rospy.is_shutdown():
if self.flag_reset:
self.kf.reset(self.getReset())
self.flag_reset = 0
self.kf.iteration(self.getMeasures())
self.pose_pub_.publish(self.kf.getState())
person_point = PointStamped()
person_point.header = self.kf.getState().header
person_point.header.stamp = rospy.Time.now()
person_point.point = self.kf.getState().pose.position
self.point_pub_.publish(person_point)
self.tf_person.sendTransform((self.kf.getState().pose.position.x,self.kf.getState().pose.position.y,0),
(self.kf.getState().pose.orientation.x,self.kf.getState().pose.orientation.y,self.kf.getState().pose.orientation.z,self.kf.getState().pose.orientation.w),
rospy.Time.now(),
"person_link",
self.kf.getState().header.frame_id)
r.sleep()
示例7: new_place_position
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def new_place_position(self):
current_pose = utils.manipulation.get_arm_move_group().get_current_pose()
destination = PointStamped()
destination.header.frame_id = current_pose.header.frame_id
destination.point = current_pose.pose.position
destination.point.z = 0
return destination
示例8: create_point_stamped
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def create_point_stamped(point, frame_id = 'base_link'):
m = PointStamped()
m.header.frame_id = frame_id
m.header.stamp = rospy.Time()
#m.header.stamp = rospy.get_rostime()
m.point = Point(*point)
return m
示例9: face_callback
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def face_callback(self, msg):
if not self.found_face:
face = PointStamped()
face.header = msg.people[0].header
face.point = msg.people[0].pos
self.face_parent_frame = msg.people[0].header.frame_id
# self.listener.waitForTransform(face.header.frame_id, 'base_link', rospy.Time.now(), rospy.Duration(5.0))
d = sqrt(face.point.x * face.point.x + face.point.y * face.point.y)
# Change the axes from camera-type axes
self.quaternion = quaternion_from_euler(pi/2, pi/2, 0.0)
pose = PoseStamped()
pose.header = face.header
pose.pose.position = face.point
pose.pose.orientation.x = self.quaternion[0]
pose.pose.orientation.y = self.quaternion[1]
pose.pose.orientation.z = self.quaternion[2]
pose.pose.orientation.w = self.quaternion[3]
# Transform to base_link
# pose = self.listener.transformPose('base_link', pose)
face = pose.pose.position
self.quaternion = (pose.pose.orientation.x, pose.pose.orientation.y, pose.pose.orientation.z, pose.pose.orientation.w)
self.origin = (face.x, face.y, face.z)
# Flip the bit
self.found_face = True
示例10: move
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def move(self, group, target="", pose=None):
assert target != "" or pose is not None
# group.set_workspace([minX, minY, minZ, maxX, maxY, maxZ])
if pose is not None:
group.set_pose_target(pose)
pt = PointStamped()
pt.header = pose.header
pt.point = pose.pose.position
self.look_at_cb(pt)
else:
group.set_named_target(target)
group.allow_looking(False)
group.allow_replanning(False)
group.set_num_planning_attempts(1)
cnt = 3
while cnt > 0:
if group.go(wait=True):
return True
rospy.sleep(1)
return False
示例11: pre_load
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def pre_load():
rospy.loginfo('检测到预注册的位置')
rospy.loginfo('读取预设位置')
count=getpass.getuser()
read=open('/home/%s/xu_slam/src/nav_staff/map/pre_regist_pose.txt'%count,'r')
pose=read.readlines()
read.close()
poses=eval(pose[0])
try:
intial=rospy.wait_for_message("odom",Odometry)
intial_point=PointStamped()
intial_point.point=intial.pose.pose.position
intial_point.header.stamp=rospy.Time.now()
intial_point.header.frame_id='map'
except:
pass
pose_list=[]
for i in range(len(poses)):
default_point=PointStamped()
default_point.header.frame_id='map'
default_point.header.stamp=rospy.Time.now()
default_point.point.x=poses['pose_%s'%i]['x']
default_point.point.y=poses['pose_%s'%i]['y']
default_point.point.z=poses['pose_%s'%i]['z']
default_point.header.seq=i+1
pose_list.append(default_point)
pose_list.append(intial_point)
tasks(len(pose_list),pose_list)
示例12: publishPosition
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def publishPosition(self, position):
msg = PointStamped()
msg.header.stamp = rospy.Time.now()
msg.header.frame_id = self.frame
msg.point = Point(position[0], position[1], 0)
self.publisher.publish(msg)
示例13: publish
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def publish(self, msg):
pt = PointStamped()
pt.header = msg.header
pt.point = msg.pos
self._point_pub.publish(pt)
示例14: people_cb
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def people_cb(meas):
global mouth_center
ps = PointStamped()
ps.point = meas.pos
ps.header = meas.header
ps.header.stamp = rospy.Time(0)
point = tfl.transformPoint(model.tf_frame, ps)
mouth_center = model.project3dToPixel((point.point.x, point.point.y + mouth_offset, point.point.z))
示例15: ConvertToWorldPoint
# 需要导入模块: from geometry_msgs.msg import PointStamped [as 别名]
# 或者: from geometry_msgs.msg.PointStamped import point [as 别名]
def ConvertToWorldPoint(self, point):
point_stamped = PointStamped();
point_stamped.header.frame_id = self.tf_name
point_stamped.point = point
point_world = self.tf_listener.transformPoint("/map", point_stamped)
return point_world.point