training.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import roslib; roslib.load_manifest('projector_interface')
00003 from std_msgs.msg import ColorRGBA
00004 from pr2_python.pointclouds import pointcloud2_to_xyz_array, xyz_array_to_pointcloud2
00005 import datetime
00006 import scipy.io
00007 import numpy as np
00008 
00009 load('rosh_robot', globals())
00010 
00011 xmin = -0.79651666
00012 xmax =  0.06501853
00013 ymin =  0.03261997
00014 ymax =  0.50817382
00015 
00016 # xs = np.linspace(xmin,xmax,4)
00017 ys = np.linspace(ymin,ymax,3)
00018 xs = np.arange(xmin+0.05, xmax, ys[1] - ys[0])
00019 xx, yy = np.meshgrid(xs, ys)
00020 points = np.array([(x,y,0) for x,y in zip(xx.ravel(), yy.ravel())])
00021 points_msg = xyz_array_to_pointcloud2(points, now(), '/table')
00022 topics.object_cloud(points_msg)
00023 services.set_selection_method(0)
00024 services.clear_hilights()
00025 
00026 # points = np.array([[xmin+(xmax-xmin)/2, ymin+(ymax-ymin)/2, 0]])
00027 # points_msg = xyz_array_to_pointcloud2(points, now(), '/table')
00028 # topics.object_cloud(points_msg)
00029 
00030 def shutdown(event):
00031     pt = PointStamped()
00032     pt.header.frame_id = '/table'
00033     pt.header.stamp = now()
00034     
00035     points = np.array([[100,100,100]])
00036     points_msg = xyz_array_to_pointcloud2(points, now(), '/table')
00037     topics.object_cloud(points_msg)
00038     pt.point.x, pt.point.y, pt.point.z = points[0]
00039     services.hilight_object(pt, ColorRGBA(0,0,0,0))
00040     
00041     rospy.signal_shutdown(0)
00042     
00043 rospy.Timer(rospy.Duration(10), shutdown, oneshot=True)
00044 
00045 rospy.spin()


projector_interface
Author(s): Daniel Lazewatsky
autogenerated on Mon Oct 6 2014 10:12:36