Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import rospy
00019 from geometry_msgs.msg import Pose
00020 from moveit_msgs.msg import CollisionObject
00021 from shape_msgs.msg import SolidPrimitive, Mesh
00022
00023
00024 if __name__ == "__main__":
00025 rospy.init_node("simple_obstacle_pub")
00026 root_frame = "torso_center_link"
00027
00028 pub = rospy.Publisher("/collision_object", CollisionObject, queue_size = 1)
00029 rospy.sleep(1.0)
00030
00031
00032 x = CollisionObject()
00033 x.id = "sphere"
00034 x.header.frame_id = root_frame
00035 x.operation = CollisionObject.ADD
00036
00037 sphere = SolidPrimitive()
00038 sphere.type = SolidPrimitive.BOX
00039 sphere.dimensions.append(0.001)
00040 sphere.dimensions.append(0.001)
00041 sphere.dimensions.append(0.001)
00042 x.primitives.append(sphere)
00043
00044 pose = Pose()
00045 pose.position.x = 0.0
00046 pose.position.y = 0.0
00047 pose.position.z = 0.0
00048 pose.orientation.x = 0.0;
00049 pose.orientation.y = 0.0;
00050 pose.orientation.z = 0.0;
00051 pose.orientation.w = 1.0;
00052 x.primitive_poses.append(pose)
00053 pub.publish(x)
00054 rospy.sleep(1.0)
00055
00056 rospy.loginfo("Done")