39 import moveit_commander
40 import moveit_msgs.msg
41 import geometry_msgs.msg
46 from std_msgs.msg
import String
52 self.
robot = moveit_commander.RobotCommander()
53 self.
scene = moveit_commander.PlanningSceneInterface()
54 self.
group = moveit_commander.MoveGroupCommander(
"svenzva_arm")
55 self.
diaply_pub = rospy.Publisher(
'/move_group/display_planned_path', moveit_msgs.msg.DisplayTrajectory, queue_size=1)
61 self.gripper_client.wait_for_server()
62 rospy.loginfo(
"Found Revel gripper action server")
71 print "============ Reference frame: %s" % self.group.get_planning_frame()
74 print "============ Reference frame: %s" % self.group.get_end_effector_link()
77 print "============ Robot Groups:" 78 print self.robot.get_group_names()
82 print "============ Printing robot state" 83 print self.robot.get_current_state()
88 rospack = rospkg.RosPack()
89 path = rospack.get_path(
'svenzva_demo')
92 f = open(path+
"/config/" + filename +
".yaml")
93 self.
qmap = yaml.safe_load(f)
98 self.group.clear_pose_targets()
101 group_variable_values = self.group.get_current_joint_values()
102 print "============ Joint values: ", group_variable_values
104 for i,val
in enumerate(self.
qmap[state_name]):
105 group_variable_values[i] = val
107 self.group.set_joint_value_target(group_variable_values)
108 plan2 = self.group.plan()
109 self.group.go(wait=
True)
112 moveit_commander.roscpp_shutdown()
113 rospy.loginfo(
"STOPPING playback")
116 if __name__==
'__main__':
117 moveit_commander.roscpp_initialize(sys.argv)
118 rospy.set_param(
'/move_group/trajectory_execution/allowed_start_tolerance', 0.0)
119 rospy.init_node(
'svenzva_moveit_joint_playback', anonymous=
True)
126 goal.target_action = goal.OPEN
127 playback.gripper_client.send_goal(goal)
130 playback.joint_playback(
"start1")
132 playback.joint_playback(
"start2")
134 playback.joint_playback(
"approach3")
136 playback.joint_playback(
"reach4")
139 goal.target_action = goal.CLOSE
140 goal.target_current = 700
141 playback.gripper_client.send_goal(goal)
144 playback.joint_playback(
"grab5")
149 playback.joint_playback(
"pullback6")
152 playback.joint_playback(
"turn7")
154 playback.joint_playback(
"move8")
158 goal.target_action = goal.OPEN
159 playback.gripper_client.send_goal(goal)
def setup_filesys(self, filename)
def print_info(self)
We can get the name of the reference frame for this robot.
def __init__(self, filename)
def joint_playback(self, state_name)