blob: 830dcd8f898ceab610d5705515d9fcf83676a677 [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,
23 dt = 0.005,
24 controller_poles = [0.67, 0.67])
Adam Snaider83eae562016-09-10 16:47:33 -070025
Comran Morshede9b12922015-11-04 19:46:48 +000026def main(argv):
Adam Snaider83eae562016-09-10 16:47:33 -070027 argv = FLAGS(argv)
28 glog.init()
29
Adam Snaider83eae562016-09-10 16:47:33 -070030 if FLAGS.plot:
Campbell Crowley8e8964a2017-12-29 15:56:29 -080031 drivetrain.PlotDrivetrainMotions(kDrivetrain)
32 elif len(argv) != 5:
Adam Snaider83eae562016-09-10 16:47:33 -070033 print "Expected .h file name and .cc file name"
Comran Morshede9b12922015-11-04 19:46:48 +000034 else:
Campbell Crowley8e8964a2017-12-29 15:56:29 -080035 # Write the generated constants out to a file.
36 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2014_bot3', kDrivetrain)
Adam Snaider83eae562016-09-10 16:47:33 -070037
Comran Morshede9b12922015-11-04 19:46:48 +000038if __name__ == '__main__':
39 sys.exit(main(sys.argv))