Add current control loop python
Signed-off-by: Ravago Jones <ravagojones@gmail.com>
Change-Id: I59639923a5e26e2ca24fbb84878d7eeab1b5067a
diff --git a/y2023/control_loops/python/BUILD b/y2023/control_loops/python/BUILD
index 561bb77..a527adc 100644
--- a/y2023/control_loops/python/BUILD
+++ b/y2023/control_loops/python/BUILD
@@ -134,7 +134,7 @@
target_compatible_with = ["@platforms//cpu:x86_64"],
deps = [
":python_init",
- "//frc971/control_loops/python:angular_system",
+ "//frc971/control_loops/python:angular_system_current",
"//frc971/control_loops/python:controls",
"@pip//glog",
"@pip//python_gflags",
diff --git a/y2023/control_loops/python/turret.py b/y2023/control_loops/python/turret.py
index 4e8f117..54c6d7f 100644
--- a/y2023/control_loops/python/turret.py
+++ b/y2023/control_loops/python/turret.py
@@ -2,7 +2,7 @@
from aos.util.trapezoid_profile import TrapezoidProfile
from frc971.control_loops.python import control_loop
-from frc971.control_loops.python import angular_system
+from frc971.control_loops.python import angular_system_current
from frc971.control_loops.python import controls
import numpy
import sys
@@ -17,24 +17,25 @@
except gflags.DuplicateFlagError:
pass
-kTurret = angular_system.AngularSystemParams(name='Turret',
- motor=control_loop.Falcon(),
- G=0.01,
- J=3.1,
- q_pos=0.40,
- q_vel=20.0,
- kalman_q_pos=0.12,
- kalman_q_vel=2.0,
- kalman_q_voltage=4.0,
- kalman_r_position=0.05,
- radius=25 * 0.0254)
+kTurret = angular_system_current.AngularSystemCurrentParams(
+ name='Turret',
+ motor=control_loop.Falcon(),
+ G=0.01,
+ J=3.1,
+ q_pos=0.05,
+ q_vel=20.0,
+ kalman_q_pos=0.12,
+ kalman_q_vel=2.0,
+ kalman_q_voltage=4.0,
+ kalman_r_position=0.05,
+ radius=25 * 0.0254)
def main(argv):
if FLAGS.plot:
R = numpy.matrix([[numpy.pi / 2.0], [0.0]])
- angular_system.PlotKick(kTurret, R)
- angular_system.PlotMotion(kTurret, R)
+ angular_system_current.PlotKick(kTurret, R)
+ angular_system_current.PlotMotion(kTurret, R)
return
# Write the generated constants out to a file.
@@ -44,8 +45,8 @@
)
else:
namespaces = ['y2023', 'control_loops', 'superstructure', 'turret']
- angular_system.WriteAngularSystem(kTurret, argv[1:3], argv[3:5],
- namespaces)
+ angular_system_current.WriteAngularSystemCurrent(
+ kTurret, argv[1:3], argv[3:5], namespaces)
if __name__ == '__main__':