blob: 48510bef030eec69ba6b65e478b67d1dc3318164 [file] [log] [blame]
Comran Morshede9b12922015-11-04 19:46:48 +00001#!/usr/bin/python
2
Campbell Crowley8e8964a2017-12-29 15:56:29 -08003from frc971.control_loops.python import drivetrain
Comran Morshede9b12922015-11-04 19:46:48 +00004import sys
Comran Morshede9b12922015-11-04 19:46:48 +00005
Adam Snaider83eae562016-09-10 16:47:33 -07006import gflags
Campbell Crowley9c3ecfd2015-12-31 17:04:30 -08007import glog
Comran Morshede9b12922015-11-04 19:46:48 +00008
Adam Snaider83eae562016-09-10 16:47:33 -07009FLAGS = gflags.FLAGS
10
11gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
12
Campbell Crowley8e8964a2017-12-29 15:56:29 -080013kDrivetrain = drivetrain.DrivetrainParams(J = 1.8,
14 mass = 37,
15 robot_radius = 0.45 / 2.0,
16 wheel_radius = 0.04445,
17 G_high = 28.0 / 48.0 * 19.0 / 50.0,
18 G_low = 28.0 / 60.0 * 19.0 / 50.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,
Diana Burgessd0180f12018-03-21 21:24:17 -070023 has_imu = False,
Campbell Crowley8e8964a2017-12-29 15:56:29 -080024 dt = 0.005,
Austin Schuhba32a9e2018-11-03 15:28:13 -070025 controller_poles = [0.83, 0.83])
Adam Snaider83eae562016-09-10 16:47:33 -070026
Comran Morshede9b12922015-11-04 19:46:48 +000027def main(argv):
Adam Snaider83eae562016-09-10 16:47:33 -070028 argv = FLAGS(argv)
29 glog.init()
30
Adam Snaider83eae562016-09-10 16:47:33 -070031 if FLAGS.plot:
Campbell Crowley8e8964a2017-12-29 15:56:29 -080032 drivetrain.PlotDrivetrainMotions(kDrivetrain)
33 elif len(argv) != 5:
Adam Snaider83eae562016-09-10 16:47:33 -070034 print "Expected .h file name and .cc file name"
Comran Morshede9b12922015-11-04 19:46:48 +000035 else:
Campbell Crowley8e8964a2017-12-29 15:56:29 -080036 # Write the generated constants out to a file.
37 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2014_bot3', kDrivetrain)
Adam Snaider83eae562016-09-10 16:47:33 -070038
Comran Morshede9b12922015-11-04 19:46:48 +000039if __name__ == '__main__':
40 sys.exit(main(sys.argv))