Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
Campbell Crowley | 33e0e3d | 2017-12-27 17:55:40 -0800 | [diff] [blame^] | 3 | from frc971.control_loops.python import drivetrain |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 4 | import sys |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 5 | |
| 6 | import gflags |
| 7 | import glog |
| 8 | |
| 9 | FLAGS = gflags.FLAGS |
| 10 | |
| 11 | gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.') |
| 12 | |
Campbell Crowley | 33e0e3d | 2017-12-27 17:55:40 -0800 | [diff] [blame^] | 13 | kDrivetrain = drivetrain.DrivetrainParams(J = 6.0, |
| 14 | mass = 52, |
| 15 | robot_radius = 0.59055 / 2.0, |
| 16 | wheel_radius = 0.08255 / 2.0, |
| 17 | G_high = 11.0 / 60.0, |
| 18 | G_low = 11.0 / 60.0, |
| 19 | q_pos_low = 0.12, |
| 20 | q_pos_high = 0.14, |
| 21 | q_vel_low = 1.0, |
| 22 | q_vel_high = 0.95) |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 23 | |
| 24 | def main(argv): |
| 25 | argv = FLAGS(argv) |
| 26 | glog.init() |
| 27 | |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 28 | if FLAGS.plot: |
Campbell Crowley | 33e0e3d | 2017-12-27 17:55:40 -0800 | [diff] [blame^] | 29 | drivetrain.PlotDrivetrainMotions(kDrivetrain) |
| 30 | elif len(argv) != 5: |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 31 | print "Expected .h file name and .cc file name" |
| 32 | else: |
Campbell Crowley | 33e0e3d | 2017-12-27 17:55:40 -0800 | [diff] [blame^] | 33 | # Write the generated constants out to a file. |
| 34 | drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2017', kDrivetrain) |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 35 | |
| 36 | if __name__ == '__main__': |
| 37 | sys.exit(main(sys.argv)) |