Go to the documentation of this file.00001
00002
00003 import sys
00004 import csv
00005 import tf
00006 import math
00007 import time
00008 import numpy
00009 import rospy
00010 import shape_msgs
00011 import moveit_commander
00012 import moveit_msgs.msg
00013 import moveit_msgs.srv
00014 import dynamic_reconfigure.client
00015
00016 DEBUG = True
00017
00018 def plan_and_move_in_joints(group, jm_request):
00019 group.clear_pose_targets()
00020 if DEBUG:
00021 print "======= Current Joint values: %s" % group.get_current_joint_values()
00022 print "======= Requested Joint values: %s" % jm_request.positions
00023 sys.stdout.flush()
00024 group.set_joint_value_target(jm_request.positions)
00025 plan = group.plan()
00026 if plan.joint_trajectory.points:
00027 print "======= Executing trajectory plan..."
00028 sys.stdout.flush()
00029 group.go(wait=True)
00030 return True
00031 else:
00032 print "======= Planning NOT Possible"
00033 sys.stdout.flush()
00034 return False
00035
00036 def plan_and_move_in_cartesians(group, pose_st):
00037 group.clear_pose_targets()
00038 if DEBUG:
00039 print "======= From frame: %s" % group.get_planning_frame()
00040 print "======= To frame: %s" % group.get_end_effector_link()
00041 print "======= Generating plan"
00042 sys.stdout.flush()
00043 group.set_pose_target(pose_st)
00044 plan = group.plan()
00045 if plan.joint_trajectory.points:
00046 print "======= Executing plan"
00047 sys.stdout.flush()
00048
00049 group.execute(plan)
00050
00051 print "======= Plan Executed"
00052 return True
00053 else:
00054 print "======= Plan NOT Possible"
00055 sys.stdout.flush()
00056 return False
00057