Automatically generate claw constants.
Change-Id: I35d15b34e6ae8349b009cd636d5e3962f1c6af5c
diff --git a/y2014/control_loops/python/BUILD b/y2014/control_loops/python/BUILD
index 232d128..ee99aa4 100644
--- a/y2014/control_loops/python/BUILD
+++ b/y2014/control_loops/python/BUILD
@@ -7,5 +7,27 @@
],
deps = [
'//frc971/control_loops/python:controls',
+ ],
+)
+
+py_library(
+ name = 'polydrivetrain',
+ srcs = [
+ 'polydrivetrain.py',
+ 'drivetrain.py',
+ ],
+ deps = [
+ '//frc971/control_loops/python:controls',
+ ],
+)
+
+py_binary(
+ name = 'claw',
+ srcs = [
+ 'claw.py',
+ ],
+ deps = [
+ ':polydrivetrain',
+ '//frc971/control_loops/python:controls',
]
)
diff --git a/y2014/control_loops/python/claw.py b/y2014/control_loops/python/claw.py
index b5ea6a1..f1fcae3 100755
--- a/y2014/control_loops/python/claw.py
+++ b/y2014/control_loops/python/claw.py
@@ -1,9 +1,9 @@
#!/usr/bin/python
-import control_loop
-import controls
-import polytope
-import polydrivetrain
+from frc971.control_loops.python import control_loop
+from frc971.control_loops.python import controls
+from frc971.control_loops.python import polytope
+from y2014.control_loops.python import polydrivetrain
import numpy
import sys
from matplotlib import pylab
@@ -478,8 +478,10 @@
if len(argv) != 3:
print "Expected .h file name and .cc file name for the claw."
else:
+ namespaces = ['y2014', 'control_loops', 'claw']
claw = Claw("Claw")
- loop_writer = control_loop.ControlLoopWriter("Claw", [claw])
+ loop_writer = control_loop.ControlLoopWriter("Claw", [claw],
+ namespaces=namespaces)
loop_writer.AddConstant(control_loop.Constant("kClawMomentOfInertiaRatio",
"%f", claw.J_top / claw.J_bottom))
if argv[1][-3:] == '.cc':
diff --git a/y2014/control_loops/python/drivetrain.py b/y2014/control_loops/python/drivetrain.py
index 14a3ecb..1372c25 100755
--- a/y2014/control_loops/python/drivetrain.py
+++ b/y2014/control_loops/python/drivetrain.py
@@ -28,7 +28,7 @@
# Torque constant
self.Kt = self.stall_torque / self.stall_current
# Control loop time step
- self.dt = 0.005
+ self.dt = 0.010
# State feedback matrices
self.A_continuous = numpy.matrix(
diff --git a/y2014/control_loops/python/polydrivetrain.py b/y2014/control_loops/python/polydrivetrain.py
index a2c63fa..b066c75 100755
--- a/y2014/control_loops/python/polydrivetrain.py
+++ b/y2014/control_loops/python/polydrivetrain.py
@@ -2,10 +2,10 @@
import numpy
import sys
-import polytope
-import drivetrain
-import control_loop
-import controls
+from frc971.control_loops.python import polytope
+from y2014.control_loops.python import drivetrain
+from frc971.control_loops.python import control_loop
+from frc971.control_loops.python import controls
from matplotlib import pylab
__author__ = 'Austin Schuh (austin.linux@gmail.com)'