blob: 2e292a20631eb8f60238245d33ea20aef6c6fddf [file] [log] [blame]
Austin Schuh47a0ee12019-01-21 16:01:32 -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 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
suneel2bc345d2019-02-09 20:00:56 -080020# Wrist alone
21# 0.1348
22# Wrist with ball
23# 0.3007
24# Wrist with hatch
25# 0.446
26
Austin Schuh47a0ee12019-01-21 16:01:32 -080027kWrist = angular_system.AngularSystemParams(
28 name='Wrist',
29 motor=control_loop.BAG(),
30 G=(6.0 / 60.0) * (20.0 / 100.0) * (24.0 / 84.0),
suneel2bc345d2019-02-09 20:00:56 -080031 J=0.27,
Austin Schuh47a0ee12019-01-21 16:01:32 -080032 q_pos=0.20,
33 q_vel=5.0,
34 kalman_q_pos=0.12,
35 kalman_q_vel=2.0,
36 kalman_q_voltage=4.0,
37 kalman_r_position=0.05)
38
39
40def main(argv):
41 if FLAGS.plot:
42 R = numpy.matrix([[numpy.pi / 2.0], [0.0]])
43 angular_system.PlotMotion(kWrist, R)
44 angular_system.PlotKick(kWrist, R)
45
46 # Write the generated constants out to a file.
47 if len(argv) != 5:
48 glog.fatal(
49 'Expected .h file name and .cc file name for the wrist and integral wrist.'
50 )
51 else:
52 namespaces = ['y2019', 'control_loops', 'superstructure', 'wrist']
53 angular_system.WriteAngularSystem(kWrist, argv[1:3], argv[3:5],
54 namespaces)
55
56
57if __name__ == '__main__':
58 argv = FLAGS(sys.argv)
59 glog.init()
60 sys.exit(main(argv))