test_moveit.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import sys
00004 import copy
00005 import rospy
00006 import moveit_commander
00007 import moveit_msgs.msg
00008 import geometry_msgs.msg
00009 
00010 
00011 print("============ Starting tutorial setup")
00012 moveit_commander.roscpp_initialize(sys.argv)
00013 rospy.init_node('move_group_python_interface_tutorial',
00014                 anonymous=True)
00015 
00016 robot = moveit_commander.RobotCommander()
00017 
00018 scene = moveit_commander.PlanningSceneInterface()
00019 
00020 
00021 print("============ Setting move groups ============")
00022 group_left = moveit_commander.MoveGroupCommander("left_arm")
00023 # group_left.set_planner_id("ESTkConfigDefault")
00024 
00025 group_right = moveit_commander.MoveGroupCommander("right_arm")
00026 
00027 display_trajectory_publisher = rospy.Publisher('/move_group/display_planned_path',
00028                                     moveit_msgs.msg.DisplayTrajectory, queue_size=10)
00029 
00030 
00031 print("============ Left arm reference frame: %s ============" % group_left.get_planning_frame())
00032 print("============ Left arm end effector link: %s ============" % group_left.get_end_effector_link())
00033 
00034 print("============ Robot Groups: ============")
00035 print(robot.get_group_names())
00036 
00037 print("============ Printing robot state ============")
00038 print(robot.get_current_state())
00039 print("============")
00040 
00041 
00042 print("============ Generating plan_left ============")
00043 group_variable_values = group_left.get_current_joint_values()
00044 group_variable_values[0] = 1.0
00045 group_left.set_joint_value_target(group_variable_values)
00046 plan_left = group_left.plan()
00047 
00048 print("============ Waiting while RVIZ displays plan_left... ============")
00049 rospy.sleep(10)
00050 
00051 print("============ Visualizing plan_left ============")
00052 display_trajectory = moveit_msgs.msg.DisplayTrajectory()
00053 display_trajectory.trajectory_start = robot.get_current_state()
00054 display_trajectory.trajectory.append(plan_left)
00055 display_trajectory_publisher.publish(display_trajectory)
00056 
00057 print("============ Waiting while plan_left is visualized (again)... ============")
00058 rospy.sleep(5)
00059 
00060 group_left.go(wait=True)
00061 
00062 
00063 
00064 
00065 
00066 print("============ Generating plan_left ============")
00067 group_variable_values = group_right.get_current_joint_values()
00068 
00069 group_variable_values[0] = 1.0
00070 group_right.set_joint_value_target(group_variable_values)
00071 
00072 plan_right = group_right.plan()
00073 
00074 print("============ Waiting while RVIZ displays plan_left... ============")
00075 rospy.sleep(10)
00076 
00077 
00078 print("============ Visualizing plan_left ============")
00079 display_trajectory = moveit_msgs.msg.DisplayTrajectory()
00080 
00081 display_trajectory.trajectory_start = robot.get_current_state()
00082 display_trajectory.trajectory.append(plan_right)
00083 display_trajectory_publisher.publish(display_trajectory)
00084 
00085 print("============ Waiting while plan_left is visualized (again)... ============")
00086 rospy.sleep(5)
00087 
00088 group_right.go(wait=True)
00089 
00090 
00091 
00092 
00093 
00094 
00095 moveit_commander.roscpp_shutdown()


yumi_test_controllers
Author(s): Yoshua Nava
autogenerated on Sun Jul 2 2017 03:15:52