blob: e8b2c7344842b48de2763b1927d94971b13b474b [file] [log] [blame]
Comran Morshed9a9948c2016-01-16 15:58:04 +00001#!/usr/bin/python
2
Campbell Crowleyd86a2162017-12-28 16:04:43 -08003from frc971.control_loops.python import drivetrain
Comran Morshed9a9948c2016-01-16 15:58:04 +00004import sys
Comran Morshed9a9948c2016-01-16 15:58:04 +00005
6import gflags
7import glog
8
9FLAGS = gflags.FLAGS
10
11gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
12
Campbell Crowleyd86a2162017-12-28 16:04:43 -080013kDrivetrain = drivetrain.DrivetrainParams(J = 2.0,
14 mass = 68,
15 robot_radius = 0.601 / 2.0,
16 wheel_radius = 0.097155 * 0.9811158901447808 / 118.0 * 115.75,
17 G_high = 14.0 / 48.0 * 28.0 / 50.0 * 18.0 / 36.0,
18 G_low = 14.0 / 48.0 * 18.0 / 60.0 * 18.0 / 36.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 dt = 0.005,
24 controller_poles = [0.67, 0.67])
Comran Morshed9a9948c2016-01-16 15:58:04 +000025
26def main(argv):
27 argv = FLAGS(argv)
Austin Schuh289ee4f2016-02-05 00:20:52 -080028 glog.init()
Comran Morshed9a9948c2016-01-16 15:58:04 +000029
Comran Morshed9a9948c2016-01-16 15:58:04 +000030 if FLAGS.plot:
Campbell Crowleyd86a2162017-12-28 16:04:43 -080031 drivetrain.PlotDrivetrainMotions(kDrivetrain)
32 elif len(argv) != 5:
Comran Morshed9a9948c2016-01-16 15:58:04 +000033 print "Expected .h file name and .cc file name"
34 else:
Campbell Crowleyd86a2162017-12-28 16:04:43 -080035 # Write the generated constants out to a file.
36 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2016', kDrivetrain)
Comran Morshed9a9948c2016-01-16 15:58:04 +000037
38if __name__ == '__main__':
39 sys.exit(main(sys.argv))