blob: dd2244d59535c0bad2e8995c4c108abd0d1db0c0 [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(),
Austin Schuhc1c957a2020-02-20 17:47:58 -080024 G=(6.0 / 60.0) * (26.0 / 150.0),
25 J=0.11,
Kai Tinkess8a7b8a62020-02-01 14:38:33 -080026 q_pos=0.20,
27 q_vel=5.0,
28 kalman_q_pos=0.12,
29 kalman_q_vel=2.0,
30 kalman_q_voltage=4.0,
31 kalman_r_position=0.05)
32
33def main(argv):
34 # Write the generated constants out to a file.
35 if len(argv) != 5:
36 glog.fatal(
37 'Expected .h file name and .cc file name for the turret.'
38 )
39 else:
40 namespaces = ['y2020', 'control_loops', 'superstructure', 'turret']
41 angular_system.WriteAngularSystem([kTurret],
42 argv[1:3], argv[3:5], namespaces)
43
44
45if __name__ == '__main__':
46 argv = FLAGS(sys.argv)
47 glog.init()
48 sys.exit(main(argv))