Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 1 | import controls |
| 2 | import numpy |
| 3 | |
Ben Fredrickson | 1b45f78 | 2014-02-23 07:44:36 +0000 | [diff] [blame] | 4 | class Constant(object): |
Austin Schuh | 1a38796 | 2015-01-31 16:36:20 -0800 | [diff] [blame] | 5 | def __init__ (self, name, formatt, value): |
| 6 | self.name = name |
| 7 | self.formatt = formatt |
| 8 | self.value = value |
| 9 | self.formatToType = {} |
| 10 | self.formatToType['%f'] = "double"; |
| 11 | self.formatToType['%d'] = "int"; |
| 12 | def __str__ (self): |
| 13 | return str("\nstatic constexpr %s %s = "+ self.formatt +";\n") % \ |
| 14 | (self.formatToType[self.formatt], self.name, self.value) |
Ben Fredrickson | 1b45f78 | 2014-02-23 07:44:36 +0000 | [diff] [blame] | 15 | |
| 16 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 17 | class ControlLoopWriter(object): |
Ben Fredrickson | 1b45f78 | 2014-02-23 07:44:36 +0000 | [diff] [blame] | 18 | def __init__(self, gain_schedule_name, loops, namespaces=None, write_constants=False): |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 19 | """Constructs a control loop writer. |
| 20 | |
| 21 | Args: |
| 22 | gain_schedule_name: string, Name of the overall controller. |
| 23 | loops: array[ControlLoop], a list of control loops to gain schedule |
| 24 | in order. |
| 25 | namespaces: array[string], a list of names of namespaces to nest in |
| 26 | order. If None, the default will be used. |
| 27 | """ |
| 28 | self._gain_schedule_name = gain_schedule_name |
| 29 | self._loops = loops |
| 30 | if namespaces: |
| 31 | self._namespaces = namespaces |
| 32 | else: |
| 33 | self._namespaces = ['frc971', 'control_loops'] |
| 34 | |
| 35 | self._namespace_start = '\n'.join( |
| 36 | ['namespace %s {' % name for name in self._namespaces]) |
| 37 | |
| 38 | self._namespace_end = '\n'.join( |
| 39 | ['} // namespace %s' % name for name in reversed(self._namespaces)]) |
Ben Fredrickson | 1b45f78 | 2014-02-23 07:44:36 +0000 | [diff] [blame] | 40 | |
| 41 | self._constant_list = [] |
Austin Schuh | 2593385 | 2014-02-23 02:04:13 -0800 | [diff] [blame] | 42 | |
| 43 | def AddConstant(self, constant): |
| 44 | """Adds a constant to write. |
| 45 | |
| 46 | Args: |
| 47 | constant: Constant, the constant to add to the header. |
| 48 | """ |
| 49 | self._constant_list.append(constant) |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 50 | |
Brian Silverman | e51ad63 | 2014-01-08 15:12:29 -0800 | [diff] [blame] | 51 | def _TopDirectory(self): |
| 52 | return self._namespaces[0] |
| 53 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 54 | def _HeaderGuard(self, header_file): |
Brian Silverman | e51ad63 | 2014-01-08 15:12:29 -0800 | [diff] [blame] | 55 | return (self._TopDirectory().upper() + '_CONTROL_LOOPS_' + |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 56 | header_file.upper().replace('.', '_').replace('/', '_') + |
| 57 | '_') |
| 58 | |
| 59 | def Write(self, header_file, cc_file): |
| 60 | """Writes the loops to the specified files.""" |
| 61 | self.WriteHeader(header_file) |
| 62 | self.WriteCC(header_file, cc_file) |
| 63 | |
| 64 | def _GenericType(self, typename): |
| 65 | """Returns a loop template using typename for the type.""" |
| 66 | num_states = self._loops[0].A.shape[0] |
| 67 | num_inputs = self._loops[0].B.shape[1] |
| 68 | num_outputs = self._loops[0].C.shape[0] |
| 69 | return '%s<%d, %d, %d>' % ( |
| 70 | typename, num_states, num_inputs, num_outputs) |
| 71 | |
| 72 | def _ControllerType(self): |
| 73 | """Returns a template name for StateFeedbackController.""" |
| 74 | return self._GenericType('StateFeedbackController') |
| 75 | |
| 76 | def _LoopType(self): |
| 77 | """Returns a template name for StateFeedbackLoop.""" |
| 78 | return self._GenericType('StateFeedbackLoop') |
| 79 | |
| 80 | def _PlantType(self): |
| 81 | """Returns a template name for StateFeedbackPlant.""" |
| 82 | return self._GenericType('StateFeedbackPlant') |
| 83 | |
| 84 | def _CoeffType(self): |
| 85 | """Returns a template name for StateFeedbackPlantCoefficients.""" |
| 86 | return self._GenericType('StateFeedbackPlantCoefficients') |
| 87 | |
James Kuszmaul | 0e86651 | 2014-02-21 13:12:52 -0800 | [diff] [blame] | 88 | def WriteHeader(self, header_file, double_appendage=False, MoI_ratio=0.0): |
| 89 | """Writes the header file to the file named header_file. |
| 90 | Set double_appendage to true in order to include a ratio of |
| 91 | moments of inertia constant. Currently, only used for 2014 claw.""" |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 92 | with open(header_file, 'w') as fd: |
| 93 | header_guard = self._HeaderGuard(header_file) |
| 94 | fd.write('#ifndef %s\n' |
| 95 | '#define %s\n\n' % (header_guard, header_guard)) |
| 96 | fd.write('#include \"frc971/control_loops/state_feedback_loop.h\"\n') |
| 97 | fd.write('\n') |
| 98 | |
| 99 | fd.write(self._namespace_start) |
Ben Fredrickson | 1b45f78 | 2014-02-23 07:44:36 +0000 | [diff] [blame] | 100 | |
| 101 | for const in self._constant_list: |
| 102 | fd.write(str(const)) |
| 103 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 104 | fd.write('\n\n') |
| 105 | for loop in self._loops: |
| 106 | fd.write(loop.DumpPlantHeader()) |
| 107 | fd.write('\n') |
| 108 | fd.write(loop.DumpControllerHeader()) |
| 109 | fd.write('\n') |
| 110 | |
| 111 | fd.write('%s Make%sPlant();\n\n' % |
| 112 | (self._PlantType(), self._gain_schedule_name)) |
| 113 | |
| 114 | fd.write('%s Make%sLoop();\n\n' % |
| 115 | (self._LoopType(), self._gain_schedule_name)) |
| 116 | |
| 117 | fd.write(self._namespace_end) |
| 118 | fd.write('\n\n') |
| 119 | fd.write("#endif // %s\n" % header_guard) |
| 120 | |
| 121 | def WriteCC(self, header_file_name, cc_file): |
| 122 | """Writes the cc file to the file named cc_file.""" |
| 123 | with open(cc_file, 'w') as fd: |
Brian Silverman | df3e7b2 | 2013-11-08 19:43:27 -0800 | [diff] [blame] | 124 | fd.write('#include \"%s/control_loops/%s\"\n' % |
Brian Silverman | e51ad63 | 2014-01-08 15:12:29 -0800 | [diff] [blame] | 125 | (self._TopDirectory(), header_file_name)) |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 126 | fd.write('\n') |
| 127 | fd.write('#include <vector>\n') |
| 128 | fd.write('\n') |
| 129 | fd.write('#include \"frc971/control_loops/state_feedback_loop.h\"\n') |
| 130 | fd.write('\n') |
| 131 | fd.write(self._namespace_start) |
| 132 | fd.write('\n\n') |
| 133 | for loop in self._loops: |
| 134 | fd.write(loop.DumpPlant()) |
| 135 | fd.write('\n') |
| 136 | |
| 137 | for loop in self._loops: |
| 138 | fd.write(loop.DumpController()) |
| 139 | fd.write('\n') |
| 140 | |
| 141 | fd.write('%s Make%sPlant() {\n' % |
| 142 | (self._PlantType(), self._gain_schedule_name)) |
Austin Schuh | 1a38796 | 2015-01-31 16:36:20 -0800 | [diff] [blame] | 143 | fd.write(' ::std::vector< ::std::unique_ptr<%s>> plants(%d);\n' % ( |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 144 | self._CoeffType(), len(self._loops))) |
| 145 | for index, loop in enumerate(self._loops): |
Austin Schuh | 1a38796 | 2015-01-31 16:36:20 -0800 | [diff] [blame] | 146 | fd.write(' plants[%d] = ::std::unique_ptr<%s>(new %s(%s));\n' % |
| 147 | (index, self._CoeffType(), self._CoeffType(), |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 148 | loop.PlantFunction())) |
Austin Schuh | 1a38796 | 2015-01-31 16:36:20 -0800 | [diff] [blame] | 149 | fd.write(' return %s(&plants);\n' % self._PlantType()) |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 150 | fd.write('}\n\n') |
| 151 | |
| 152 | fd.write('%s Make%sLoop() {\n' % |
| 153 | (self._LoopType(), self._gain_schedule_name)) |
Austin Schuh | 1a38796 | 2015-01-31 16:36:20 -0800 | [diff] [blame] | 154 | fd.write(' ::std::vector< ::std::unique_ptr<%s>> controllers(%d);\n' % ( |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 155 | self._ControllerType(), len(self._loops))) |
| 156 | for index, loop in enumerate(self._loops): |
Austin Schuh | 1a38796 | 2015-01-31 16:36:20 -0800 | [diff] [blame] | 157 | fd.write(' controllers[%d] = ::std::unique_ptr<%s>(new %s(%s));\n' % |
| 158 | (index, self._ControllerType(), self._ControllerType(), |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 159 | loop.ControllerFunction())) |
Austin Schuh | 1a38796 | 2015-01-31 16:36:20 -0800 | [diff] [blame] | 160 | fd.write(' return %s(&controllers);\n' % self._LoopType()) |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 161 | fd.write('}\n\n') |
| 162 | |
| 163 | fd.write(self._namespace_end) |
| 164 | fd.write('\n') |
| 165 | |
| 166 | |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 167 | class ControlLoop(object): |
| 168 | def __init__(self, name): |
| 169 | """Constructs a control loop object. |
| 170 | |
| 171 | Args: |
| 172 | name: string, The name of the loop to use when writing the C++ files. |
| 173 | """ |
| 174 | self._name = name |
| 175 | |
Austin Schuh | c1f6889 | 2013-03-16 17:06:27 -0700 | [diff] [blame] | 176 | def ContinuousToDiscrete(self, A_continuous, B_continuous, dt): |
| 177 | """Calculates the discrete time values for A and B. |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 178 | |
| 179 | Args: |
| 180 | A_continuous: numpy.matrix, The continuous time A matrix |
| 181 | B_continuous: numpy.matrix, The continuous time B matrix |
| 182 | dt: float, The time step of the control loop |
Austin Schuh | c1f6889 | 2013-03-16 17:06:27 -0700 | [diff] [blame] | 183 | |
| 184 | Returns: |
| 185 | (A, B), numpy.matrix, the control matricies. |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 186 | """ |
Austin Schuh | c1f6889 | 2013-03-16 17:06:27 -0700 | [diff] [blame] | 187 | return controls.c2d(A_continuous, B_continuous, dt) |
| 188 | |
| 189 | def InitializeState(self): |
| 190 | """Sets X, Y, and X_hat to zero defaults.""" |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 191 | self.X = numpy.zeros((self.A.shape[0], 1)) |
Austin Schuh | c1f6889 | 2013-03-16 17:06:27 -0700 | [diff] [blame] | 192 | self.Y = self.C * self.X |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 193 | self.X_hat = numpy.zeros((self.A.shape[0], 1)) |
| 194 | |
| 195 | def PlaceControllerPoles(self, poles): |
| 196 | """Places the controller poles. |
| 197 | |
| 198 | Args: |
| 199 | poles: array, An array of poles. Must be complex conjegates if they have |
| 200 | any imaginary portions. |
| 201 | """ |
| 202 | self.K = controls.dplace(self.A, self.B, poles) |
| 203 | |
| 204 | def PlaceObserverPoles(self, poles): |
| 205 | """Places the observer poles. |
| 206 | |
| 207 | Args: |
| 208 | poles: array, An array of poles. Must be complex conjegates if they have |
| 209 | any imaginary portions. |
| 210 | """ |
| 211 | self.L = controls.dplace(self.A.T, self.C.T, poles).T |
| 212 | |
| 213 | def Update(self, U): |
| 214 | """Simulates one time step with the provided U.""" |
James Kuszmaul | c02a39a | 2014-02-18 15:45:16 -0800 | [diff] [blame] | 215 | #U = numpy.clip(U, self.U_min, self.U_max) |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 216 | self.X = self.A * self.X + self.B * U |
| 217 | self.Y = self.C * self.X + self.D * U |
| 218 | |
Austin Schuh | 1a38796 | 2015-01-31 16:36:20 -0800 | [diff] [blame] | 219 | def PredictObserver(self, U): |
| 220 | """Runs the predict step of the observer update.""" |
| 221 | self.X_hat = (self.A * self.X_hat + self.B * U) |
| 222 | |
| 223 | def CorrectObserver(self, U): |
| 224 | """Runs the correct step of the observer update.""" |
| 225 | self.X_hat += numpy.linalg.inv(self.A) * self.L * ( |
| 226 | self.Y - self.C * self.X_hat - self.D * U) |
| 227 | |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 228 | def UpdateObserver(self, U): |
| 229 | """Updates the observer given the provided U.""" |
| 230 | self.X_hat = (self.A * self.X_hat + self.B * U + |
| 231 | self.L * (self.Y - self.C * self.X_hat - self.D * U)) |
| 232 | |
| 233 | def _DumpMatrix(self, matrix_name, matrix): |
| 234 | """Dumps the provided matrix into a variable called matrix_name. |
| 235 | |
| 236 | Args: |
| 237 | matrix_name: string, The variable name to save the matrix to. |
| 238 | matrix: The matrix to dump. |
| 239 | |
| 240 | Returns: |
| 241 | string, The C++ commands required to populate a variable named matrix_name |
| 242 | with the contents of matrix. |
| 243 | """ |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 244 | ans = [' Eigen::Matrix<double, %d, %d> %s;\n' % ( |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 245 | matrix.shape[0], matrix.shape[1], matrix_name)] |
| 246 | first = True |
Brian Silverman | 0f63738 | 2013-03-03 17:44:46 -0800 | [diff] [blame] | 247 | for x in xrange(matrix.shape[0]): |
| 248 | for y in xrange(matrix.shape[1]): |
Austin Schuh | 7ec34fd | 2014-02-15 22:27:46 -0800 | [diff] [blame] | 249 | element = matrix[x, y] |
Brian Silverman | 0f63738 | 2013-03-03 17:44:46 -0800 | [diff] [blame] | 250 | if first: |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 251 | ans.append(' %s << ' % matrix_name) |
Brian Silverman | 0f63738 | 2013-03-03 17:44:46 -0800 | [diff] [blame] | 252 | first = False |
| 253 | else: |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 254 | ans.append(', ') |
Brian Silverman | 0f63738 | 2013-03-03 17:44:46 -0800 | [diff] [blame] | 255 | ans.append(str(element)) |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 256 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 257 | ans.append(';\n') |
| 258 | return ''.join(ans) |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 259 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 260 | def DumpPlantHeader(self): |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 261 | """Writes out a c++ header declaration which will create a Plant object. |
| 262 | |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 263 | Returns: |
| 264 | string, The header declaration for the function. |
| 265 | """ |
| 266 | num_states = self.A.shape[0] |
| 267 | num_inputs = self.B.shape[1] |
| 268 | num_outputs = self.C.shape[0] |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 269 | return 'StateFeedbackPlantCoefficients<%d, %d, %d> Make%sPlantCoefficients();\n' % ( |
| 270 | num_states, num_inputs, num_outputs, self._name) |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 271 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 272 | def DumpPlant(self): |
| 273 | """Writes out a c++ function which will create a PlantCoefficients object. |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 274 | |
| 275 | Returns: |
| 276 | string, The function which will create the object. |
| 277 | """ |
| 278 | num_states = self.A.shape[0] |
| 279 | num_inputs = self.B.shape[1] |
| 280 | num_outputs = self.C.shape[0] |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 281 | ans = ['StateFeedbackPlantCoefficients<%d, %d, %d>' |
| 282 | ' Make%sPlantCoefficients() {\n' % ( |
| 283 | num_states, num_inputs, num_outputs, self._name)] |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 284 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 285 | ans.append(self._DumpMatrix('A', self.A)) |
| 286 | ans.append(self._DumpMatrix('B', self.B)) |
| 287 | ans.append(self._DumpMatrix('C', self.C)) |
| 288 | ans.append(self._DumpMatrix('D', self.D)) |
| 289 | ans.append(self._DumpMatrix('U_max', self.U_max)) |
| 290 | ans.append(self._DumpMatrix('U_min', self.U_min)) |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 291 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 292 | ans.append(' return StateFeedbackPlantCoefficients<%d, %d, %d>' |
| 293 | '(A, B, C, D, U_max, U_min);\n' % (num_states, num_inputs, |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 294 | num_outputs)) |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 295 | ans.append('}\n') |
| 296 | return ''.join(ans) |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 297 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 298 | def PlantFunction(self): |
| 299 | """Returns the name of the plant coefficient function.""" |
| 300 | return 'Make%sPlantCoefficients()' % self._name |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 301 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 302 | def ControllerFunction(self): |
| 303 | """Returns the name of the controller function.""" |
| 304 | return 'Make%sController()' % self._name |
| 305 | |
| 306 | def DumpControllerHeader(self): |
| 307 | """Writes out a c++ header declaration which will create a Controller object. |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 308 | |
| 309 | Returns: |
| 310 | string, The header declaration for the function. |
| 311 | """ |
| 312 | num_states = self.A.shape[0] |
| 313 | num_inputs = self.B.shape[1] |
| 314 | num_outputs = self.C.shape[0] |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 315 | return 'StateFeedbackController<%d, %d, %d> %s;\n' % ( |
| 316 | num_states, num_inputs, num_outputs, self.ControllerFunction()) |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 317 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 318 | def DumpController(self): |
| 319 | """Returns a c++ function which will create a Controller object. |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 320 | |
| 321 | Returns: |
| 322 | string, The function which will create the object. |
| 323 | """ |
| 324 | num_states = self.A.shape[0] |
| 325 | num_inputs = self.B.shape[1] |
| 326 | num_outputs = self.C.shape[0] |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 327 | ans = ['StateFeedbackController<%d, %d, %d> %s {\n' % ( |
| 328 | num_states, num_inputs, num_outputs, self.ControllerFunction())] |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 329 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 330 | ans.append(self._DumpMatrix('L', self.L)) |
| 331 | ans.append(self._DumpMatrix('K', self.K)) |
Austin Schuh | 1a38796 | 2015-01-31 16:36:20 -0800 | [diff] [blame] | 332 | ans.append(self._DumpMatrix('A_inv', numpy.linalg.inv(self.A))) |
Austin Schuh | 3c54231 | 2013-02-24 01:53:50 -0800 | [diff] [blame] | 333 | |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 334 | ans.append(' return StateFeedbackController<%d, %d, %d>' |
Austin Schuh | 1a38796 | 2015-01-31 16:36:20 -0800 | [diff] [blame] | 335 | '(L, K, A_inv, Make%sPlantCoefficients());\n' % ( |
| 336 | num_states, num_inputs, num_outputs, self._name)) |
Austin Schuh | e349062 | 2013-03-13 01:24:30 -0700 | [diff] [blame] | 337 | ans.append('}\n') |
| 338 | return ''.join(ans) |