test_obstacle_publisher.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00004 #
00005 # Licensed under the Apache License, Version 2.0 (the "License");
00006 # you may not use this file except in compliance with the License.
00007 # You may obtain a copy of the License at
00008 #
00009 #   http://www.apache.org/licenses/LICENSE-2.0
00010 #
00011 # Unless required by applicable law or agreed to in writing, software
00012 # distributed under the License is distributed on an "AS IS" BASIS,
00013 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 # See the License for the specific language governing permissions and
00015 # limitations under the License.
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     # Publish a simple sphere
00032     x = CollisionObject()
00033     x.id = "sphere"
00034     x.header.frame_id = root_frame
00035     x.operation = CollisionObject.ADD
00036     #x.operation = CollisionObject.REMOVE
00037     sphere = SolidPrimitive()
00038     sphere.type = SolidPrimitive.BOX
00039     sphere.dimensions.append(0.001)  # radius
00040     sphere.dimensions.append(0.001)  # radius
00041     sphere.dimensions.append(0.001)  # radius
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")


cob_obstacle_distance_moveit
Author(s): Florian Koehler , Felix Messmer
autogenerated on Thu Jun 6 2019 21:23:10