blob: 0b0fbb48b874c82178f45ccb06383d589c6e038c [file] [log] [blame]
Sabina Davisedf89472020-02-17 15:27:37 -08001#!/usr/bin/python
2
3from frc971.control_loops.python import control_loop
4from y2020.control_loops.python import flywheel
5import numpy
6
7import sys
8
9import gflags
10import glog
11
12FLAGS = gflags.FLAGS
13
14gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
15
16kFinisher = flywheel.FlywheelParams(
17 name='Finisher',
18 motor=control_loop.Falcon(),
19 G=1.0,
20 J=0.006,
21 q_pos=0.08,
22 q_vel=4.00,
23 q_voltage=0.3,
24 r_pos=0.05,
25 controller_poles=[.87],
26 dt=0.00505)
27
28
29def main(argv):
30 if FLAGS.plot:
31 R = numpy.matrix([[0.0], [100.0], [0.0]])
32 flywheel.PlotSpinup(params=kFinisher, goal=R, iterations=200)
33 return 0
34
35 if len(argv) != 5:
36 glog.fatal('Expected .h file name and .cc file name')
37 else:
38 namespaces = ['y2020', 'control_loops', 'superstructure', 'finisher']
39 flywheel.WriteFlywheel(kFinisher, argv[1:3], argv[3:5], namespaces)
40
41
42if __name__ == '__main__':
43 argv = FLAGS(sys.argv)
44 sys.exit(main(argv))