spawn_grasp_object.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 import roslib
20 from tf.transformations import *
21 from simple_moveit_interface import *
22 
23 
24 def gen_pose(frame_id="/odom_combined", pos=[0,0,0], euler=[0,0,0]):
25  pose = PoseStamped()
26  pose.header.frame_id = frame_id
27  pose.header.stamp = rospy.Time.now()
28  pose.pose.position.x, pose.pose.position.y, pose.pose.position.z = pos
29  pose.pose.orientation.x, pose.pose.orientation.y, pose.pose.orientation.z, pose.pose.orientation.w = quaternion_from_euler(*euler)
30  return pose
31 
32 if __name__ == '__main__':
33  rospy.init_node('spawn_grasp_object')
34  while rospy.get_time() == 0.0: pass
35 
36  psi = get_planning_scene_interface()
37  rospy.sleep(1.0)
38 
39  ### ADDING OBJECT
40  object_name = "pringles"
41  pose = gen_pose(frame_id="base_footprint", pos=[-0.7, 0.5, 1.05], euler=[0, 0, 0])
42  filename = roslib.packages.get_pkg_dir('cob_grasp_generation')+'/files/meshes/'+object_name+'.stl'
43  #psi.add_mesh(object_name, pose, filename) #assimp error
44  psi.add_box(object_name, pose, size=(0.1, 0.1, 0.1))
45 
46  rospy.sleep(1.0)
47 
def gen_pose(frame_id="/odom_combined", pos=[0, euler=[0)


cob_pick_place_action
Author(s): Felix Messmer
autogenerated on Mon Jun 10 2019 13:10:02