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, |
Diana Burgess | d0180f1 | 2018-03-21 21:24:17 -0700 | [diff] [blame] | 22 | q_vel_high = 0.95, |
| 23 | has_imu = False) |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 24 | |
| 25 | def main(argv): |
| 26 | argv = FLAGS(argv) |
| 27 | glog.init() |
| 28 | |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 29 | if FLAGS.plot: |
Campbell Crowley | 33e0e3d | 2017-12-27 17:55:40 -0800 | [diff] [blame] | 30 | drivetrain.PlotDrivetrainMotions(kDrivetrain) |
| 31 | elif len(argv) != 5: |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 32 | print "Expected .h file name and .cc file name" |
| 33 | else: |
Campbell Crowley | 33e0e3d | 2017-12-27 17:55:40 -0800 | [diff] [blame] | 34 | # Write the generated constants out to a file. |
| 35 | drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2017', kDrivetrain) |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 36 | |
| 37 | if __name__ == '__main__': |
| 38 | sys.exit(main(sys.argv)) |