test_attached_sponge.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 import roslib; roslib.load_manifest('tidyup_tools')
00004 import rospy
00005 import sys, traceback
00006 from tidyup_msgs import msg
00007 from tidyup_msgs import srv
00008 from pr2_python.planning_scene_interface import *
00009 from pr2_python.world_interface import WorldInterface 
00010 from geometry_msgs.msg import Point, Pose, PoseStamped
00011 from arm_navigation_msgs.msg import AttachedCollisionObject, CollisionObject, Shape
00012 
00013 if __name__ == '__main__':
00014   try:
00015     rospy.init_node('attaching sponge', anonymous=True)
00016     psi = get_planning_scene_interface()
00017     psi.reset()
00018     wi = WorldInterface()
00019     
00020     rospy.loginfo('creating object')
00021     object_name = 'sponge'
00022     stamped = PoseStamped()
00023     pose = Pose()
00024     pose.position.x = 0.25
00025     pose.position.y = 0.0
00026     pose.position.z = 0.33
00027     pose.orientation.x = 0
00028     pose.orientation.y = 0
00029     pose.orientation.z = 0
00030     pose.orientation.w = 1
00031     stamped.pose = pose
00032     stamped.header.frame_id = 'base_link'
00033     wi.add_collision_box(stamped, [0.07, 0.15, 0.07], object_name)
00034     
00035     rospy.loginfo('attaching object')
00036     attached = AttachedCollisionObject()
00037     attached.object = wi.collision_object(object_name)
00038     attached.link_name = 'base_link'
00039     attached.touch_links.append('base_link')
00040     attached.object.operation.operation = attached.object.operation.ATTACH_AND_REMOVE_AS_OBJECT
00041     wi._publish(attached, wi._attached_object_pub)
00042     
00043     psi.reset()
00044     rospy.loginfo('done.')
00045   except:
00046     traceback.print_exc(file=sys.stdout)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends Defines


tidyup_tools
Author(s): Andreas Hertle, Christian Dornhege
autogenerated on Wed Dec 26 2012 15:50:57