blob: 665739f73a7964d96b8ff3b3768189d0250ef54e [file] [log] [blame]
Austin Schuh085eab92020-11-26 13:54:51 -08001#!/usr/bin/python3
Austin Schuhbcce26a2018-03-26 23:41:24 -07002
3import sys
4from motors.seems_reasonable import drivetrain
5from frc971.control_loops.python import polydrivetrain
6
7import gflags
8import glog
9
10__author__ = 'Austin Schuh (austin.linux@gmail.com)'
11
12FLAGS = gflags.FLAGS
13
14try:
15 gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
16except gflags.DuplicateFlagError:
17 pass
18
Ravago Jones5127ccc2022-07-31 16:32:45 -070019
Austin Schuhbcce26a2018-03-26 23:41:24 -070020def main(argv):
21 if FLAGS.plot:
22 polydrivetrain.PlotPolyDrivetrainMotions(drivetrain.kDrivetrain)
Austin Schuh74425152018-12-21 11:37:14 +110023 elif len(argv) != 7:
Austin Schuhbcce26a2018-03-26 23:41:24 -070024 glog.fatal('Expected .h file name and .cc file name')
25 else:
Ravago Jones5127ccc2022-07-31 16:32:45 -070026 polydrivetrain.WritePolyDrivetrain(argv[1:3],
27 argv[3:5],
28 argv[5:7],
29 ['motors', 'seems_reasonable'],
30 drivetrain.kDrivetrain,
31 scalar_type='float')
Austin Schuhbcce26a2018-03-26 23:41:24 -070032
33
34if __name__ == '__main__':
35 argv = FLAGS(sys.argv)
36 glog.init()
37 sys.exit(main(argv))