simple_moveit_example.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Usage:
00004 # rosrun iri_wam_moveit_config simple_moveit_example.py
00005 #
00006 # Example:
00007 # rosrun iri_wam_moveit_config simple_moveit_example.py
00008 #
00009 # Workaround:
00010 #  If low level is given free memory problems, try exporting the env variable:
00011 #    - export MALLOC_CHECK_=2
00012 #
00013 import roslib; roslib.load_manifest('iri_wam_moveit_config')
00014 
00015 import sys
00016 sys.path.append('./modules')
00017 import getopt 
00018 import copy
00019 import rospy
00020 import tf 
00021 import time 
00022 import numpy 
00023 import math 
00024 import dynamic_reconfigure.client
00025 
00026 from subprocess                  import call
00027 from pprint                      import pprint
00028 
00029 from geometry_msgs.msg           import Pose, PoseStamped, PoseArray
00030 from iri_common_drivers_msgs.srv import QueryJointsMovement, QueryJointsMovementRequest
00031 
00032 import moveit_commander
00033 import moveit_msgs.msg
00034 
00035 import common
00036 
00037 home_pose = QueryJointsMovementRequest()
00038 home_pose.positions = [0.0,-0.4, 0.0, 2.4, 0.0, 0.5, 0.0]
00039 home_pose.velocity = 0.5
00040 home_pose.acceleration = 0.5
00041 initial_pose = QueryJointsMovementRequest()
00042 initial_pose.positions = [0.0, -0.44, 0.0, 2.25, 0.0, 0.72, 0.0]
00043 initial_pose.velocity = 0.5
00044 initial_pose.acceleration = 0.5
00045 
00046 if __name__ == "__main__":
00047 
00048   print "======= Init Simple MoveIt Example"
00049   moveit_commander.roscpp_initialize(sys.argv)
00050   rospy.init_node('iri_simple_moveit_example', anonymous=True)
00051 
00052   print "======= Connecting Node with MoveIt"
00053   sys.stdout.flush()
00054   robot = moveit_commander.RobotCommander()
00055   scene = moveit_commander.PlanningSceneInterface()
00056   group = moveit_commander.MoveGroupCommander("arm")
00057   group.set_planning_time(30)
00058   group.set_planner_id("RRTkConfigDefault")
00059 
00060   # Go To Initial Pose
00061   common.plan_and_move_in_joints(group, initial_pose)
00062   # Wait 5 seconds
00063   time.sleep(5)
00064   # Define a pose in Cartesian
00065   pose_st = PoseStamped()
00066   pose_st.header.frame_id    = "iri_wam_link_base"
00067   pose_st.header.stamp       = rospy.Time()
00068   pose_st.pose.position.x    = 0.359  
00069   pose_st.pose.position.y    =-0.037
00070   pose_st.pose.position.z    = 0.386
00071   pose_st.pose.orientation.x = 0.648
00072   pose_st.pose.orientation.y =-0.633
00073   pose_st.pose.orientation.z = 0.259
00074   pose_st.pose.orientation.w =-0.335
00075   # Go to the Cartesian Pose
00076   common.plan_and_move_in_cartesians(group, pose_st)
00077   # Wait 5 seconds
00078   time.sleep(5)
00079   # Go To Initial Pose
00080   common.plan_and_move_in_joints(group, home_pose)
00081 
00082   print "======= THE END"
00083   sys.stdout.flush()
00084   moveit_commander.os._exit(0)


iri_wam_moveit_config
Author(s): MoveIt Setup Assistant
autogenerated on Sat Jun 8 2019 19:40:45