Austin Schuh | bcce26a | 2018-03-26 23:41:24 -0700 | [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 | kDrivetrain = drivetrain.DrivetrainParams( |
| 12 | J=8.0, |
| 13 | mass=100.0, |
| 14 | robot_radius=0.616 / 2.0, |
| 15 | wheel_radius=0.127 / 2.0 * 120.0 / 118.0, |
| 16 | G_low=46.0 / 60.0 * 20.0 / 48.0 * 14.0 / 62.0, |
| 17 | G_high=62.0 / 44.0 * 20.0 / 48.0 * 14.0 / 62.0, |
| 18 | controller_poles=[0.82, 0.82], |
| 19 | ) |
| 20 | |
| 21 | |
| 22 | def main(argv): |
| 23 | argv = FLAGS(argv) |
| 24 | glog.init() |
| 25 | |
| 26 | if len(argv) != 5: |
| 27 | print "Expected .h file name and .cc file name" |
| 28 | else: |
| 29 | # Write the generated constants out to a file. |
| 30 | drivetrain.WriteDrivetrain( |
| 31 | argv[1:3], |
| 32 | argv[3:5], ['motors', 'seems_reasonable'], |
| 33 | kDrivetrain, |
| 34 | scalar_type='float') |
| 35 | |
| 36 | |
| 37 | if __name__ == '__main__': |
| 38 | sys.exit(main(sys.argv)) |