Sabina Davis | f4c5e76 | 2018-01-24 10:18:43 -0800 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | from frc971.control_loops.python import drivetrain |
| 4 | import sys |
| 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 | |
| 13 | #update mass (120lbs right now) |
| 14 | #robot radius needs confirming(set as distance of center wheels from each other) |
| 15 | #J needs updating |
| 16 | |
Austin Schuh | e8a54c0 | 2018-03-05 00:25:58 -0800 | [diff] [blame] | 17 | kDrivetrain = drivetrain.DrivetrainParams( |
| 18 | J=2.5, |
| 19 | mass=68.0, |
| 20 | robot_radius=0.616 / 2.0, |
| 21 | wheel_radius=0.127 / 2.0, |
| 22 | G_low=46.0 / 60.0 * 20.0 / 48.0 * 14.0 / 62.0, |
| 23 | G_high=62.0 / 44.0 * 20.0 / 48.0 * 14.0 / 62.0, |
| 24 | q_pos_low=0.12, |
| 25 | q_pos_high=0.14, |
| 26 | q_vel_low=1.0, |
| 27 | q_vel_high=0.95, |
| 28 | controller_poles=[0.82, 0.82], |
| 29 | ) |
| 30 | |
Sabina Davis | f4c5e76 | 2018-01-24 10:18:43 -0800 | [diff] [blame] | 31 | |
| 32 | def main(argv): |
Austin Schuh | e8a54c0 | 2018-03-05 00:25:58 -0800 | [diff] [blame] | 33 | argv = FLAGS(argv) |
| 34 | glog.init() |
Sabina Davis | f4c5e76 | 2018-01-24 10:18:43 -0800 | [diff] [blame] | 35 | |
Austin Schuh | e8a54c0 | 2018-03-05 00:25:58 -0800 | [diff] [blame] | 36 | if FLAGS.plot: |
| 37 | drivetrain.PlotDrivetrainMotions(kDrivetrain) |
| 38 | elif len(argv) != 5: |
| 39 | print "Expected .h file name and .cc file name" |
| 40 | else: |
| 41 | # Write the generated constants out to a file. |
| 42 | drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2018', kDrivetrain) |
Sabina Davis | f4c5e76 | 2018-01-24 10:18:43 -0800 | [diff] [blame] | 43 | |
| 44 | if __name__ == '__main__': |
Austin Schuh | e8a54c0 | 2018-03-05 00:25:58 -0800 | [diff] [blame] | 45 | sys.exit(main(sys.argv)) |