Drive code works on Tantrum.

Need to write the spring code.  Drive now supports doubles...  What a
pain.

Change-Id: Id589acdc443dcd81242a21e3b0c26f81d6974dc8
diff --git a/frc971/control_loops/python/control_loop.py b/frc971/control_loops/python/control_loop.py
index e62bff9..2ef2ece 100644
--- a/frc971/control_loops/python/control_loop.py
+++ b/frc971/control_loops/python/control_loop.py
@@ -10,9 +10,13 @@
     self.formatToType = {}
     self.formatToType['%f'] = "double"
     self.formatToType['%d'] = "int"
-  def __str__ (self):
+
+  def Render(self, loop_type):
+    typestring = self.formatToType[self.formatt]
+    if loop_type == 'float' and typestring == 'double':
+      typestring = loop_type
     return str("\nstatic constexpr %s %s = "+ self.formatt +";\n") % \
-        (self.formatToType[self.formatt], self.name, self.value)
+        (typestring, self.name, self.value)
 
 
 class ControlLoopWriter(object):
@@ -138,7 +142,7 @@
       fd.write(self._namespace_start)
 
       for const in self._constant_list:
-          fd.write(str(const))
+          fd.write(const.Render(self._scalar_type))
 
       fd.write('\n\n')
       for loop in self._loops:
@@ -325,6 +329,8 @@
       for y in xrange(matrix.shape[1]):
         write_type =  repr(matrix[x, y])
         if scalar_type == 'float':
+          if '.' not in write_type:
+            write_type += '.0'
           write_type += 'f'
         ans.append('  %s(%d, %d) = %s;\n' % (matrix_name, x, y, write_type))
 
diff --git a/frc971/control_loops/python/drivetrain.py b/frc971/control_loops/python/drivetrain.py
index 2380549..4c89fdc 100644
--- a/frc971/control_loops/python/drivetrain.py
+++ b/frc971/control_loops/python/drivetrain.py
@@ -15,10 +15,10 @@
                  wheel_radius,
                  G_high,
                  G_low,
-                 q_pos_low,
-                 q_pos_high,
-                 q_vel_low,
-                 q_vel_high,
+                 q_pos_low=0.12,
+                 q_pos_high=0.14,
+                 q_vel_low=1.0,
+                 q_vel_high=0.95,
                  efficiency=0.60,
                  has_imu=False,
                  force=False,
@@ -349,7 +349,7 @@
 
 
 def WriteDrivetrain(drivetrain_files, kf_drivetrain_files, year_namespace,
-                    drivetrain_params):
+                    drivetrain_params, scalar_type='double'):
 
     # Write the generated constants out to a file.
     drivetrain_low_low = Drivetrain(
@@ -394,13 +394,17 @@
         right_low=False,
         drivetrain_params=drivetrain_params)
 
-    namespaces = [year_namespace, 'control_loops', 'drivetrain']
+    if isinstance(year_namespace, list):
+      namespaces = year_namespace
+    else:
+      namespaces = [year_namespace, 'control_loops', 'drivetrain']
     dog_loop_writer = control_loop.ControlLoopWriter(
         "Drivetrain", [
             drivetrain_low_low, drivetrain_low_high, drivetrain_high_low,
             drivetrain_high_high
         ],
-        namespaces=namespaces)
+        namespaces=namespaces,
+        scalar_type=scalar_type)
     dog_loop_writer.AddConstant(
         control_loop.Constant("kDt", "%f", drivetrain_low_low.dt))
     dog_loop_writer.AddConstant(
@@ -447,7 +451,8 @@
             kf_drivetrain_low_low, kf_drivetrain_low_high,
             kf_drivetrain_high_low, kf_drivetrain_high_high
         ],
-        namespaces=namespaces)
+        namespaces=namespaces,
+        scalar_type=scalar_type)
     kf_loop_writer.Write(kf_drivetrain_files[0], kf_drivetrain_files[1])
 
 
diff --git a/frc971/control_loops/python/polydrivetrain.py b/frc971/control_loops/python/polydrivetrain.py
index c9c9efe..29fdeef 100644
--- a/frc971/control_loops/python/polydrivetrain.py
+++ b/frc971/control_loops/python/polydrivetrain.py
@@ -407,19 +407,23 @@
                self.right_gear, self.right_shifter_position)
 
 def WritePolyDrivetrain(drivetrain_files, motor_files, year_namespace,
-                        drivetrain_params):
+                        drivetrain_params, scalar_type='double'):
   vdrivetrain = VelocityDrivetrain(drivetrain_params)
-  namespaces = [year_namespace, 'control_loops', 'drivetrain']
+  if isinstance(year_namespace, list):
+    namespaces = year_namespace
+  else:
+    namespaces = [year_namespace, 'control_loops', 'drivetrain']
   dog_loop_writer = control_loop.ControlLoopWriter(
       "VelocityDrivetrain", [vdrivetrain.drivetrain_low_low,
                      vdrivetrain.drivetrain_low_high,
                      vdrivetrain.drivetrain_high_low,
                      vdrivetrain.drivetrain_high_high],
-                     namespaces=namespaces)
+                     namespaces=namespaces,
+                     scalar_type=scalar_type)
 
   dog_loop_writer.Write(drivetrain_files[0], drivetrain_files[1])
 
-  cim_writer = control_loop.ControlLoopWriter("CIM", [CIM()])
+  cim_writer = control_loop.ControlLoopWriter("CIM", [CIM()], scalar_type=scalar_type)
 
   cim_writer.Write(motor_files[0], motor_files[1])