Switch to python3 and scipy from slycot
Turns out we need python3 matplotlib to make scipy work well enough to
place the poles correctly for our systems. Rather than do it piecemeal,
do it all at once.
This includes a python opencv upgrade too to support the new python, and
a matplotlib upgrade.
Change-Id: Ic7517b5ebbfdca9cc90ae6a61d86b474f2f21b29
diff --git a/y2014/control_loops/python/BUILD b/y2014/control_loops/python/BUILD
index 60488b4..20035bc 100644
--- a/y2014/control_loops/python/BUILD
+++ b/y2014/control_loops/python/BUILD
@@ -60,7 +60,7 @@
"//external:python-gflags",
"//external:python-glog",
"//frc971/control_loops/python:controls",
- "@matplotlib_repo//:matplotlib2.7",
+ "@matplotlib_repo//:matplotlib3",
],
)
@@ -76,7 +76,7 @@
"//external:python-gflags",
"//external:python-glog",
"//frc971/control_loops/python:controls",
- "@matplotlib_repo//:matplotlib2.7",
+ "@matplotlib_repo//:matplotlib3",
],
)
@@ -92,7 +92,7 @@
"//external:python-gflags",
"//external:python-glog",
"//frc971/control_loops/python:controls",
- "@matplotlib_repo//:matplotlib2.7",
+ "@matplotlib_repo//:matplotlib3",
],
)
diff --git a/y2014/control_loops/python/claw.py b/y2014/control_loops/python/claw.py
index 346a188..77ccf14 100755
--- a/y2014/control_loops/python/claw.py
+++ b/y2014/control_loops/python/claw.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
from frc971.control_loops.python import control_loop
from frc971.control_loops.python import controls
@@ -136,7 +136,9 @@
glog.debug('det %s', str(numpy.linalg.det(lstsq_A)))
out_x = numpy.linalg.lstsq(
- lstsq_A, numpy.matrix([[self.A[1, 2]], [self.A[3, 2]]]))[0]
+ lstsq_A,
+ numpy.matrix([[self.A[1, 2]], [self.A[3, 2]]]),
+ rcond=None)[0]
self.K[1, 2] = -lstsq_A[0, 0] * (
self.K[0, 2] - out_x[0]) / lstsq_A[0, 1] + out_x[1]
@@ -369,7 +371,7 @@
iterations=200):
"""Runs the claw plant on a given claw (claw) with an initial condition (initial_X) and goal (goal).
- The tests themselves are not terribly sophisticated; I just test for
+ The tests themselves are not terribly sophisticated; I just test for
whether the goal has been reached and whether the separation goes
outside of the initial and goal values by more than max_separation_error.
Prints out something for a failure of either condition and returns
diff --git a/y2014/control_loops/python/drivetrain.py b/y2014/control_loops/python/drivetrain.py
index 01877d1..cac236f 100755
--- a/y2014/control_loops/python/drivetrain.py
+++ b/y2014/control_loops/python/drivetrain.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
from __future__ import print_function
from frc971.control_loops.python import drivetrain
diff --git a/y2014/control_loops/python/extended_lqr.py b/y2014/control_loops/python/extended_lqr.py
index 095a43a..b3f2372 100755
--- a/y2014/control_loops/python/extended_lqr.py
+++ b/y2014/control_loops/python/extended_lqr.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# This is an initial, hacky implementation of the extended LQR paper. It's just a proof of concept,
# so don't trust it too much.
diff --git a/y2014/control_loops/python/extended_lqr_derivation.py b/y2014/control_loops/python/extended_lqr_derivation.py
index 248c6fc..010c5de 100755
--- a/y2014/control_loops/python/extended_lqr_derivation.py
+++ b/y2014/control_loops/python/extended_lqr_derivation.py
@@ -1,10 +1,7 @@
-#!/usr/bin/python2
+#!/usr/bin/python3
# This file checks our math in extended_lqr.tex.
-from __future__ import print_function
-from __future__ import division
-
import sys
import random
diff --git a/y2014/control_loops/python/polydrivetrain.py b/y2014/control_loops/python/polydrivetrain.py
index 98910a1..cdaee1b 100755
--- a/y2014/control_loops/python/polydrivetrain.py
+++ b/y2014/control_loops/python/polydrivetrain.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import sys
from y2014.control_loops.python import drivetrain
diff --git a/y2014/control_loops/python/polydrivetrain_test.py b/y2014/control_loops/python/polydrivetrain_test.py
index 434cdca..8e0176e 100755
--- a/y2014/control_loops/python/polydrivetrain_test.py
+++ b/y2014/control_loops/python/polydrivetrain_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import polydrivetrain
import numpy
diff --git a/y2014/control_loops/python/shooter.py b/y2014/control_loops/python/shooter.py
index e25c72b..710233b 100755
--- a/y2014/control_loops/python/shooter.py
+++ b/y2014/control_loops/python/shooter.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
import gflags
import glog
@@ -65,11 +65,9 @@
self.A, self.B = self.ContinuousToDiscrete(self.A_continuous,
self.B_continuous, self.dt)
- self.PlaceControllerPoles([0.45, 0.45])
+ self.PlaceControllerPoles([0.4501, 0.4499])
- self.rpl = .05
- self.ipl = 0.008
- self.PlaceObserverPoles([self.rpl, self.rpl])
+ self.PlaceObserverPoles([0.05001, 0.04999])
self.U_max = numpy.matrix([[12.0]])
self.U_min = numpy.matrix([[-12.0]])
@@ -92,11 +90,9 @@
self.A, self.B = self.ContinuousToDiscrete(self.A_continuous,
self.B_continuous, self.dt)
- self.PlaceControllerPoles([0.45, 0.45])
+ self.PlaceControllerPoles([0.45001, 0.44999])
- self.rpl = .05
- self.ipl = 0.008
- self.PlaceObserverPoles([self.rpl, self.rpl])
+ self.PlaceObserverPoles([0.05001, 0.04999])
self.U_max = numpy.matrix([[12.0]])
self.U_min = numpy.matrix([[-12.0]])