def main(): #Initialize rospy. roscpp_initialize(sys.argv) rospy.init_node('moveit_py_demo', anonymous=True) #Initialize moveit_commander and instantiate a RobotCommander object robot = RobotCommander() #Instantiate a PlanningSceneInterface object scene = PlanningSceneInterface() display_trajectory_publisher = rospy.Publisher('/move_group/display_planned_path',moveit_msgs.msg.DisplayTrajectory) rospy.sleep(5) ## We can get a list of all the groups in the robot print "============ Robot Groups:" print robot.get_group_names() ## Sometimes for debugging it is useful to print the entire state of the ## robot. print "============ Printing robot state" print robot.get_current_state() print "============" ## Planning to a Pose goal targetPose = geometry_msgs.msg.Pose() targetPose.position.x= 0.709590443177; targetPose.position.y= 0.13514430593; targetPose.position.z= 1.15568059916; targetPose.orientation.x= 0.0435837961582; targetPose.orientation.y= 0.14705394851; targetPose.orientation.z= -0.13176607002; targetPose.orientation.w= 0.979343296159; ## New class for move the robot baxtermove = movebx.movebx() ## Move left arm baxtermove.move_one_arm(targetPose,1) targetPose.position.x= 0.654540132723; targetPose.position.y= -0.606420703205; targetPose.position.z= 0.606416800913; targetPose.orientation.x= 0.158876021296; targetPose.orientation.y= 0.818640184036; targetPose.orientation.z= -0.354173908; targetPose.orientation.w= 0.423258197594; ## Move right arm baxtermove.move_one_arm(targetPose,0) roscpp_shutdown()
#!/usr/bin/env python import sys import rospy #To use the python interface to move_group, import the moveit_commander module from moveit_commander import* #Some messages from moveit_msgs.msg import* import baxter_interface import std_msgs.msg import movebx import point_data #New object to move the Baxter Robot """ Baxter Move object""" baxtermove = movebx.movebx() """Points for left position""" leftdata = point_data.left_data() """Points for right position""" rightdata = point_data.right_data() #Future: home position of each arm def callback(data): """Callback function""" option = data.data print "Data received ----------- \n", option if(option == 0): baxtermove.move_one_arm(leftdata.targetPose1,1) elif(option == 1): baxtermove.move_one_arm(leftdata.targetPose2,1)