Advertisement
Guest User

Untitled

a guest
Mar 11th, 2015
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. #!/usr/bin/python
  2. import roslib; roslib.load_manifest('matcher')
  3. from ethzasl_icp_mapper.srv import MatchClouds
  4. import rospy
  5. from random import random
  6.  
  7. from sensor_msgs.point_cloud2 import read_points, create_cloud
  8. from sensor_msgs.msg import PointCloud2, PointField
  9.  
  10. rospy.init_node("matchit")
  11. rospy.wait_for_service('/match_clouds')
  12.  
  13. match_em = rospy.ServiceProxy('/match_clouds', MatchClouds)
  14.  
  15. pc = PointCloud2()
  16. pc.header.frame_id = '/map'
  17. pc.fields.append( PointField('x', 0, 7, 1) )
  18. pc.fields.append( PointField('y', 4, 7, 1) )
  19. pc.fields.append( PointField('z', 8, 7, 1) )
  20.  
  21. new_points = [ (1,0,0) ]*10
  22. combined = create_cloud(pc.header, pc.fields, new_points)
  23.  
  24. new_points2 = [ (2+random(),3+random(),0) for i in range(10)]
  25. combined2 = create_cloud(pc.header, pc.fields, new_points2)
  26.  
  27. print match_em(combined, combined2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement