Converted Eigen << to direct assignment.
For a Cortex-M4, this results in significantly fewer instructions.
I have no idea why.
Change-Id: Ic398bdf240302d941d9ffb12f4eaa081ecd36080
diff --git a/frc971/control_loops/python/control_loop.py b/frc971/control_loops/python/control_loop.py
index 951a114..d6bd85f 100644
--- a/frc971/control_loops/python/control_loop.py
+++ b/frc971/control_loops/python/control_loop.py
@@ -244,18 +244,10 @@
"""
ans = [' Eigen::Matrix<double, %d, %d> %s;\n' % (
matrix.shape[0], matrix.shape[1], matrix_name)]
- first = True
for x in xrange(matrix.shape[0]):
for y in xrange(matrix.shape[1]):
- element = matrix[x, y]
- if first:
- ans.append(' %s << ' % matrix_name)
- first = False
- else:
- ans.append(', ')
- ans.append(str(element))
+ ans.append(' %s(%d, %d) = %s;\n' % (matrix_name, x, y, repr(matrix[x, y])))
- ans.append(';\n')
return ''.join(ans)
def DumpPlantHeader(self):