Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | import sys |
| 4 | from motors.seems_reasonable import drivetrain |
| 5 | from frc971.control_loops.python import polydrivetrain |
| 6 | |
| 7 | import gflags |
| 8 | import glog |
| 9 | |
| 10 | __author__ = 'Austin Schuh (austin.linux@gmail.com)' |
| 11 | |
| 12 | FLAGS = gflags.FLAGS |
| 13 | |
| 14 | try: |
| 15 | gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.') |
| 16 | except gflags.DuplicateFlagError: |
| 17 | pass |
| 18 | |
| 19 | def main(argv): |
| 20 | if FLAGS.plot: |
| 21 | polydrivetrain.PlotPolyDrivetrainMotions(drivetrain.kDrivetrain) |
Austin Schuh | 7442515 | 2018-12-21 11:37:14 +1100 | [diff] [blame^] | 22 | elif len(argv) != 7: |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 23 | glog.fatal('Expected .h file name and .cc file name') |
| 24 | else: |
| 25 | polydrivetrain.WritePolyDrivetrain( |
| 26 | argv[1:3], |
Austin Schuh | 7442515 | 2018-12-21 11:37:14 +1100 | [diff] [blame^] | 27 | argv[3:5], |
| 28 | argv[5:7], |
| 29 | ['motors', 'seems_reasonable'], |
Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [diff] [blame] | 30 | drivetrain.kDrivetrain, |
| 31 | scalar_type='float') |
| 32 | |
| 33 | |
| 34 | if __name__ == '__main__': |
| 35 | argv = FLAGS(sys.argv) |
| 36 | glog.init() |
| 37 | sys.exit(main(argv)) |