blob: bf70ad0e4c8e8f93130d093956171d08af616945 [file] [log] [blame]
Austin Schuhc8ca2442013-02-23 12:29:33 -08001#!/usr/bin/python
2
Austin Schuh3c542312013-02-24 01:53:50 -08003import control_loop
Austin Schuh0d9467a2014-02-15 22:36:45 -08004import controls
Austin Schuhc8ca2442013-02-23 12:29:33 -08005import numpy
Austin Schuhc8ca2442013-02-23 12:29:33 -08006import sys
Austin Schuhc8ca2442013-02-23 12:29:33 -08007from matplotlib import pylab
Austin Schuhc8ca2442013-02-23 12:29:33 -08008
Austin Schuh3bb9a442014-02-02 16:01:45 -08009class Claw(control_loop.ControlLoop):
10 def __init__(self, name="RawClaw"):
11 super(Claw, self).__init__(name)
Austin Schuhc8ca2442013-02-23 12:29:33 -080012 # Stall Torque in N m
James Kuszmaule1755b32014-02-13 06:27:48 -080013 self.stall_torque = 2.42
Austin Schuhc8ca2442013-02-23 12:29:33 -080014 # Stall Current in Amps
James Kuszmaule1755b32014-02-13 06:27:48 -080015 self.stall_current = 133
James Kuszmaul92797402014-02-17 14:08:49 -080016 # Free Speed in RPM
17 self.free_speed = 5500.0
Austin Schuh3c542312013-02-24 01:53:50 -080018 # Free Current in Amps
James Kuszmaule1755b32014-02-13 06:27:48 -080019 self.free_current = 2.7
Austin Schuh3bb9a442014-02-02 16:01:45 -080020 # Moment of inertia of the claw in kg m^2
James Kuszmaul92797402014-02-17 14:08:49 -080021 # measured from CAD
22 self.J_top = 0.3
23 self.J_bottom = 0.9
Austin Schuhc8ca2442013-02-23 12:29:33 -080024 # Resistance of the motor
James Kuszmaul92797402014-02-17 14:08:49 -080025 self.R = 12.0 / self.stall_current
Austin Schuhc8ca2442013-02-23 12:29:33 -080026 # Motor velocity constant
Austin Schuh3c542312013-02-24 01:53:50 -080027 self.Kv = ((self.free_speed / 60.0 * 2.0 * numpy.pi) /
28 (13.5 - self.R * self.free_current))
Austin Schuhc8ca2442013-02-23 12:29:33 -080029 # Torque constant
30 self.Kt = self.stall_torque / self.stall_current
31 # Gear ratio
James Kuszmaule1755b32014-02-13 06:27:48 -080032 self.G = 14.0 / 48.0 * 18.0 / 32.0 * 18.0 / 66.0 * 12.0 / 60.0
Austin Schuhc8ca2442013-02-23 12:29:33 -080033 # Control loop time step
34 self.dt = 0.01
35
James Kuszmaule2afbe42014-02-17 22:29:59 -080036 # State is [bottom position, bottom velocity, top - bottom position,
37 # top - bottom velocity]
38 # Input is [bottom power, top power - bottom power * J_top / J_bottom]
James Kuszmaul92797402014-02-17 14:08:49 -080039 # Motor time constants. difference_bottom refers to the constant for how the
40 # bottom velocity affects the difference of the top and bottom velocities.
41 self.common_motor_constant = -self.Kt / self.Kv / (self.G * self.G * self.R)
42 self.bottom_bottom = self.common_motor_constant / self.J_bottom
43 self.difference_bottom = self.common_motor_constant * (1 / self.J_bottom
44 - 1 / self.J_top)
45 self.difference_difference = self.common_motor_constant / self.J_top
Austin Schuhc8ca2442013-02-23 12:29:33 -080046 # State feedback matrices
James Kuszmaule2afbe42014-02-17 22:29:59 -080047
Austin Schuhc8ca2442013-02-23 12:29:33 -080048 self.A_continuous = numpy.matrix(
James Kuszmaule2afbe42014-02-17 22:29:59 -080049 [[0, 0, 0, 0],
50 [0, 0, 0, 0],
James Kuszmaul92797402014-02-17 14:08:49 -080051 [0, 0, self.bottom_bottom, 0],
52 [0, 0, self.difference_bottom, self.difference_difference]])
Austin Schuh0d9467a2014-02-15 22:36:45 -080053
James Kuszmaule2afbe42014-02-17 22:29:59 -080054 self.A_bottom_cont = numpy.matrix(
55 [[0, 1],
56 [0, self.bottom_bottom]])
57
58 self.A_diff_cont = numpy.matrix(
59 [[0, 1],
60 [0, self.difference_difference]])
61
62 self.A_continuous[0:2, 0:2] = self.A_bottom_cont
63 self.A_continuous[2:4, 2:4] = self.A_diff_cont
64 self.A_continuous[3, 1] = self.difference_bottom
65
James Kuszmaul92797402014-02-17 14:08:49 -080066 self.motor_feedforward = self.Kt / (self.G * self.R)
James Kuszmaulf2ed6e62014-02-17 17:52:07 -080067 self.motor_feedforward_bottom = self.motor_feedforward / self.J_bottom
68 self.motor_feedforward_difference = self.motor_feedforward / self.J_top
James Kuszmaul92797402014-02-17 14:08:49 -080069 self.motor_feedforward_difference_bottom = (
70 self.motor_feedforward * (1 / self.J_bottom - 1 / self.J_top))
Austin Schuhc8ca2442013-02-23 12:29:33 -080071 self.B_continuous = numpy.matrix(
Austin Schuh0d9467a2014-02-15 22:36:45 -080072 [[0, 0],
James Kuszmaul92797402014-02-17 14:08:49 -080073 [self.motor_feedforward_bottom, 0],
James Kuszmaule2afbe42014-02-17 22:29:59 -080074 [0, 0],
75 [0,#self.motor_feedforward_difference_bottom,
James Kuszmaul92797402014-02-17 14:08:49 -080076 self.motor_feedforward_difference]])
James Kuszmaule2afbe42014-02-17 22:29:59 -080077
78 self.B_bottom_cont = numpy.matrix(
79 [[0],
80 [self.motor_feedforward_bottom]])
81
82 self.B_diff_cont = numpy.matrix(
83 [[0],
84 [self.motor_feedforward_difference]])
85
Austin Schuh0d9467a2014-02-15 22:36:45 -080086 self.C = numpy.matrix([[1, 0, 0, 0],
87 [1, 1, 0, 0]])
88 self.D = numpy.matrix([[0, 0],
89 [0, 0]])
Austin Schuhc8ca2442013-02-23 12:29:33 -080090
Austin Schuhc1f68892013-03-16 17:06:27 -070091 self.A, self.B = self.ContinuousToDiscrete(
92 self.A_continuous, self.B_continuous, self.dt)
Austin Schuhc8ca2442013-02-23 12:29:33 -080093
James Kuszmaule2afbe42014-02-17 22:29:59 -080094 self.A_bottom, self.B_bottom = controls.c2d(
95 self.A_bottom_cont, self.B_bottom_cont, self.dt)
96 self.A_diff, self.B_diff = controls.c2d(
97 self.A_diff_cont, self.B_diff_cont, self.dt)
98
99 print self.A, self.B
100
Austin Schuh0d9467a2014-02-15 22:36:45 -0800101 #controlability = controls.ctrb(self.A, self.B);
102 #print "Rank of controlability matrix.", numpy.linalg.matrix_rank(controlability)
103
James Kuszmaulf2ed6e62014-02-17 17:52:07 -0800104 self.Q = numpy.matrix([[(1.0 / (0.40 ** 2.0)), 0.0, 0.0, 0.0],
105 [0.0, (1.0 / (0.007 ** 2.0)), 0.0, 0.0],
Austin Schuhcda86af2014-02-16 16:16:39 -0800106 [0.0, 0.0, 0.2, 0.0],
107 [0.0, 0.0, 0.0, 2.00]])
108
James Kuszmaulf2ed6e62014-02-17 17:52:07 -0800109 self.R = numpy.matrix([[(1.0 / (40.0 ** 2.0)), 0.0],
110 [0.0, (1.0 / (5.0 ** 2.0))]])
James Kuszmaule2afbe42014-02-17 22:29:59 -0800111 #self.K = controls.dlqr(self.A, self.B, self.Q, self.R)
112
113 # TODO(james): Fix this for discrete time domain.
114 self.K = numpy.matrix([[0, 0, 0.0, 0.0],
115 [0.0, self.A[3, 1] / self.B[3, 1], 0, 0]])
116 self.K_bottom = controls.dplace(self.A_bottom, self.B_bottom, [0.5, 0.5])
117 self.K_diff = controls.dplace(self.A_diff, self.B_diff, [0.5, 0.5])
118 self.K[0, 0:2] = self.K_bottom
119 self.K[1, 2:4] = self.K_diff
120 #lstsq_A = numpy.identity(2)
121 #lstsq_A[0] = self.B[1]
122 #lstsq_A[1] = self.B[3]
123 #self.K[0:2, 0] = numpy.linalg.lstsq(lstsq_A, numpy.matrix([[0.0], [0.0]]))[0]
124 #self.K[0:2, 2] = numpy.linalg.lstsq(
125 # lstsq_A,
126 # numpy.matrix([[self.A[1, 2]], [self.A[3, 2]]]))[0]
Austin Schuhcda86af2014-02-16 16:16:39 -0800127
128 print "K unaugmented"
129 print self.K
James Kuszmaule2afbe42014-02-17 22:29:59 -0800130 print "B * K unaugmented"
131 print self.B * self.K
132 F = self.A - self.B * self.K
133 F[1, 2] = 0.0
134 F[3, 2] = 0.0
135 print "A - B * K unaugmented"
136 print F
137 print "eigenvalues"
138 print numpy.linalg.eig(F)[0]
Austin Schuhc8ca2442013-02-23 12:29:33 -0800139
140 self.rpl = .05
141 self.ipl = 0.008
Austin Schuh3c542312013-02-24 01:53:50 -0800142 self.PlaceObserverPoles([self.rpl + 1j * self.ipl,
Austin Schuh0d9467a2014-02-15 22:36:45 -0800143 self.rpl + 1j * self.ipl,
James Kuszmaule2afbe42014-02-17 22:29:59 -0800144 self.rpl - 1j * self.ipl,
Austin Schuh3c542312013-02-24 01:53:50 -0800145 self.rpl - 1j * self.ipl])
Austin Schuhc8ca2442013-02-23 12:29:33 -0800146
James Kuszmaul92797402014-02-17 14:08:49 -0800147 # The box formed by U_min and U_max must encompass all possible values,
148 # or else Austin's code gets angry.
Austin Schuhcda86af2014-02-16 16:16:39 -0800149 self.U_max = numpy.matrix([[12.0], [24.0]])
150 self.U_min = numpy.matrix([[-12.0], [-24.0]])
Austin Schuhc8ca2442013-02-23 12:29:33 -0800151
Austin Schuhc1f68892013-03-16 17:06:27 -0700152 self.InitializeState()
153
154
Austin Schuh3bb9a442014-02-02 16:01:45 -0800155class ClawDeltaU(Claw):
156 def __init__(self, name="Claw"):
157 super(ClawDeltaU, self).__init__(name)
Austin Schuhc1f68892013-03-16 17:06:27 -0700158 A_unaugmented = self.A
159 B_unaugmented = self.B
Austin Schuh0d9467a2014-02-15 22:36:45 -0800160 C_unaugmented = self.C
Austin Schuhc1f68892013-03-16 17:06:27 -0700161
Austin Schuh0d9467a2014-02-15 22:36:45 -0800162 self.A = numpy.matrix([[0.0, 0.0, 0.0, 0.0, 0.0],
163 [0.0, 0.0, 0.0, 0.0, 0.0],
164 [0.0, 0.0, 0.0, 0.0, 0.0],
165 [0.0, 0.0, 0.0, 0.0, 0.0],
166 [0.0, 0.0, 0.0, 0.0, 1.0]])
167 self.A[0:4, 0:4] = A_unaugmented
168 self.A[0:4, 4] = B_unaugmented[0:4, 0]
Austin Schuhc1f68892013-03-16 17:06:27 -0700169
Austin Schuh0d9467a2014-02-15 22:36:45 -0800170 self.B = numpy.matrix([[0.0, 0.0],
171 [0.0, 0.0],
172 [0.0, 0.0],
173 [0.0, 0.0],
174 [1.0, 0.0]])
175 self.B[0:4, 1] = B_unaugmented[0:4, 1]
Austin Schuhc1f68892013-03-16 17:06:27 -0700176
Austin Schuh0d9467a2014-02-15 22:36:45 -0800177 self.C = numpy.concatenate((C_unaugmented, numpy.matrix([[0.0], [0.0]])),
178 axis=1)
179 self.D = numpy.matrix([[0.0, 0.0],
180 [0.0, 0.0]])
Austin Schuhc1f68892013-03-16 17:06:27 -0700181
Austin Schuh0d9467a2014-02-15 22:36:45 -0800182 #self.PlaceControllerPoles([0.55, 0.35, 0.55, 0.35, 0.80])
183 self.Q = numpy.matrix([[(1.0 / (0.04 ** 2.0)), 0.0, 0.0, 0.0, 0.0],
184 [0.0, (1.0 / (0.01 ** 2)), 0.0, 0.0, 0.0],
185 [0.0, 0.0, 0.01, 0.0, 0.0],
186 [0.0, 0.0, 0.0, 0.08, 0.0],
187 [0.0, 0.0, 0.0, 0.0, (1.0 / (10.0 ** 2))]])
188
189 self.R = numpy.matrix([[0.000001, 0.0],
190 [0.0, 1.0 / (10.0 ** 2.0)]])
191 self.K = controls.dlqr(self.A, self.B, self.Q, self.R)
192
193 self.K = numpy.matrix([[50.0, 0.0, 10.0, 0.0, 1.0],
194 [50.0, 0.0, 10.0, 0.0, 1.0]])
195 #self.K = numpy.matrix([[50.0, -100.0, 0, -10, 0],
196 # [50.0, 100.0, 0, 10, 0]])
197
198 controlability = controls.ctrb(self.A, self.B);
199 print "Rank of augmented controlability matrix.", numpy.linalg.matrix_rank(controlability)
Austin Schuhc1f68892013-03-16 17:06:27 -0700200
201 print "K"
202 print self.K
203 print "Placed controller poles are"
204 print numpy.linalg.eig(self.A - self.B * self.K)[0]
Austin Schuh0d9467a2014-02-15 22:36:45 -0800205 print [numpy.abs(x) for x in numpy.linalg.eig(self.A - self.B * self.K)[0]]
Austin Schuhc1f68892013-03-16 17:06:27 -0700206
207 self.rpl = .05
208 self.ipl = 0.008
Austin Schuh0d9467a2014-02-15 22:36:45 -0800209 self.PlaceObserverPoles([self.rpl + 1j * self.ipl, 0.10, 0.09,
Brian Silverman23a67ca2013-03-16 23:48:50 -0700210 self.rpl - 1j * self.ipl, 0.90])
Austin Schuh0d9467a2014-02-15 22:36:45 -0800211 #print "A is"
212 #print self.A
213 #print "L is"
214 #print self.L
215 #print "C is"
216 #print self.C
217 #print "A - LC is"
218 #print self.A - self.L * self.C
Austin Schuhc1f68892013-03-16 17:06:27 -0700219
Austin Schuh0d9467a2014-02-15 22:36:45 -0800220 #print "Placed observer poles are"
221 #print numpy.linalg.eig(self.A - self.L * self.C)[0]
222
223 self.U_max = numpy.matrix([[12.0], [12.0]])
224 self.U_min = numpy.matrix([[-12.0], [-12.0]])
Austin Schuhc1f68892013-03-16 17:06:27 -0700225
226 self.InitializeState()
227
228
Austin Schuhcda86af2014-02-16 16:16:39 -0800229def FullSeparationPriority(claw, U):
230 bottom_u = U[0, 0]
231 top_u = U[1, 0] + bottom_u
232
233 #print "Bottom is", new_unclipped_bottom_u, "Top is", top_u
234 if bottom_u > claw.U_max[0, 0]:
235 #print "Bottom is too big. Was", new_unclipped_bottom_u, "changing top by", new_unclipped_bottom_u - claw.U_max[0, 0]
236 top_u -= bottom_u - claw.U_max[0, 0]
237 if top_u < claw.U_min[1, 0]:
238 top_u = claw.U_min[1, 0]
239
240 bottom_u = claw.U_max[0, 0]
241 if top_u > claw.U_max[1, 0]:
242 bottom_u -= top_u - claw.U_max[1, 0]
243 if bottom_u < claw.U_min[0, 0]:
244 bottom_u = claw.U_min[0, 0]
245
246 top_u = claw.U_max[1, 0]
247 if top_u < claw.U_min[1, 0]:
248 bottom_u -= top_u - claw.U_min[1, 0]
249 if bottom_u > claw.U_max[0, 0]:
250 bottom_u = claw.U_max[0, 0]
251
252 top_u = claw.U_min[1, 0]
253 if bottom_u < claw.U_min[0, 0]:
254 top_u -= bottom_u - claw.U_min[0, 0]
255 if top_u > claw.U_max[1, 0]:
256 top_u = claw.U_max[1, 0]
257
258 bottom_u = claw.U_min[0, 0]
259
260 return numpy.matrix([[bottom_u], [top_u - bottom_u]])
261
262def AverageUFix(claw, U):
263 bottom_u = U[0, 0]
James Kuszmaulf2ed6e62014-02-17 17:52:07 -0800264 top_u = bottom_u + U[1, 0]
265#top_u = claw.J_top * (bottom_u / claw.J_bottom - U[1, 0])
Austin Schuhcda86af2014-02-16 16:16:39 -0800266
267 #print "Bottom is", new_unclipped_bottom_u, "Top is", top_u
James Kuszmaul92797402014-02-17 14:08:49 -0800268 if (bottom_u > claw.U_max[0, 0] or top_u > claw.U_max[0, 0] or
269 top_u < claw.U_min[0, 0] or bottom_u < claw.U_min[0, 0]):
Austin Schuhcda86af2014-02-16 16:16:39 -0800270 scalar = 12.0 / max(numpy.abs(top_u), numpy.abs(bottom_u))
271 top_u *= scalar
272 bottom_u *= scalar
273
274 return numpy.matrix([[bottom_u], [top_u - bottom_u]])
James Kuszmaulf2ed6e62014-02-17 17:52:07 -0800275 #return numpy.matrix([[bottom_u], [bottom_u / claw.J_bottom - top_u / claw.J_top]])
Austin Schuhcda86af2014-02-16 16:16:39 -0800276
Austin Schuh0d9467a2014-02-15 22:36:45 -0800277def ClipDeltaU(claw, U):
278 delta_u = U[0, 0]
279 top_u = U[1, 0]
280 old_bottom_u = claw.X[4, 0]
281
282 # TODO(austin): Preserve the difference between the top and bottom power.
283 new_unclipped_bottom_u = old_bottom_u + delta_u
284
285 #print "Bottom is", new_unclipped_bottom_u, "Top is", top_u
286 if new_unclipped_bottom_u > claw.U_max[0, 0]:
287 #print "Bottom is too big. Was", new_unclipped_bottom_u, "changing top by", new_unclipped_bottom_u - claw.U_max[0, 0]
288 top_u -= new_unclipped_bottom_u - claw.U_max[0, 0]
289 new_unclipped_bottom_u = claw.U_max[0, 0]
290 if top_u > claw.U_max[1, 0]:
291 new_unclipped_bottom_u -= top_u - claw.U_max[1, 0]
292 top_u = claw.U_max[1, 0]
293 if top_u < claw.U_min[1, 0]:
294 new_unclipped_bottom_u -= top_u - claw.U_min[1, 0]
295 top_u = claw.U_min[1, 0]
296 if new_unclipped_bottom_u < claw.U_min[0, 0]:
297 top_u -= new_unclipped_bottom_u - claw.U_min[0, 0]
298 new_unclipped_bottom_u = claw.U_min[0, 0]
299
300 new_bottom_u = numpy.clip(new_unclipped_bottom_u, claw.U_min[0, 0], claw.U_max[0, 0])
301 new_top_u = numpy.clip(top_u, claw.U_min[1, 0], claw.U_max[1, 0])
302
303 return numpy.matrix([[new_bottom_u - old_bottom_u], [new_top_u]])
Austin Schuhc1f68892013-03-16 17:06:27 -0700304
Austin Schuhc8ca2442013-02-23 12:29:33 -0800305def main(argv):
Austin Schuh3c542312013-02-24 01:53:50 -0800306 # Simulate the response of the system to a step input.
Austin Schuh0d9467a2014-02-15 22:36:45 -0800307 #claw = ClawDeltaU()
308 #simulated_x = []
309 #for _ in xrange(100):
310 # claw.Update(numpy.matrix([[12.0]]))
311 # simulated_x.append(claw.X[0, 0])
Austin Schuhc8ca2442013-02-23 12:29:33 -0800312
Austin Schuh0d9467a2014-02-15 22:36:45 -0800313 #pylab.plot(range(100), simulated_x)
314 #pylab.show()
Austin Schuhc8ca2442013-02-23 12:29:33 -0800315
James Kuszmaulf2ed6e62014-02-17 17:52:07 -0800316 # Simulate the closed loop response of the system.
Austin Schuhcda86af2014-02-16 16:16:39 -0800317 claw = Claw("TopClaw")
318 t = []
Austin Schuh0d9467a2014-02-15 22:36:45 -0800319 close_loop_x_bottom = []
320 close_loop_x_sep = []
James Kuszmaulf2ed6e62014-02-17 17:52:07 -0800321 close_loop_x_top = []
Austin Schuh0d9467a2014-02-15 22:36:45 -0800322 close_loop_u_bottom = []
323 close_loop_u_top = []
James Kuszmaulf2ed6e62014-02-17 17:52:07 -0800324 R = numpy.matrix([[1.1], [0.05], [0.0], [0.0]])
Austin Schuhcda86af2014-02-16 16:16:39 -0800325 claw.X[0, 0] = 0
James Kuszmaulf2ed6e62014-02-17 17:52:07 -0800326 claw.X[1, 0] = .05
Austin Schuhcda86af2014-02-16 16:16:39 -0800327 for i in xrange(100):
328 #print "Error is", (R - claw.X_hat)
329 U = claw.K * (R - claw.X_hat)
330 #U = numpy.clip(claw.K * (R - claw.X_hat), claw.U_min, claw.U_max)
331 #U = FullSeparationPriority(claw, U)
332 U = AverageUFix(claw, U)
333 #U = claw.K * (R - claw.X_hat)
334 #U = ClipDeltaU(claw, U)
335 claw.UpdateObserver(U)
336 claw.Update(U)
337 close_loop_x_bottom.append(claw.X[0, 0] * 10)
338 close_loop_u_bottom.append(U[0, 0])
James Kuszmaulf2ed6e62014-02-17 17:52:07 -0800339 close_loop_x_sep.append(claw.X[1, 0] * 100)
340 close_loop_x_top.append((claw.X[1, 0] + claw.X[0, 0]) * 10)
Austin Schuhcda86af2014-02-16 16:16:39 -0800341 close_loop_u_top.append(U[1, 0] + U[0, 0])
342 t.append(0.01 * i)
Austin Schuhc8ca2442013-02-23 12:29:33 -0800343
Austin Schuhcda86af2014-02-16 16:16:39 -0800344 pylab.plot(t, close_loop_x_bottom, label='x bottom')
James Kuszmaulf2ed6e62014-02-17 17:52:07 -0800345 pylab.plot(t, close_loop_x_sep, label='separation')
346 pylab.plot(t, close_loop_x_top, label='x top')
Austin Schuhcda86af2014-02-16 16:16:39 -0800347 pylab.plot(t, close_loop_u_bottom, label='u bottom')
348 pylab.plot(t, close_loop_u_top, label='u top')
Austin Schuh0d9467a2014-02-15 22:36:45 -0800349 pylab.legend()
Austin Schuhfa033692013-02-24 01:00:55 -0800350 pylab.show()
Austin Schuhc8ca2442013-02-23 12:29:33 -0800351
Austin Schuh3c542312013-02-24 01:53:50 -0800352 # Write the generated constants out to a file.
Austin Schuhcda86af2014-02-16 16:16:39 -0800353 if len(argv) != 3:
354 print "Expected .h file name and .cc file name for the claw."
Austin Schuhc8ca2442013-02-23 12:29:33 -0800355 else:
Austin Schuhcda86af2014-02-16 16:16:39 -0800356 claw = Claw("Claw")
357 loop_writer = control_loop.ControlLoopWriter("Claw", [claw])
Austin Schuh683a0d02013-03-02 01:51:31 -0800358 if argv[1][-3:] == '.cc':
Austin Schuhcda86af2014-02-16 16:16:39 -0800359 loop_writer.Write(argv[2], argv[1])
Austin Schuh683a0d02013-03-02 01:51:31 -0800360 else:
Austin Schuhcda86af2014-02-16 16:16:39 -0800361 loop_writer.Write(argv[1], argv[2])
Austin Schuhc8ca2442013-02-23 12:29:33 -0800362
363if __name__ == '__main__':
364 sys.exit(main(sys.argv))