publishobjects.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 from __future__ import with_statement # for python 2.5
00003 __author__ = 'Rosen Diankov'
00004 __license__ = 'Apache License, Version 2.0'
00005 
00006 PKG = 'orrosplanning' # this package name
00007 import roslib; roslib.load_manifest(PKG) 
00008 import rospy, time
00009 import posedetection_msgs.msg
00010 from numpy import *
00011 
00012 if __name__=='__main__':
00013     rospy.init_node('ObjectPublisher')
00014     pub_objdet = rospy.Publisher('/myobjects', posedetection_msgs.msg.ObjectDetection)
00015     starttime = time.time()
00016     while not rospy.is_shutdown():
00017         angle = 0.5*(time.time()-starttime)
00018         pose = posedetection_msgs.msg.Object6DPose()
00019         pose.type = 'package://openrave/share/openrave-0.3/data/mug1.kinbody.xml'
00020         pose.pose.orientation.w = 1
00021         pose.pose.orientation.x = 0
00022         pose.pose.orientation.y = 0
00023         pose.pose.orientation.z = 0
00024         pose.pose.position.x = 0.5*cos(angle)
00025         pose.pose.position.y = 0.5*sin(angle)
00026         pose.pose.position.z = 0.5
00027         objdetmsg = posedetection_msgs.msg.ObjectDetection()
00028         objdetmsg.objects=[pose]
00029         objdetmsg.header.frame_id = 'map'
00030         objdetmsg.header.stamp = rospy.get_rostime()
00031         pub_objdet.publish(objdetmsg)
00032         
00033         # change the frame, this requires tf frames to be published
00034         objdetmsg.header.frame_id = 'l_forearm_cam_optical_frame'
00035         pub_objdet.publish(objdetmsg)
00036         time.sleep(0.05)
00037 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


orrosplanning
Author(s): Rosen Diankov (rosen.diankov@gmail.com)
autogenerated on Sat Mar 23 2013 22:32:59