11 sys.dont_write_bytecode =
True 12 sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__),
"../../../../common/imp")) )
18 DR_init.__dsr__id = ROBOT_ID
19 DR_init.__dsr__model = ROBOT_MODEL
20 from DSR_ROBOT
import *
23 print "shutdown time!" 24 print "shutdown time!" 25 print "shutdown time!" 27 pub_stop.publish(stop_mode=STOP_TYPE_QUICK)
31 msgRobotState_cb.count += 1
33 if (0==(msgRobotState_cb.count % 100)):
34 rospy.loginfo(
"________ ROBOT STATUS ________")
35 print(
" robot_state : %d" % (msg.robot_state))
36 print(
" robot_state_str : %s" % (msg.robot_state_str))
37 print(
" current_posj : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" % (msg.current_posj[0],msg.current_posj[1],msg.current_posj[2],msg.current_posj[3],msg.current_posj[4],msg.current_posj[5]))
46 print(
" speed : %d" % (msg.speed))
50 msgRobotState_cb.count = 0
53 rospy.Subscriber(
'/'+ROBOT_ID +ROBOT_MODEL+
'/state', RobotState, msgRobotState_cb)
57 if __name__ ==
"__main__":
58 rospy.init_node(
'dsr_simple_test_py')
59 rospy.on_shutdown(shutdown)
61 t1 = threading.Thread(target=thread_subscriber)
65 pub_stop = rospy.Publisher(
'/'+ROBOT_ID +ROBOT_MODEL+
'/stop', RobotStop, queue_size=10)
70 JReady = [0, -20, 110, 0, 60, 0]
72 TCP_POS = [0, 0, 0, 0, 0, 0]
73 J00 = [-180, 0, -145, 0, -35, 0]
75 J01r = [-180.0, 71.4, -145.0, 0.0, -9.7, 0.0]
76 J02r = [-180.0, 67.7, -144.0, 0.0, 76.3, 0.0]
77 J03r = [-180.0, 0.0, 0.0, 0.0, 0.0, 0.0]
79 J04r = [-90.0, 0.0, 0.0, 0.0, 0.0, 0.0]
80 J04r1 = [-90.0, 30.0, -60.0, 0.0, 30.0, -0.0]
81 J04r2 = [-90.0, -45.0, 90.0, 0.0, -45.0, -0.0]
82 J04r3 = [-90.0, 60.0, -120.0, 0.0, 60.0, -0.0]
83 J04r4 = [-90.0, 0.0, -0.0, 0.0, 0.0, -0.0]
85 J05r = [-144.0, -4.0, -84.8, -90.9, 54.0, -1.1]
86 J07r = [-152.4, 12.4, -78.6, 18.7, -68.3, -37.7]
87 J08r = [-90.0, 30.0, -120.0, -90.0, -90.0, 0.0]
89 JEnd = [0.0, -12.6, 101.1, 0.0, 91.5, -0.0]
91 dREL1 = [0, 0, 350, 0, 0, 0]
92 dREL2 = [0, 0, -350, 0, 0, 0]
100 J1 = [81.2, 20.8, 127.8, 162.5, 56.1, -37.1]
101 X0 = [-88.7, 799.0, 182.3, 95.7, 93.7, 133.9]
102 X1 = [304.2, 871.8, 141.5, 99.5, 84.9, 133.4]
103 X2 = [437.1, 876.9, 362.1, 99.6, 84.0, 132.1]
104 X3 = [-57.9, 782.4, 478.4, 99.6, 84.0, 132.1]
106 amp = [0, 0, 0, 30, 30, 0]
107 period = [0, 0, 0, 3, 6, 0]
109 x01 = [423.6, 334.5, 651.2, 84.7, -180.0, 84.7]
110 x02 = [423.6, 34.5, 951.2, 68.2, -180.0, 68.2]
111 x03 = [423.6, -265.5, 651.2, 76.1, -180.0, 76.1]
112 x04 = [423.6, 34.5, 351.2, 81.3, -180.0, 81.3]
115 while not rospy.is_shutdown():
119 movel(X3, velx, accx, t=2.5)
121 for i
in range(0, 1):
122 movel(X2, velx, accx, t=2.5, radius=50, ref=DR_BASE, mod=DR_MV_MOD_ABS)
123 movel(X1, velx, accx, t=1.5, radius=50, ref=DR_BASE, mod=DR_MV_MOD_ABS)
124 movel(X0, velx, accx, t=2.5)
125 movel(X1, velx, accx, t=2.5, radius=50, ref=DR_BASE, mod=DR_MV_MOD_ABS)
126 movel(X2, velx, accx, t=1.5, radius=50, ref=DR_BASE, mod=DR_MV_MOD_ABS)
127 movel(X3, velx, accx, t=2.5, radius=50, ref=DR_BASE, mod=DR_MV_MOD_ABS)
130 movej(J00, v=60, a=60, t=6)
132 movej(J01r, v=0, a=0, t=2, radius=100, mod=DR_MV_MOD_ABS)
133 movej(J02r, v=0, a=0, t=2, radius=50, mod=DR_MV_MOD_ABS)
134 movej(J03r, v=0, a=0, t=2)
136 movej(J04r, v=0, a=0, t=1.5)
137 movej(J04r1, v=0, a=0, t=2, radius=50, mod=DR_MV_MOD_ABS)
138 movej(J04r2, v=0, a=0, t=4, radius=50, mod=DR_MV_MOD_ABS)
139 movej(J04r3, v=0, a=0, t=4, radius=50, mod=DR_MV_MOD_ABS)
140 movej(J04r4, v=0, a=0, t=2)
142 movej(J05r, v=0, a=0, t=2.5, radius=100, mod=DR_MV_MOD_ABS)
143 movel(dREL1, velx, accx, t=1, radius=50, ref=DR_TOOL, mod=DR_MV_MOD_ABS)
144 movel(dREL2, velx, accx, t=1.5, radius=100, ref=DR_TOOL, mod=DR_MV_MOD_ABS)
146 movej(J07r, v=60, a=60, t=1.5, radius=100, mod=DR_MV_MOD_ABS)
147 movej(J08r, v=60, a=60, t=2)
149 movej(JEnd, v=60, a=60, t=4)
152 move_spiral(rev=3, rmax=200, lmax=100, v=vel_spi, a=acc_spi, t=0, axis=DR_AXIS_X, ref=DR_TOOL)
154 movel(x01, velx, accx, t=2)
155 movel(x04, velx, accx, t=2, radius=100, ref=DR_BASE, mod=DR_MV_MOD_ABS)
156 movel(x03, velx, accx, t=2, radius=100, ref=DR_BASE, mod=DR_MV_MOD_ABS)
157 movel(x02, velx, accx, t=2, radius=100, ref=DR_BASE, mod=DR_MV_MOD_ABS)
158 movel(x01, velx, accx, t=2)
160 movec(pos1=x02, pos2=x04, v=velx, a=accx, t=4, radius=360, mod=DR_MV_MOD_ABS, ref=DR_BASE)
def movej(fTargetPos, fTargetVel, fTargetAcc, fTargetTime=0.0, fBlendingRadius=0.0, nMoveMode=MOVE_MODE_ABSOLUTE, nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, nSyncType=0)
def msgRobotState_cb(msg)
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)
def movec(fTargetPos, fTargetVel, fTargetAcc, fTargetTime=0.0, fBlendingRadius=0.0, nMoveReference=MOVE_REFERENCE_BASE, nMoveMode=MOVE_MODE_ABSOLUTE, fAngle1=0.0, fAngle2=0.0, nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, nSyncType=0)