Stephan Massalt | d021f97 | 2020-01-05 20:41:23 -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 | kDrivetrain = drivetrain.DrivetrainParams( |
| 14 | J=1.5, |
| 15 | mass=38.5, |
| 16 | robot_radius=0.45 / 2.0, |
| 17 | wheel_radius=4.0 * 0.0254 / 2.0, |
| 18 | G=9.0 / 52.0, |
| 19 | q_pos=0.14, |
| 20 | q_vel=1.30, |
| 21 | efficiency=0.80, |
| 22 | has_imu=True, |
| 23 | force=True, |
| 24 | kf_q_voltage=13.0, |
| 25 | controller_poles=[0.82, 0.82], |
| 26 | robot_cg_offset=0.0) |
| 27 | |
| 28 | |
| 29 | def main(argv): |
| 30 | argv = FLAGS(argv) |
| 31 | glog.init() |
| 32 | |
| 33 | if FLAGS.plot: |
| 34 | drivetrain.PlotDrivetrainMotions(kDrivetrain) |
| 35 | elif len(argv) != 5: |
| 36 | print "Expected .h file name and .cc file name" |
| 37 | else: |
| 38 | # Write the generated constants out to a file. |
| 39 | drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2020', kDrivetrain) |
| 40 | |
| 41 | if __name__ == '__main__': |
| 42 | sys.exit(main(sys.argv)) |