blob: 58ea7d8959a2922860ce13675c4d88a77d319153 [file] [log] [blame]
Kai Tinkess8a7b8a62020-02-01 14:38:33 -08001#!/usr/bin/python
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 copy
8import numpy
9import sys
10from matplotlib import pylab
11import gflags
12import glog
13
14FLAGS = gflags.FLAGS
15
16try:
17 gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
18except gflags.DuplicateFlagError:
19 pass
20
21kTurret = angular_system.AngularSystemParams(
22 name='Turret',
23 motor=control_loop.Vex775Pro(),
24 #TODO: Update Gear Ratios when they are ready
25 G=(6.0 / 60.0) * (20.0 / 100.0) * (24.0 / 84.0),
26 #TODO: Get number from Bryan (moment of inertia)
27 J=0.30,
28 q_pos=0.20,
29 q_vel=5.0,
30 kalman_q_pos=0.12,
31 kalman_q_vel=2.0,
32 kalman_q_voltage=4.0,
33 kalman_r_position=0.05)
34
35def main(argv):
36 # Write the generated constants out to a file.
37 if len(argv) != 5:
38 glog.fatal(
39 'Expected .h file name and .cc file name for the turret.'
40 )
41 else:
42 namespaces = ['y2020', 'control_loops', 'superstructure', 'turret']
43 angular_system.WriteAngularSystem([kTurret],
44 argv[1:3], argv[3:5], namespaces)
45
46
47if __name__ == '__main__':
48 argv = FLAGS(sys.argv)
49 glog.init()
50 sys.exit(main(argv))