Run yapf on all python files in the repo
Signed-off-by: Ravago Jones <ravagojones@gmail.com>
Change-Id: I221e04c3f517fab8535b22551553799e0fee7a80
diff --git a/frc971/control_loops/python/linear_system.py b/frc971/control_loops/python/linear_system.py
index 0391d93..3bda4e1 100755
--- a/frc971/control_loops/python/linear_system.py
+++ b/frc971/control_loops/python/linear_system.py
@@ -9,6 +9,7 @@
class LinearSystemParams(object):
+
def __init__(self,
name,
motor,
@@ -37,6 +38,7 @@
class LinearSystem(control_loop.ControlLoop):
+
def __init__(self, params, name='LinearSystem'):
super(LinearSystem, self).__init__(name)
self.params = params
@@ -56,11 +58,11 @@
# State is [position, velocity]
# Input is [Voltage]
- C1 = self.motor.Kt / (
- self.G * self.G * self.radius * self.radius * self.motor.resistance
- * self.mass * self.motor.Kv)
- C2 = self.motor.Kt / (
- self.G * self.radius * self.motor.resistance * self.mass)
+ C1 = self.motor.Kt / (self.G * self.G * self.radius * self.radius *
+ self.motor.resistance * self.mass *
+ self.motor.Kv)
+ C2 = self.motor.Kt / (self.G * self.radius * self.motor.resistance *
+ self.mass)
self.A_continuous = numpy.matrix([[0, 1], [0, -C1]])
@@ -109,8 +111,11 @@
self.R = numpy.matrix([[(self.params.kalman_r_position**2.0)]])
- self.KalmanGain, self.Q_steady = controls.kalman(
- A=self.A, B=self.B, C=self.C, Q=self.Q, R=self.R)
+ self.KalmanGain, self.Q_steady = controls.kalman(A=self.A,
+ B=self.B,
+ C=self.C,
+ Q=self.Q,
+ R=self.R)
glog.debug('Kal %s', repr(self.KalmanGain))
@@ -123,6 +128,7 @@
class IntegralLinearSystem(LinearSystem):
+
def __init__(self, params, name='IntegralLinearSystem'):
super(IntegralLinearSystem, self).__init__(params, name=name)
@@ -145,13 +151,16 @@
self.Q = numpy.matrix([[(self.params.kalman_q_pos**2.0), 0.0, 0.0],
[0.0, (self.params.kalman_q_vel**2.0), 0.0],
- [0.0, 0.0, (self.params.kalman_q_voltage
- **2.0)]])
+ [0.0, 0.0,
+ (self.params.kalman_q_voltage**2.0)]])
self.R = numpy.matrix([[(self.params.kalman_r_position**2.0)]])
- self.KalmanGain, self.Q_steady = controls.kalman(
- A=self.A, B=self.B, C=self.C, Q=self.Q, R=self.R)
+ self.KalmanGain, self.Q_steady = controls.kalman(A=self.A,
+ B=self.B,
+ C=self.C,
+ Q=self.Q,
+ R=self.R)
self.K_unaugmented = self.K
self.K = numpy.matrix(numpy.zeros((1, 3)))
@@ -222,10 +231,10 @@
offset_plot.append(observer.X_hat[2, 0])
x_hat_plot.append(observer.X_hat[0, 0])
- next_goal = numpy.concatenate(
- (profile.Update(end_goal[0, 0], end_goal[1, 0]),
- numpy.matrix(numpy.zeros((1, 1)))),
- axis=0)
+ next_goal = numpy.concatenate((profile.Update(
+ end_goal[0, 0], end_goal[1, 0]), numpy.matrix(numpy.zeros(
+ (1, 1)))),
+ axis=0)
ff_U = controller.Kff * (next_goal - observer.A * goal)
@@ -264,8 +273,8 @@
goal = controller.A * goal + controller.B * ff_U
if U[0, 0] != U_uncapped[0, 0]:
- profile.MoveCurrentState(
- numpy.matrix([[goal[0, 0]], [goal[1, 0]]]))
+ profile.MoveCurrentState(numpy.matrix([[goal[0, 0]], [goal[1,
+ 0]]]))
glog.debug('Time: %f', t_plot[-1])
glog.debug('goal_error %s', repr(end_goal - goal))
@@ -305,15 +314,14 @@
initial_X = numpy.matrix([[0.0], [0.0]])
augmented_R = numpy.matrix(numpy.zeros((3, 1)))
augmented_R[0:2, :] = R
- RunTest(
- plant,
- end_goal=augmented_R,
- controller=controller,
- observer=observer,
- duration=2.0,
- use_profile=False,
- kick_time=1.0,
- kick_magnitude=0.0)
+ RunTest(plant,
+ end_goal=augmented_R,
+ controller=controller,
+ observer=observer,
+ duration=2.0,
+ use_profile=False,
+ kick_time=1.0,
+ kick_magnitude=0.0)
def PlotKick(params, R, plant_params=None):
@@ -332,15 +340,14 @@
initial_X = numpy.matrix([[0.0], [0.0]])
augmented_R = numpy.matrix(numpy.zeros((3, 1)))
augmented_R[0:2, :] = R
- RunTest(
- plant,
- end_goal=augmented_R,
- controller=controller,
- observer=observer,
- duration=2.0,
- use_profile=False,
- kick_time=1.0,
- kick_magnitude=2.0)
+ RunTest(plant,
+ end_goal=augmented_R,
+ controller=controller,
+ observer=observer,
+ duration=2.0,
+ use_profile=False,
+ kick_time=1.0,
+ kick_magnitude=2.0)
def PlotMotion(params,
@@ -366,15 +373,14 @@
initial_X = numpy.matrix([[0.0], [0.0]])
augmented_R = numpy.matrix(numpy.zeros((3, 1)))
augmented_R[0:2, :] = R
- RunTest(
- plant,
- end_goal=augmented_R,
- controller=controller,
- observer=observer,
- duration=2.0,
- use_profile=True,
- max_velocity=max_velocity,
- max_acceleration=max_acceleration)
+ RunTest(plant,
+ end_goal=augmented_R,
+ controller=controller,
+ observer=observer,
+ duration=2.0,
+ use_profile=True,
+ max_velocity=max_velocity,
+ max_acceleration=max_acceleration)
def WriteLinearSystem(params, plant_files, controller_files, year_namespaces):
@@ -405,8 +411,9 @@
integral_linear_systems.append(
IntegralLinearSystem(params, 'Integral' + params.name))
- loop_writer = control_loop.ControlLoopWriter(
- name, linear_systems, namespaces=year_namespaces)
+ loop_writer = control_loop.ControlLoopWriter(name,
+ linear_systems,
+ namespaces=year_namespaces)
loop_writer.AddConstant(
control_loop.Constant('kFreeSpeed', '%f',
linear_systems[0].motor.free_speed))