blob: 48f2c9e31c8fd0861b07216dffc29e1d779142f4 [file] [log] [blame]
Comran Morshede9b12922015-11-04 19:46:48 +00001#!/usr/bin/python
2
Austin Schuhce7e03d2020-11-20 22:32:44 -08003from __future__ import print_function
Campbell Crowley8e8964a2017-12-29 15:56:29 -08004from frc971.control_loops.python import drivetrain
Comran Morshede9b12922015-11-04 19:46:48 +00005import sys
Comran Morshede9b12922015-11-04 19:46:48 +00006
Adam Snaider83eae562016-09-10 16:47:33 -07007import gflags
Campbell Crowley9c3ecfd2015-12-31 17:04:30 -08008import glog
Comran Morshede9b12922015-11-04 19:46:48 +00009
Adam Snaider83eae562016-09-10 16:47:33 -070010FLAGS = gflags.FLAGS
11
12gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
13
Campbell Crowley8e8964a2017-12-29 15:56:29 -080014kDrivetrain = drivetrain.DrivetrainParams(J = 1.8,
15 mass = 37,
16 robot_radius = 0.45 / 2.0,
17 wheel_radius = 0.04445,
18 G_high = 28.0 / 48.0 * 19.0 / 50.0,
19 G_low = 28.0 / 60.0 * 19.0 / 50.0,
20 q_pos_low = 0.12,
21 q_pos_high = 0.14,
22 q_vel_low = 1.0,
23 q_vel_high = 0.95,
Diana Burgessd0180f12018-03-21 21:24:17 -070024 has_imu = False,
Campbell Crowley8e8964a2017-12-29 15:56:29 -080025 dt = 0.005,
Austin Schuhba32a9e2018-11-03 15:28:13 -070026 controller_poles = [0.83, 0.83])
Adam Snaider83eae562016-09-10 16:47:33 -070027
Comran Morshede9b12922015-11-04 19:46:48 +000028def main(argv):
Adam Snaider83eae562016-09-10 16:47:33 -070029 argv = FLAGS(argv)
30 glog.init()
31
Adam Snaider83eae562016-09-10 16:47:33 -070032 if FLAGS.plot:
Campbell Crowley8e8964a2017-12-29 15:56:29 -080033 drivetrain.PlotDrivetrainMotions(kDrivetrain)
34 elif len(argv) != 5:
Austin Schuhce7e03d2020-11-20 22:32:44 -080035 print("Expected .h file name and .cc file name")
Comran Morshede9b12922015-11-04 19:46:48 +000036 else:
Campbell Crowley8e8964a2017-12-29 15:56:29 -080037 # Write the generated constants out to a file.
38 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2014_bot3', kDrivetrain)
Adam Snaider83eae562016-09-10 16:47:33 -070039
Comran Morshede9b12922015-11-04 19:46:48 +000040if __name__ == '__main__':
41 sys.exit(main(sys.argv))