test_obstacle_publisher.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 
18 import rospy
19 from geometry_msgs.msg import Pose
20 from moveit_msgs.msg import CollisionObject
21 from shape_msgs.msg import SolidPrimitive, Mesh
22 
23 
24 if __name__ == "__main__":
25  rospy.init_node("simple_obstacle_pub")
26  root_frame = "torso_center_link"
27 
28  pub = rospy.Publisher("/collision_object", CollisionObject, queue_size = 1)
29  rospy.sleep(1.0)
30 
31  # Publish a simple sphere
32  x = CollisionObject()
33  x.id = "sphere"
34  x.header.frame_id = root_frame
35  x.operation = CollisionObject.ADD
36  #x.operation = CollisionObject.REMOVE
37  sphere = SolidPrimitive()
38  sphere.type = SolidPrimitive.BOX
39  sphere.dimensions.append(0.001) # radius
40  sphere.dimensions.append(0.001) # radius
41  sphere.dimensions.append(0.001) # radius
42  x.primitives.append(sphere)
43 
44  pose = Pose()
45  pose.position.x = 0.0
46  pose.position.y = 0.0
47  pose.position.z = 0.0
48  pose.orientation.x = 0.0;
49  pose.orientation.y = 0.0;
50  pose.orientation.z = 0.0;
51  pose.orientation.w = 1.0;
52  x.primitive_poses.append(pose)
53  pub.publish(x)
54  rospy.sleep(1.0)
55 
56  rospy.loginfo("Done")


cob_obstacle_distance_moveit
Author(s): Florian Koehler , Felix Messmer
autogenerated on Sun Dec 6 2020 03:26:02