blob: e8fdb5691ef9947f2374d2b8ba0498a9d595f8f5 [file] [log] [blame]
Brian Silverman17f503e2015-08-02 18:17:18 -07001#!/usr/bin/python
2
Campbell Crowley73a86772017-12-29 15:17:33 -08003from frc971.control_loops.python import drivetrain
Brian Silverman17f503e2015-08-02 18:17:18 -07004import sys
Brian Silverman17f503e2015-08-02 18:17:18 -07005
Austin Schuhe456f152015-11-27 13:44:39 -08006import gflags
7import glog
8
9FLAGS = gflags.FLAGS
10
11gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
Brian Silverman17f503e2015-08-02 18:17:18 -070012
Campbell Crowley73a86772017-12-29 15:17:33 -080013kDrivetrain = drivetrain.DrivetrainParams(J = 2.8,
14 mass = 68,
15 robot_radius = 0.647998644 / 2.0,
16 wheel_radius = .04445,
17 G_high = 28.0 / 50.0 * 18.0 / 50.0,
18 G_low = 18.0 / 60.0 * 18.0 / 50.0,
19 q_pos_low = 0.12,
20 q_pos_high = 0.12,
21 q_vel_low = 1.0,
22 q_vel_high = 1.0,
Diana Burgessd0180f12018-03-21 21:24:17 -070023 has_imu = False,
Campbell Crowley73a86772017-12-29 15:17:33 -080024 dt = 0.005,
25 controller_poles = [0.7, 0.7])
Austin Schuh572ff402015-11-08 12:17:50 -080026
Brian Silverman17f503e2015-08-02 18:17:18 -070027def main(argv):
Austin Schuhe456f152015-11-27 13:44:39 -080028 argv = FLAGS(argv)
Austin Schuh29659232015-11-26 13:55:30 -080029
Austin Schuhe456f152015-11-27 13:44:39 -080030 if FLAGS.plot:
Campbell Crowley73a86772017-12-29 15:17:33 -080031 drivetrain.PlotDrivetrainMotions(kDrivetrain)
32 elif len(argv) != 5:
Brian Silverman17f503e2015-08-02 18:17:18 -070033 print "Expected .h file name and .cc file name"
34 else:
Campbell Crowley73a86772017-12-29 15:17:33 -080035 # Write the generated constants out to a file.
36 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2014', kDrivetrain)
Austin Schuh572ff402015-11-08 12:17:50 -080037
Brian Silverman17f503e2015-08-02 18:17:18 -070038if __name__ == '__main__':
39 sys.exit(main(sys.argv))