12 from geometry_msgs.msg
import Twist
14 sys.dont_write_bytecode =
True 15 sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__),
"../../../../common/imp")) )
20 ROBOT_MODEL1 =
"m1013" 21 ROBOT_MODEL2 =
"m1013" 28 from DSR_ROBOT
import *
34 while not rospy.is_shutdown():
35 msg.linear.x = (random.random())/RAND_MAX + 1
36 msg.angular.z = 2*(random.random())/RAND_MAX - 1
37 pubMobile1.publish(msg)
41 while not rospy.is_shutdown():
42 msg.linear.x = (random.random())/RAND_MAX + 1
43 msg.angular.z = 2*(random.random())/RAND_MAX - 1
44 pubMobile2.publish(msg)
47 ROBOT_ID1 = id; ROBOT_MODEL1= model
51 ROBOT_ID2 = id; ROBOT_MODEL2= model
54 print "shutdown time!" 55 print "shutdown time!" 56 print "shutdown time!" 58 pub_stop1.publish(stop_mode=1)
59 pub_stop2.publish(stop_mode=1)
66 item = Float64MultiArray()
73 if __name__ ==
"__main__":
75 my_robot_id1 =
"dsr01" 76 my_robot_id2 =
"dsr02" 77 my_robot_model1 =
"m1013" 78 my_robot_model2 =
"m1013" 82 rospy.init_node(
'single_robot_mobile_py')
83 rospy.on_shutdown(shutdown)
85 pub_stop1 = rospy.Publisher(
'/' + ROBOT_ID1 + ROBOT_MODEL1 +
'/stop', RobotStop, queue_size=10)
86 pub_stop2 = rospy.Publisher(
'/' + ROBOT_ID2 + ROBOT_MODEL2 +
'/stop', RobotStop, queue_size=10)
87 pubMobile1 = rospy.Publisher(
'/' + ROBOT_ID1 +
'/twist_marker_server/cmd_vel', Twist, queue_size=10)
88 pubMobile2 = rospy.Publisher(
'/' + ROBOT_ID2 +
'/twist_marker_server/cmd_vel', Twist, queue_size=10)
90 r1 = CDsrRobot(my_robot_id1, my_robot_model1)
91 r2 = CDsrRobot(my_robot_id2, my_robot_model2)
93 mThread1 = threading.Thread(target = thread_mobile1)
94 mThread1.daemon =
True 97 mThread2 = threading.Thread(target = thread_mobile2)
98 mThread2.daemon =
True 109 p1= posj(0,0,0,0,0,0)
110 p2= posj(0.0, 0.0, 90.0, 0.0, 90.0, 0.0)
112 x1= posx(400, 500, 800.0, 0.0, 180.0, 0.0)
113 x2= posx(400, 500, 500.0, 0.0, 180.0, 0.0)
115 c1 = posx(559,434.5,651.5,0,180,0)
116 c2 = posx(559,434.5,251.5,0,180,0)
119 q0 = posj(0,0,0,0,0,0)
120 q1 = posj(10, -10, 20, -30, 10, 20)
121 q2 = posj(25, 0, 10, -50, 20, 40)
122 q3 = posj(50, 50, 50, 50, 50, 50)
123 q4 = posj(30, 10, 30, -20, 10, 60)
124 q5 = posj(20, 20, 40, 20, 0, 90)
125 qlist = [q0, q1, q2, q3, q4, q5]
127 x1 = posx(600, 600, 600, 0, 175, 0)
128 x2 = posx(600, 750, 600, 0, 175, 0)
129 x3 = posx(150, 600, 450, 0, 175, 0)
130 x4 = posx(-300, 300, 300, 0, 175, 0)
131 x5 = posx(-200, 700, 500, 0, 175, 0)
132 x6 = posx(600, 600, 400, 0, 175, 0)
133 xlist = [x1, x2, x3, x4, x5, x6]
136 X1 = posx(370, 670, 650, 0, 180, 0)
137 X1a = posx(370, 670, 400, 0, 180, 0)
138 X1a2= posx(370, 545, 400, 0, 180, 0)
139 X1b = posx(370, 595, 400, 0, 180, 0)
140 X1b2= posx(370, 670, 400, 0, 180, 0)
141 X1c = posx(370, 420, 150, 0, 180, 0)
142 X1c2= posx(370, 545, 150, 0, 180, 0)
143 X1d = posx(370, 670, 275, 0, 180, 0)
144 X1d2= posx(370, 795, 150, 0, 180, 0)
147 seg11 =
posb(DR_LINE, X1, radius=20)
148 seg12 =
posb(DR_CIRCLE, X1a, X1a2, radius=21)
149 seg14 =
posb(DR_LINE, X1b2, radius=20)
150 seg15 =
posb(DR_CIRCLE, X1c, X1c2, radius=22)
151 seg16 =
posb(DR_CIRCLE, X1d, X1d2, radius=23)
152 b_list1 = [seg11, seg12, seg14, seg15, seg16]
156 while not rospy.is_shutdown():
157 r1.movej(p2, vel=100, acc=100)
158 r2.movej(p2, vel=100, acc=100)
160 r1.movejx(x1, vel=30, acc=60)
161 r2.movejx(x1, vel=30, acc=60)
163 r1.movel(x2, velx, accx)
164 r2.movel(x2, velx, accx)
166 r1.movec(c1, c2, velx, accx)
167 r2.movec(c1, c2, velx, accx)
169 r1.movesj(qlist, vel=100, acc=100)
170 r2.movesj(qlist, vel=100, acc=100)
172 r1.movesx(xlist, vel=100, acc=100)
173 r2.movesx(xlist, vel=100, acc=100)
175 r1.move_spiral(rev=9.5,rmax=20.0,lmax=50.0,time=20.0,axis=DR_AXIS_Z,ref=DR_TOOL)
176 r2.move_spiral(rev=9.5,rmax=20.0,lmax=50.0,time=20.0,axis=DR_AXIS_Z,ref=DR_TOOL)
178 r1.move_periodic(amp =[10,0,0,0,30,0], period=1.0, atime=0.2, repeat=5, ref=DR_TOOL)
179 r2.move_periodic(amp =[10,0,0,0,30,0], period=1.0, atime=0.2, repeat=5, ref=DR_TOOL)
181 r1.moveb(b_list1, vel=150, acc=250, ref=DR_BASE, mod=DR_MV_MOD_ABS)
182 r2.moveb(b_list1, vel=150, acc=250, ref=DR_BASE, mod=DR_MV_MOD_ABS)
def SET_ROBOT1(id, model)
def SET_ROBOT2(id, model)
def _ros_listToFloat64MultiArray(list_src)