Go to the documentation of this file.00001
00002 import roslib; roslib.load_manifest('projected_lightswitch_interface')
00003 import rospy
00004 import numpy as np
00005 from geometry_msgs.msg import Point, PointStamped
00006 from sensor_msgs.msg import PointCloud2, PointCloud
00007 from pr2_object_manipulation_msgs.msg import ImageClick
00008 from copy import deepcopy
00009 from pr2_python.pointclouds import xyz_array_to_pointcloud2
00010
00011 int_pub = None
00012
00013 def click_cb(msg):
00014 point = msg.ray.direction
00015 origin = msg.ray.origin
00016 cloud = xyz_array_to_pointcloud2(np.array([[
00017 point.x,
00018 point.y,
00019 point.z
00020 ]]))
00021 cloud.header = msg.ray.header
00022 int_pub.publish(cloud)
00023 print 'published', point
00024
00025 if __name__ == '__main__':
00026 rospy.init_node('test_cursor')
00027 int_pub = rospy.Publisher('intersected_points', PointCloud2)
00028
00029 rospy.Subscriber('/cursor_click_marker', ImageClick, click_cb)
00030 rospy.spin()