Austin Schuh | 085eab9 | 2020-11-26 13:54:51 -0800 | [diff] [blame] | 1 | #!/usr/bin/python3 |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 2 | |
Austin Schuh | ce7e03d | 2020-11-20 22:32:44 -0800 | [diff] [blame] | 3 | from __future__ import print_function |
Campbell Crowley | 33e0e3d | 2017-12-27 17:55:40 -0800 | [diff] [blame] | 4 | from frc971.control_loops.python import drivetrain |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 5 | import sys |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 6 | |
| 7 | import gflags |
| 8 | import glog |
| 9 | |
| 10 | FLAGS = gflags.FLAGS |
| 11 | |
| 12 | gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.') |
| 13 | |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 14 | kDrivetrain = drivetrain.DrivetrainParams(J=6.0, |
| 15 | mass=52, |
| 16 | robot_radius=0.59055 / 2.0, |
| 17 | wheel_radius=0.08255 / 2.0, |
| 18 | G=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, |
| 23 | has_imu=False) |
| 24 | |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 25 | |
| 26 | def main(argv): |
Austin Schuh | ecc92a0 | 2019-01-20 17:42:19 -0800 | [diff] [blame] | 27 | argv = FLAGS(argv) |
| 28 | glog.init() |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 29 | |
Austin Schuh | ecc92a0 | 2019-01-20 17:42:19 -0800 | [diff] [blame] | 30 | if FLAGS.plot: |
| 31 | drivetrain.PlotDrivetrainMotions(kDrivetrain) |
James Kuszmaul | eeb98e9 | 2024-01-14 22:15:32 -0800 | [diff] [blame] | 32 | elif len(argv) != 7: |
| 33 | print("Expected .h, .cc, and .json filenames") |
Austin Schuh | ecc92a0 | 2019-01-20 17:42:19 -0800 | [diff] [blame] | 34 | else: |
| 35 | # Write the generated constants out to a file. |
James Kuszmaul | eeb98e9 | 2024-01-14 22:15:32 -0800 | [diff] [blame] | 36 | drivetrain.WriteDrivetrain(argv[1:4], argv[4:7], 'y2017', kDrivetrain) |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 37 | |
Ravago Jones | 5127ccc | 2022-07-31 16:32:45 -0700 | [diff] [blame] | 38 | |
Diana Vandenberg | 223703d | 2017-01-28 17:39:53 -0800 | [diff] [blame] | 39 | if __name__ == '__main__': |
Austin Schuh | ecc92a0 | 2019-01-20 17:42:19 -0800 | [diff] [blame] | 40 | sys.exit(main(sys.argv)) |