spawn_grasp_object.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 import roslib
00020 from tf.transformations import *
00021 from simple_moveit_interface import *
00022 
00023 
00024 def gen_pose(frame_id="/odom_combined", pos=[0,0,0], euler=[0,0,0]):
00025         pose = PoseStamped()
00026         pose.header.frame_id = frame_id
00027         pose.header.stamp = rospy.Time.now()
00028         pose.pose.position.x, pose.pose.position.y, pose.pose.position.z = pos
00029         pose.pose.orientation.x, pose.pose.orientation.y, pose.pose.orientation.z, pose.pose.orientation.w = quaternion_from_euler(*euler)
00030         return pose
00031 
00032 if __name__ == '__main__':
00033         rospy.init_node('spawn_grasp_object')
00034         while rospy.get_time() == 0.0: pass
00035 
00036         psi = get_planning_scene_interface()
00037         rospy.sleep(1.0)
00038 
00039         ### ADDING OBJECT
00040         object_name = "pringles"
00041         pose = gen_pose(frame_id="base_footprint", pos=[-0.7, 0.5, 1.05], euler=[0, 0, 0])
00042         filename = roslib.packages.get_pkg_dir('cob_grasp_generation')+'/files/meshes/'+object_name+'.stl'
00043         #psi.add_mesh(object_name, pose, filename)      #assimp error
00044         psi.add_box(object_name, pose, size=(0.1, 0.1, 0.1))
00045 
00046         rospy.sleep(1.0)
00047 


cob_pick_place_action
Author(s): Felix Messmer
autogenerated on Thu Jun 6 2019 21:23:15