pick_and_place_simple.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # ##
4 # @brief [py example gripper] gripper test for doosan robot
5 # @author Jin Hyuk Gong (jinhyuk.gong@doosan.com)
6 
7 import rospy
8 import os
9 import threading, time
10 import sys
11 sys.dont_write_bytecode = True
12 sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__),"../../../../common/imp")) ) # get import pass : DSR_ROBOT.py
13 
14 # for single robot
15 ROBOT_ID = "dsr01"
16 ROBOT_MODEL = "m1013"
17 import DR_init
18 DR_init.__dsr__id = ROBOT_ID
19 DR_init.__dsr__model = ROBOT_MODEL
20 from DSR_ROBOT import *
21 
22 
25 
28 
29 def SET_ROBOT(id, model):
30  ROBOT_ID = id; ROBOT_MODEL= model
31 
32 def shutdown():
33  print "shutdown time!"
34  print "shutdown time!"
35  print "shutdown time!"
36 
37  pub_stop.publish(stop_mode=1) #STOP_TYPE_QUICK)
38  return 0
39 
40 # convert list to Float64MultiArray
42  _res = []
43  for i in list_src:
44  item = Float64MultiArray()
45  item.data = i
46  _res.append(item)
47  #print(_res)
48  #print(len(_res))
49  return _res
50 
51 if __name__ == "__main__":
52  #----- set target robot ---------------
53  my_robot_id = "dsr01"
54  my_robot_model = "m1013"
55  SET_ROBOT(my_robot_id, my_robot_model)
56 
57  rospy.init_node('pick_and_place_simple_py')
58  rospy.on_shutdown(shutdown)
59 
60 
61  pub_stop = rospy.Publisher('/'+ROBOT_ID +ROBOT_MODEL+'/stop', RobotStop, queue_size=10)
62 
63  #print 'wait services'
64  #rospy.wait_for_service('/'+ROBOT_ID +ROBOT_MODEL+'/drl/drl_start')
65 
66  srv_robotiq_2f_open = rospy.ServiceProxy('/' + ROBOT_ID + ROBOT_MODEL + '/gripper/robotiq_2f_open', Robotiq2FOpen)
67  srv_robotiq_2f_close = rospy.ServiceProxy('/' + ROBOT_ID + ROBOT_MODEL + '/gripper/robotiq_2f_close', Robotiq2FClose)
68 
69  p0 = posj(0, 0, 0, 0, 0, 0)
70  p1 = posj(0, 0, 90, 0, 90, 0)
71  p2 = posj(180, 0, 90, 0, 90, 0)
72 
73  x1 = posx(0, 0, -200, 0, 0, 0)
74  x2 = posx(0, 0, 200, 0, 0, 0)
75  velx = [50, 50]
76  accx = [100, 100]
77 
78  while not rospy.is_shutdown():
79  movej(p0, vel=60, acc=30)
80 
81  movej(p1, vel=60, acc=30)
82 
83  movel(x1, velx, accx, time=2, mod=DR_MV_MOD_REL)
85  rospy.sleep(1)
86  movel(x2, velx, accx, time=2, mod=DR_MV_MOD_REL)
87 
88  movej(p2, vel=60, acc=30)
89 
90  movel(x1, velx, accx, time=2, mod=DR_MV_MOD_REL)
92  rospy.sleep(1)
93  movel(x2, velx, accx, time=2, mod=DR_MV_MOD_REL)
94 
95 
96 
97  print 'good bye!'
def movej(fTargetPos, fTargetVel, fTargetAcc, fTargetTime=0.0, fBlendingRadius=0.0, nMoveMode=MOVE_MODE_ABSOLUTE, nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, nSyncType=0)
def _ros_listToFloat64MultiArray(list_src)
def movel(fTargetPos, fTargetVel, fTargetAcc, fTargetTime=0.0, fBlendingRadius=0.0, nMoveReference=MOVE_REFERENCE_BASE, nMoveMode=MOVE_MODE_ABSOLUTE, nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, nSyncType=0)


py
Author(s):
autogenerated on Sat May 18 2019 02:32:56