00001
00002
00003 PKG = 'planning_environment'
00004
00005 import roslib; roslib.load_manifest(PKG)
00006 import rospy
00007 import planning_environment_msgs.srv
00008 import sys
00009 import unittest
00010
00011
00012 import sensor_msgs.msg
00013 import mapping_msgs.msg
00014 from mapping_msgs.msg import CollisionObject
00015 from mapping_msgs.msg import AttachedCollisionObject
00016 from motion_planning_msgs.msg import CollisionOperation
00017 from geometric_shapes_msgs.msg import Shape
00018 from geometry_msgs.msg import Pose
00019
00020 get_collision_objects_service_name = "get_collision_objects"
00021
00022 def test_add_convert_objects():
00023
00024 obj_pub = rospy.Publisher('collision_object',CollisionObject)
00025
00026 rospy.init_node('test_collision_objects')
00027
00028
00029 rospy.sleep(5.)
00030
00031 obj1 = CollisionObject()
00032
00033 obj1.header.stamp = rospy.Time.now()
00034 obj1.header.frame_id = "base_link"
00035 obj1.id = "obj1";
00036 obj1.operation.operation = mapping_msgs.msg.CollisionObjectOperation.ADD
00037 obj1.shapes = [Shape() for _ in range(1)]
00038 obj1.shapes[0].type = Shape.CYLINDER
00039 obj1.shapes[0].dimensions = [float() for _ in range(2)]
00040 obj1.shapes[0].dimensions[0] = .1
00041 obj1.shapes[0].dimensions[1] = 1.5
00042 obj1.poses = [Pose() for _ in range(1)]
00043 obj1.poses[0].position.x = .6
00044 obj1.poses[0].position.y = -.6
00045 obj1.poses[0].position.z = .75
00046 obj1.poses[0].orientation.x = 0
00047 obj1.poses[0].orientation.y = 0
00048 obj1.poses[0].orientation.z = 0
00049 obj1.poses[0].orientation.w = 1
00050
00051 obj_pub.publish(obj1)
00052
00053 if __name__ == '__main__':
00054
00055 test_add_convert_objects()
00056
00057
00058