blob: fad50203708a0d6db01ba31a20f0edc4fa5d6de0 [file] [log] [blame]
Niko Sohmersb21dbdc2024-01-20 20:06:59 -08001#!/usr/bin/python3
2
3from aos.util.trapezoid_profile import TrapezoidProfile
4from frc971.control_loops.python import control_loop
5from frc971.control_loops.python import angular_system
6from frc971.control_loops.python import controls
7import numpy
8import sys
9from matplotlib import pylab
10import gflags
11import glog
12
13FLAGS = gflags.FLAGS
14
15try:
16 gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
17except gflags.DuplicateFlagError:
18 pass
19
20kIntakePivot = angular_system.AngularSystemParams(
21 name='IntakePivot',
22 motor=control_loop.KrakenFOC(),
Maxwell Hendersonce232a92024-02-18 12:17:37 -080023 G=(16. / 60.) * (18. / 62.) * (18. / 62.) * (15. / 24.),
Maxwell Henderson6b1be312024-02-28 20:15:06 -080024 J=0.4,
25 q_pos=1.0,
26 q_vel=800.0,
Niko Sohmersb21dbdc2024-01-20 20:06:59 -080027 kalman_q_pos=0.12,
28 kalman_q_vel=2.0,
Maxwell Henderson6b1be312024-02-28 20:15:06 -080029 kalman_q_voltage=1.5,
Niko Sohmersb21dbdc2024-01-20 20:06:59 -080030 kalman_r_position=0.05,
Niko Sohmers77013322024-02-09 20:17:16 -080031 radius=6.85 * 0.0254)
Niko Sohmersb21dbdc2024-01-20 20:06:59 -080032
33
34def main(argv):
35 if FLAGS.plot:
36 R = numpy.matrix([[numpy.pi / 2.0], [0.0]])
37 angular_system.PlotKick(kIntakePivot, R)
38 angular_system.PlotMotion(kIntakePivot, R)
39 return
40 if len(argv) != 7:
41 glog.fatal(
42 'Expected .h file name and .cc file name for the intake pivot and integral intake pivot.'
43 )
44 else:
45 namespaces = [
46 'y2024', 'control_loops', 'superstructure', 'intake_pivot'
47 ]
48 angular_system.WriteAngularSystem(kIntakePivot, argv[1:4], argv[4:7],
49 namespaces)
50
51
52if __name__ == '__main__':
53 argv = FLAGS(sys.argv)
54 glog.init()
Maxwell Hendersonce232a92024-02-18 12:17:37 -080055 sys.exit(main(argv))