blob: 5e6031180ead5d95960eea1a20fb396b371a97d3 [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.),
24 J=0.25,
James Kuszmaul0281e152024-02-26 22:26:16 -080025 q_pos=0.80,
26 q_vel=30.0,
Niko Sohmersb21dbdc2024-01-20 20:06:59 -080027 kalman_q_pos=0.12,
28 kalman_q_vel=2.0,
Austin Schuh087613b2024-02-19 12:39:08 -080029 kalman_q_voltage=2.0,
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))